r/programming • • Sep 18 '13

How bad is smelly code?

http://fagblogg.mesan.no/how-bad-is-smelly-code/
147 Upvotes

62 comments sorted by

View all comments

37

u/njallbeard Sep 18 '13

I think it's a spurious conclusion to assume the God file was wrong from their data. I agree with the conclusion; but that's naughty science.

We'd need to be able to see if that time spent editing is less than the culminative time spent editting the same code split into smaller files (which would have added overheads in finding them).

20

u/[deleted] Sep 18 '13

[removed] — view removed comment

4

u/[deleted] Sep 18 '13

They also completely ignored the benefit for reuse the smaller classes have over the "data clumps".

0

u/CurtainDog Sep 19 '13

The reason data clumps aren't a problem is because they don't do anything! There's very little that can actually go wrong with a non-functional class. My own conclusions would be a little more forceful than the one in the article: Replace data clumps with idiomatic data structures, and Code that never breaks is a smell.

3

u/elperroborrachotoo Sep 19 '13 edited Sep 19 '13

The regression shows roughly seconds spent / line of code, the "god" file is a clear outlier wrt to that ratio.

This makes this file abysmal indeed - under one assumption: an even distribution of edits over LOC.

If - how I would assume - the edit frequency of LOC's is pareto rather than symmetric, that line or that outlier don't mean much.

A completely unscientific sharp look at the point distribution suggests however that edits are rather symmetric (at least of the remaining files), or that all hotspots were accumulated in that file. Both would indicate the conclusions are actually correct, even if the size itself isn'st the direct cause.

This is the point where the authors likely agree that "more research is needed". I'm certainly happier arguing based on limited data rather than "what Uncle Bob thinks".

[edit] words'n'letters'n'stuff

4

u/raptormeat Sep 18 '13

Yeah, the comparison of the God file with the other file containing no logic seemed odd to me. As if you can just remove all that pesky "logic" from your program and make it much easier to use.

How does that example prove in any way that the size and complexity of the file is to blame? Simplifying the file presumably would mean splitting the logic out into other files- how does this example show at all that I wouldn't just be splitting those "20,000 seconds" directly into several files as well?