News for hackers. Stuff that matters.
Re:Attitudes That Lead to Maintainable Code by daxfohl on Wednesday March 08, 2017 @08:31AM (#13820080)
I'd argue that sometimes you do want to hack things. Sometimes you go way out of your way to avoid that one special case for that one odd requirement, abstracting things out several layers to present a unified framework that encompasses that one oddball. Then the next day you get another oddball thrown at you that completely dorks it up. After a while you don't even remember why you had all the layers. At the end of the day, coding explicitly to the special cases and calling them out as special cases may make for more intuitive code.

(Also see "The Wrong Abstraction": https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstracti...)

Re:Attitudes That Lead to Maintainable Code by bm1362 on Wednesday March 08, 2017 @09:48AM (#13820551)
For what it's worth, I agree with you. I think premature abstraction can cost a business a great deal. This article comes across as vapid - there is no silver bullet and it varies from org to org.

I went from a big tech co where we had the resources to abstract and deliver ideal solutions, to an existential startup that is hacking features together to win contracts. My biggest frustration is new engineers joining and overcomplicating simple tasks by trying to create generic solutions to every single feature request we get. The worst is that this comes across as 'investment' to management but it hardly ever bears fruit and we're just slowing down delivery to massage the developer's anxieties about technical debt. The reality is that the product may not really need that feature, or the customer may never use it, or it's good-enough, etc. I think in this environment we should ship simple features, that are hacky, until we gather enough data about it's value and use.

Re:Attitudes That Lead to Maintainable Code by chrisbennet on Wednesday March 08, 2017 @10:13AM (#13820742)
There is even a "rule" for what you espouse: YAGNI - You Ain't Gonna Need It

If all you ever going to deal with is humans in your class/API, there is no need to make it generic enough to work with all animals. The Clever Boy in all of us probably wants to implement this bit of "future proofing investment" but we need to resist the temptation.

Re:Attitudes That Lead to Maintainable Code by chrisweekly on Wednesday March 08, 2017 @12:17PM (#13821664)
YAGNI is great one.

I wish STTCPW (Simplest Thing That Could Possibly Work) made for a better acronym. Also related: KISS (which I prefer to interpret as "Keep It Stupid-Simple").

Re:Attitudes That Lead to Maintainable Code by mrec on Wednesday March 08, 2017 @02:47PM (#13823104)
STTCPW has problems aside from its acronym; back when I was working in an XP-ish team we had any number of arguments which I eventually realized came from a fundamental ambiguity in this principle: does it mean

1. Make the simplest incremental change to the existing system to satisfy requirements, or

2. Make the simplest overall system which satisfies requirements?

The first is fine for prototyping when you're moving fast and breaking things, but guarantees technical debt out the wazoo over the longer term. The second makes for much better code but you may waste a lot of time on refactoring churn if you do too much of it before requirements have really stabilized.

Re:Attitudes That Lead to Maintainable Code by AstralStorm on Thursday March 09, 2017 @07:44AM (#13828865)
The counterpart is YWNI - You Will Need It.

Usually considering the parts of abstraction that will reduce coupling and make understanding easier, or allow making an implementation high performance or secure. You know, things nobody really states in requirements but everyone wants in the end. Most of the time internationalization and localization are also needed but not stated outright.

Also consider things that are essentially impossible to bolt on later or inordinately expensive.

Re:Attitudes That Lead to Maintainable Code by falcolas on Wednesday March 08, 2017 @09:28AM (#13820422)
For every rule, there is an exception which helps to prove the rule. Yes, hacking is sometimes necessary and is frequently a more efficient use of your time in the short term, but it should always be asked: "will I understand this hack next year?"

Tomorrow's oddball might not happen, after all.

Re:Attitudes That Lead to Maintainable Code by hasbot on Wednesday March 08, 2017 @11:03AM (#13821117)
That's where I find a VCS really helpful. If I'm wondering about a particular oddball section of code, I can go back and look at the context in which it was introduced. This is very handy especially for code that was written by multiple people over time.
Re:Attitudes That Lead to Maintainable Code by daxfohl on Wednesday March 08, 2017 @09:38AM (#13820484)
Sure, I'm just in the process of untangling a huge unnecessary abstraction right now, so when I read the article, I couldn't help but comment.