![]() Mark_deal_processed method would result in a change in the file as well. Any change in the steps required to mark a deal as processed in the For instance, we might want to vary the percentage based onĭeal amount. New commission rules or strategies that would cause our calculate_commission ![]() Any change in how weĬalculate commissions would require a change to this class. Look at reasons we might want to change this class. At first glance the class seems simple enough, but let’s In the above class we have a single command interface that processes commission create ( deal: deal, amount: calculate_commission ) mark_deal_processed end end private def mark_deal_processed. Let’s look at an example of some code that isn’t following theĬlass DealProcessor def initialize ( deals ) = deals end def process. Itself (as in modifying the code in the class’s file, not the object’s in-memory By change I am talking about structural changes to the class That anything that gives a class a reason to change can be viewed as a While we all agree that focusing on a single responsibility is important, it’sĭifficult to determine what a class’s responsibility is. Small and focused it also makes them easier to understand. Keep classes and methods small and maintainable. ![]() The Single Responsibility Principle is the most abstract of the bunch. Let’s take a closer look at each of these principles with some examples. Of our codebase and architectural approach. ![]() These principles as the foundational elements we use when evaluating the health Principles that help engineers write maintainable code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |