Hacker News new | ask | show | jobs
by contravariant 1621 days ago
There's something to be said for preferring composition over inheritance, but in that case overly DRY code consists almost entirely of glue. As with almost anything it's a matter of choosing the right tool for the job.

The only code style advices that I've found to hold nigh universally are the following:

- The best code is no code

- Don't end classes in 'er' or 'or'

Coding paradigms are good when they let you do those things and are bad when they don't do both of those things (i.e. they result in more code or clases ending in 'er'; a class named 'Helper' is a code smell worse than sulfur dioxide)

2 comments

Almost every one of my classes (in my UIKit app) is a ViewController. I don't really need to write anything more.

So they pretty much all are "er" classes. ¯\_(ツ)_/¯

So what you're saying is you've got a bunch of views and most of your programming code is spent on classes that ensures they do the right thing?

I'm not ruling out that this is an illustration of the problem with classes ending in -er.

Not saying it's great.

It's just the way you write iOS apps (at least, the original design way).

It's classic MVC. Most of the action happens in the controllers.

BTW: I totally agree that the best code I write, is the code I don't write.

Simple fix, name it HelperClass instead?