Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Beyond functional programming as shared by other people on this thread, the programming style that has most affected me was separating major layers of a SW stack - in particular, the data model, the business logic and presentation.

This sounds kind of trivial, but it entails three very useful techniques:

0. Passing strictly typed immutable data structures (i.e., DTOs) that formalize and enforce the pre- and post- conditions at each such layer of the code;

1. Dependency injecting useful resources, as opposed to keeping them inside god objects/"managers";

2. Allowing each layer to use a different programming style, quality bar, logistics etc.

One caveat: I don't think that modularizing code causes it to require fewer changes when introducing new behaviors. For example, if you add a new data field, you'll have to go through all layers. However it definitely can make each of the piecemeal changes quicker and cheaper.



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

Search: