He achieves that goal with flying colors. In this book Bob Martin tells us that he’s only going to cover what we really need to know to be better Java programmers. ![]() I love that the author tells us things like that “in the last decade I think I have drawn less than a dozen object diagrams of this kind.” That’s great to know! Because many other books try to cover every diagram and modeling technique they all end up appearing equally important. A view class is responsible for one view. A BO class is responsible for one Business Object instance A BO factory is responsible for instantiating for class and it’s sub classes. Class is responsible for one job or purpose. This book addresses one of the big problems I’ve had with many other UML books–it tells the reader right upfront that not all diagrams are equally important. Appendix: SOLID principles S Single Responsibility Principle. More importantly, we’re told how to recognize this problem in UML diagrams we create or inherit. The Unified Modeling Language or UML is not a textual language, but a set of graphical notation techniques to specify. The book shows a brief snippet of Java code that violates this principle and then shows the UML for how to design it better. That’s pretty obvious but it’s still a common mistake. This principle tells us that “a class should have only one reason to change.” In other words, don’t put everything into one class. Im planning a talk about SOLID and trying to getting examples of good use of these principles using the OpenJDK source code. ![]() As just one example, the “Single Responsibility Principle (SRP)” is discussed. I like that the author goes beyond just describing each of the UML diagrams and takes the opportunity to teach good design while he’s at it. C++ or other programmers should have no problem reading it, for example. While all of the example code is in Java I’d still recommend this book to anyone who wants to learn more about modeling and who has even a passing familiarity with Java. Can explain single responsibility principle. If code is the goal then it is worthwhile understanding the relationship between our models and our code. So, let’s discuss some code smells which could indicate a violation of the ISP. ![]() Whether working solo or in larger teams, it helps to identify problems in code early. The single responsibility principle (SRP) is one of the five SOLID design principles that can help you write clean, maintainable, and testable code. Code Smells for ISP Violations and How to Fix Them. We model in order to write code and Bob Martin clearly presents that perspective in this book. Violating the ISP also leads to violation of other principles like the Single Responsibility Principle. I love the liberal use of source code throughout this book. There’s even advice in here suitable for the best programmers I know. Topics are introduced at a level appropriate for beginners but each topic progresses at a nice pace into intermediate territory. This is a great book for learning or improving with UML.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |