Hacker News new | ask | show | jobs
by galaxyLogic 1445 days ago
I think the rule should be "Try not to repeat yourself"

Rules are like alarms they draw our attention to some peculiar condition which gives us pause to think about if it's kosher and if not why not.

1 comments

The art of programming is finding the fit and exceptions to the rules. It's just, frankly, a lot easier to be dogmatic.

Someone says "never do this" or "always do that" and you can apply those rules with abandon (often leaving a maintenance nightmare in your wake).

There are no rules to programming.

I find it useful to think of it as forces pulling on the design, similar to physical forces acting on an object. There are forces that try to keep individual truths/knowledge and responsibilities in a singular place, there are forces that try to minimize abstractions, coupling, dependencies, and indirections, there are forces that try to maximize coherence and separation of concerns, and so on. It’s an essential part of the job of a software engineer to balance those adequately in the design of the software.
Right. There are also "forces" like management who want the project to be finished yesterday.

Another metaphor I like for programming is Chess. Any line you add to the program constrains its future development, becomes "weight" or "force" that pulls your development into some direction. Sometimes you have to sacrifice features like pawns. Sometimes you may sacrifice security, you may think it is secure enough. The outcome of this game is often a draw, or stalemate. And the same game can continue for years.