Timeline for When to Method and when to Class?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 27, 2018 at 21:52 | comment | added | candied_orange | @JesusAlonsoAbad I still want to know more about the context. There are many other considerations. If I left it at that then the single reason to change can be "cause Abe in accounting said so". I'd like to decompose down smaller than AbesAccounting class. These ideas are good but they are not compatible with structure only thinking. | |
| May 27, 2018 at 21:45 | comment | added | Jesus Alonso Abad | Essentially, in the Single Responsibility Principle "responsibility" means "reason to change". In your example, if the class has to change if either the way to write to a file or the format data is output changes, then you should split the class. In this case you may abstract the persistence media to a "PersistenceMedia" interface, and then implement it in a "FilePersistenceMedia" class, responsible of opening, reading, writing, and closing the file. | |
| May 27, 2018 at 21:11 | history | edited | candied_orange | CC BY-SA 4.0 | deleted 5 characters in body |
| May 27, 2018 at 19:45 | history | edited | candied_orange | CC BY-SA 4.0 | added 56 characters in body |
| May 27, 2018 at 19:43 | vote | accept | dushkin | ||
| May 27, 2018 at 19:34 | history | edited | candied_orange | CC BY-SA 4.0 | deleted 2 characters in body |
| May 27, 2018 at 19:21 | history | edited | candied_orange | CC BY-SA 4.0 | added 68 characters in body |
| May 27, 2018 at 19:14 | history | answered | candied_orange | CC BY-SA 4.0 |