3 ms·
Yeah, but the function only had a single exit point, so it was following best practices.
by jandrese 5y ago
Yeah, but the function only had a single exit point, so it was following best practices.
- ben_w 5y agoI don’t remember if it did or didn’t have a single exit point. But the thing as a whole didn’t follow any best practices I’ve ever heard of: the project also had what looked like a bizarre attempt to reimplement the concept of properties(!), in that the UI classes had fixed length arrays of all their subviews, which were accessed by constants. Each section of the UI had its own god class, where different views in that section were all the same class, called with a constructor that determined if a view ought to be created for any given constant. There were also something like 20,000 blank comments. No idea why, the guy who added them didn’t even understand my question: int something = foo(); // double baz = bar(something, 5); That kind of thing. (The project is no longer available and the business who made it has since closed, before anyone asks).
- jandrese 5y agoI was being tongue in cheek about people who religiously follow that "single entry and single exit to any function" rule and then get wrapped around the axle when a function needs to make several discrete sanity checks at the start before doing work.
- ben_w 5y agoFair enough, it’s hard to convey tongue-cheek position in writing ^_^