Skip to main content
12 events
when toggle format what by license comment
Jan 25, 2018 at 20:11 comment added user949300 Depending on language (OP didn't specify) the updateOrCreateAll may be unnecessary. For example, in JavaScript, it could be something like array.forEach(updateOrCreate);
S Jan 25, 2018 at 19:41 history suggested Dherik CC BY-SA 3.0
formmating
Jan 25, 2018 at 16:51 review Suggested edits
S Jan 25, 2018 at 19:41
Nov 17, 2017 at 8:38 comment added Filip Milovanović @FrankHileman: "This is probably a poor example" - I agree with that (I did say that it's "a toy example", and that "this particular example isn't the best demonstration"). Your other points make sense as well.
Nov 16, 2017 at 23:25 comment added Frank Hileman @FilipMilovanović This is probably a poor example for that argument. The calling method was not large to start with, and the called method is used in only one place. Whether it is more or less readable depends on how well one can understand the meaning of the method name. Most developers I work with, would consider the creation of trivial methods to make the code less readable, but it is entirely subjective.
Nov 16, 2017 at 13:39 comment added Filip Milovanović As for readability - this particular example isn't the best demonstration, but extracting the "guts" of a method into a separate method can significantly improve readability for a dev who is new (or returning) to the project and just wants to quickly understand what the method does conceptually, without going into (or really caring about) the details of how it does it.
Nov 16, 2017 at 13:39 comment added Filip Milovanović Well this is a toy example, and here it looks more or less like a matter of style, but SRP is about separating axes of change (and should really be informed by change request history), so that you can minimize/control interdependencies between the two. So while SRP could be better defined, it definitely isn't worthless - but shouldn't be applied blindly.
Nov 15, 2017 at 23:22 comment added Frank Hileman I would not find it more or less readable either way. And there is no software engineering in this question...
Nov 15, 2017 at 23:21 comment added Steve Chamaillard You're clearly missing the whole point of refactoring, which is to keep the same logic but change the form of it to make it more maintainable and more readable. That's exactly what happens there. Also SRP means one responsibility, people often confuse this with one action which is the reason why most people feel like they're not respecting SRP whenever they write a controller method using the MVC pattern.
Nov 15, 2017 at 22:29 comment added Frank Hileman The code is identical. You have only added a method call and made cosmetic changes. "Or" indicates the method (same as if statement previously) can do one of two things. SRP is definitely worthless...
Nov 15, 2017 at 13:58 vote accept Milan Tenk
Nov 15, 2017 at 10:28 history answered Steve Chamaillard CC BY-SA 3.0