InfoQ Homepage Presentations SOLID Software and Design Patterns for Mere Mortals
SOLID Software and Design Patterns for Mere Mortals
Summary
Phil Japikse explains SOLID software principles - Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion- and how to apply them using design patterns.
Bio
Phil Japikse is a Microsoft MVP and also holds MCSD, MCDBA, CSM, and CSP certifications. He has spoken at Code Camps and Days of .NET and is the Lead Director for the Cincinnati .Net User’s Group. Phil works as the Patterns and Practices Evangelist for Telerik (www.telerik.com). You can follow Phil on twitter via www.twitter.com/skimedic and read his blog at www.skimedic.com/blog.
About the conference
Code PaLOUsa is a conference designed to cover all aspects of software development regardless of technology stack. It has sessions revolving around Microsoft, Java, and other development platforms; along with session on higher levels that are platform agnostic. The conference schedule will feature presentations from well-known professionals in the software development community.
Community comments
Barbara Liskov is a "she"
by Chris Sutton,
ok...
by Ranjix ranjix,
Re: ok...
by Ranjix ranjix,
Re: ok...
by Grubhart Chavez,
Re: ok...
by Ranjix ranjix,
video is slow in China.
by Meng Jian,
Double Checked Locking might be broken
by Fernando Cardoso,
Re: Double Checked Locking might be broken
by Luis Espinal,
Barbara Liskov is a "she"
by Chris Sutton,
Your message is awaiting moderation. Thank you for participating in the discussion.
en.wikipedia.org/wiki/Barbara_Liskov
Barbara was referred to as a "he" several times during this talk.
ok...
by Ranjix ranjix,
Your message is awaiting moderation. Thank you for participating in the discussion.
1. for the "many methods with 4-5 lines of code", answer shouldn't be "well, what you want, a method with thousands lines of code", there is some granularity between the 2 extremes described, the talent is in finding that balance between size (of methods) and number (of methods), in such way that the balance still makes sense (semantically) and the code is readable.
2. "make a method do ONE thing well" is ambiguous. A method which calls 2 methods that each do ONE thing well, will do TWO things, unless you define doing the 2 things as doing 1. Maybe for you it's clear what you mean, sorry, for me isn't.
3. instills a fear of change which shouldn't really exist, the changes are the only constant thing, right?
5. the liskov principle is a nice one, nobody actually implements it as it's stated (possibly Eiffel, with the postconditions). Overriding shouldn't be allowed in case the principle is enforced (the behavior of a method between child and parent classes differs, hence they can't really be "substitutable").
6. there is a good undertone of "think before you apply".
7. the rest is ok, but again, unconvincing.
Just my 2 cents.
Re: ok...
by Ranjix ranjix,
Your message is awaiting moderation. Thank you for participating in the discussion.
for some reason I deleted the 4. in the above list.
4. "no plans survive the first battle", the same applies to all the "smart, beautiful, elegant" APIs I ran into, after a while (think years) they became ugly, tired, useless and in general obnoxious.
video is slow in China.
by Meng Jian,
Your message is awaiting moderation. Thank you for participating in the discussion.
Does infoq use any CDN?
Re: ok...
by Grubhart Chavez,
Your message is awaiting moderation. Thank you for participating in the discussion.
about 2: Uncle Bob wrote in clean code book : "if a function does only those steps that are one level of abstraction below the stated name of the function, then the function is doing one thing. After all, the reason we write functions is to decompose a larger concept (in other words the name of the function) int a set of steps at the next level of abstraction"
Regards
Grubhart
Re: ok...
by Ranjix ranjix,
Your message is awaiting moderation. Thank you for participating in the discussion.
well, both the presenter and uncle bob are right (and I actually do understand what the presenter stated), unfortunately the wording is not great in either case. In case of the presentation, is not the "number" of things that is the problem ("that number must be 1"), but is the purpose of things which matters, a method should do only and strictly what's required of it and nothing else ("what's required" is a different issue which needs a better definition). In case of uncle bob (how is uncle bob?), is difficult to think in terms of "how many levels of abstraction" are between certain things, and make sure that the number is 1, so it's not really helpful either (for example, how many levels of abstractions are between a method that saves an object and a method that calls a SQL statement? my personal answer is "who the hell knows?").
IMO in both cases someone tries (too hard) to extract some smarty-pants "principles" from a fairly down-to-earth example, and, in doing so, lose or hide the meaning.
Double Checked Locking might be broken
by Fernando Cardoso,
Your message is awaiting moderation. Thank you for participating in the discussion.
For Java, one should keep in mind that this double checked locking for Singleton creation might be broken.
www.cs.umd.edu/~pugh/java/memoryModel/DoubleChe...
Re: Double Checked Locking might be broken
by Luis Espinal,
Your message is awaiting moderation. Thank you for participating in the discussion.
Uh, that was solved almost 8 years ago with Java 5.