4 ms·
Hmm, SOLID is very well-known and the principles are ubiquitous good practices for object-oriented programming and also useful for software dev in general. Cer
by mytailorisrich 3y ago
Hmm, SOLID is very well-known and the principles are ubiquitous good practices for object-oriented programming and also useful for software dev in general.
Certainly, asking about them and , especially, asking the candidate to critique them is a very good question.
- diarrhea 3y agoOnly ones I ever found worthwhile are D and maybe I.
- mytailorisrich 3y agoS (Single responsibility principle) is very important, not only for OOP but for good, maintainable software design in general (yes, even if you do firmware stuff).
- diarrhea 3y agoAbsolutely. I just find it rather inactionable, as it can be subjective.
- mytailorisrich 3y agoOdd because that's arguably the easiest to apply when designing software.
- tetromino_ 3y agoThe only part of SOLID that is unquestionably correct is "L" - it is the only sane way to use subclassing in OO languages. "D", when used judiciously, can be useful because it can make unit tests much easier to write. But when used too much, it results in incomprehensible code. But as for "I", in my humble opinion, when you find yourself reaching for it, it's a sign that the code base is already poorly organized.
- fhars 3y agoBut the L part is only correct in so far as it repeats the definition of what it means to be a subtype, i.e. it is vacuously true. BY the way, does any OO language apart form Ocaml get this right?
- ahtihn 3y agoThe L part was apparently not so obvious to the authors of the Java standard library since it has violations all over it. Readonly implementations of java.util.List come to mind.
- t8sr 3y agoIt’s well known in a specific setting, possibly? I’ve managed to never hear of it in 18 years. If asking “well known to some people” stuff is kosher, should I be able to quiz candidates on FFP design principles in Haskell, or maybe how to implement collision detection in a video game? Both of those are well known in swaths of the industry. I guess if you’re hiring for a specific role, writing OOP business applications, you will have no shortage of candidates who know about SOLID, but you’re probably passing on everyone who is changing domains.
- hajile 3y agoIt’s generally not what it claims. Single purpose is a good idea, but the rest… The idea that one class changing won’t change others is a pipe dream. Substitution only matters if you’re using inheritance, but if you’re inheriting, you likely have bigger problems as few real world problems are naturally represented by inheritance. The interface rule is redundant with the single principle idea. Maybe it should have been SOLD instead. Dependency injection is a guideline at best. If you actually do what it says, you get enterprise fizzbuzz. It should only be used occasionally and sparingly at specific boundaries otherwise the cure becomes worse than the disease. More controversially, when you avoid inheritance in favor of composition in a language like Java, you lose polymorphism while keep a leaky abstraction and really bad encapsulation while the language still retains all the mental and syntactic complexity of the inheritance bits. https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
- mytailorisrich 3y ago> The idea that one class changing won’t change others is a pipe dream Reality is never black and white but that's a good principle for good software design and worth at least aiming for. If anything that has been adopted and generalised in microservices, etc. because encapsulation, modularity, design by contract all hinge of this same idea, which is powerful and useful. That's why when discussing any "principles" the important is to get the core idea behind them instead of sticking to the letter and discarding them as useless.
- hajile 3y agoEncapsulation is extremely important and pairs with single responsibility, but that’s completely orthogonal to OOP. Once you are solidly in the composition camp, functions are immediately superior. They tend to be naturally single purpose and have mathematical rules that make them easy to compose. Most function-heavy languages also adopted modules which provide a better, less-leaky abstraction too and that’s without getting into all the other advantages in the type system or better syntactic ergonomics from dropping all the OOP baggage.
- 3y ago
- AgentOrange1234 3y agoPerhaps there’s a difference between knowing and having internalized these concepts, versus having heard of them via a particular acronym, and being expected to remember that acronym and these specific names. “Liskov substitution principle” for instance is something I had to look up. I can read it and say, “oh, duh, yes that’s a key part of what interfaces are even for.” I’ve built with it for decades now. The term SOLID was apparently introduced in 2004. It would be a shame to reject good programmers who can opine intelligently on these principles, but who have not internalized this particular jargon.
- MyFedora 3y agoYes, there is quite a difference in my opinion. What does SQL stand for? No clue, but I can write you an SQL query. Same thing with HTML, CSS, PHP, etc.
- jval43 3y agoThat's funny. I wrote SQL daily for 10 years, read the ISO standards when working on SQL transpilers, persistence frameworks for multiple databases, etc. Even wrote a new storage engine for MySQL once. But I just had to look up what the acronym stands for! Apparently it's "structured".
- mytailorisrich 3y agoIsn't that the point? Even if the candidate doesn't know the acronym you can probe if they know and understand, and be critical of, what the principles are.
- deleted 3y ago[deleted]
- coldtea 3y ago>Certainly, asking about them and , especially, asking the candidate to critique them is a very good question ...if you're looking to hire a code quality consultant that has not written any code since the 90s
- mytailorisrich 3y agoIf you think those principles got out of date then indeed I would not hire you. Something like the "single responsibility principle" is just good software design to anyone who ever had to maintain any piece of software. Quite extraordinary how commenters in this thread discard things as old without even understanding that core principles are as valid now as they were then.
- coldtea 3y ago>If you think those principles got out of date then indeed I would not hire you If you think your hiring criteria are some kind of general yardstick, I wouldn't want to be hired by you in the first place. What's with people using their position of power (hiring people) as some kind of argument - or perhaps threat? >Something like the "single responsibility principle" is just good software design to anyone who ever had to maintain any piece of software. The "single responsibility principle" is an ad hoc, ill defined idea. A bad idea for many real world cases, that has to be applied with discretion - not taken as a core guiding principle. Not to mention that neither "reason to change", nor "change" is well defined by Martin. It's as bad one-size-fits-all advice as advising about the ideal function being "two to four lines of code long" (also by Martin) - leading to crappy, hard to follow code, and needless abstraction. KISS - now that's a principle I would get behind.
- mytailorisrich 3y agoA principle always has to be applied with discretion. Hence why I think why the OP's idea to ask candidates to critique is good. It shows whether the candidate blindly follow things as the gospel or is able to articulate limitations but also the reason behind a "principle" because there are very good reasons behind them.