Hacker News new | past | comments | ask | show | jobs | submit login

> How does that add value? Imagine 'x' is '(int)(aRec[RecIndex(p->handle)]->itemCountRef)'

That's a gnarly code smell and a Law of Demeter[1] violation. I suspect you could find a better way to express that operation without requiring that a single line of your code know so much about so many different things (aRec, aRec members, the return value of RecIndex, p, aRec member -> itemCountRef).

1: http://c2.com/cgi/wiki?LawOfDemeter




I guess it still adds value (potentially? Maybe less so with IDEs and maybe not worth the language complexity tradeoff) if you use very long variable names, which do help somewhat with readability.


I think you're missing the point.


Am I? The language doesn't need to make affordances for bad code, bad code needs to be refactored into better code.


Oh for heaven's sake, use some other complex reference then.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: