News for hackers. Stuff that matters.
Re:Do We Worship Complexity? by jcelerier on Tuesday October 16, 2018 @03:39PM (#18232499)
> I remained in Java, but took a functional and dynamic approach yielding a three-line implementation of the engine where each command was simply a function.

okay, so what do I do when I need to dynamically load an additional command by name from an external .jar ? that's like, the most basic thing Java was meant for.

Re:Do We Worship Complexity? by emsy on Tuesday October 16, 2018 @04:04PM (#18232746)
The author describes a YAGNI approach. The interviewer and you seem to want a solution that's already generalized and future proof. YAGNI is always the right approach to take at the beginning of a problem. But that's one of the insights that often come with programming experience and reflection. Unfortunately, seniority is an unreliable indicator for either attribute.
Re:Do We Worship Complexity? by tabtab on Tuesday October 16, 2018 @04:57PM (#18233200)
Perhaps one should ask the interviewer whether they want a YAGNI-style solution or a more general/abstract solution. If you can give both, you may really impress the interviewer.

Asking first to understand the needs and intention of the application should be a first step anyhow. Diving into the deep-end face first and coding is rarely the correct approach (except maybe a startup racing for market-share).

Re:Do We Worship Complexity? by nemo846 on Tuesday October 16, 2018 @08:14PM (#18234430)
> generalized and future proof

Reminds me of a blog post I read,

https://www.sebastiansylvan.com/post/the-perils-of-future-co...

At what point does it become over-engineering?

Re:Do We Worship Complexity? by emsy on Wednesday October 17, 2018 @04:04AM (#18237074)
I think the article captures the problem even better than a similar one that was recently on the frontpage of HN: https://news.ycombinator.com/item?id=17850836

I can't remember a situation where undergeneralized code came back to bite me. I have however seen (and admittedly written some) prematurely generalized code that became messy legacy code.

Re:Do We Worship Complexity? by AlexCoventry on Wednesday October 17, 2018 @12:42AM (#18236177)
You often can't tell up-front. If you never get back more than what you put into an abstraction, it was probably over-engineered.
Re:Do We Worship Complexity? by wvenable on Tuesday October 16, 2018 @04:58PM (#18233214)
You change the implementation. I think the fear of actually changing already existing code leads to the majority of problems with software development.
Re:Do We Worship Complexity? by TeMPOraL on Wednesday October 17, 2018 @06:59AM (#18237871)
That's true. We're not writing code in stone tablets; at any point in time you can just dig in and change what you wrote before. It's infinitely easier if that code is simple, because was written straight to the point, instead of being wrapped in large abstractions.
Re:Do We Worship Complexity? by TeMPOraL on Tuesday October 16, 2018 @03:55PM (#18232660)
This should be in requirements. It apparently wasn't in the ones OP was given.

Also, the answer should not be "large dependency injection framework".

Re:Do We Worship Complexity? by wellpast on Tuesday October 16, 2018 @03:59PM (#18232712)
Also I would say the answer is better left independent of the runtime environment.

Yes you can load Java classes into the JVM. But why not have a serialization format that is independent of the vagaries and specifities of the JVM?

Still, even if you lean on the JVM, that changes nothing about this particular problem. You don't need command pattern. You don't need a type hierarchy.