Home Blog CV Projects Patterns Notes Book Colophon Search

Naive Style

14 Jan, 2017

A style of coding I'm liking involves being incredibly naive in a subset of ES6 and putting in no architecture or optimisation whatsoever. Some characteristics:

The beauty of being hopelessly naive and not fixing any "problems" with the code is that your code emerges to fit exactly your problem space, rather than your preconceived solution ideas. The functions that emerge tell you about your APIs. Code that becomes coupled together by promises tells you about the implicit protocol of what you are doing (the order in which things have to be called). The code reflects the business requirements and looking at the code can give insight about the business.

You never do more work than you need to (either in writing code or in testing) and that means you are never worried about throwing out some of what you've done and doing it better. Besides, refactoring absurdly naive code that is devoid of patterns and architecture is really easy because there is nothing to understand, so you won't be overly attached to your investment.


Hint: any time you need to reach for a cache you are probably calling things in the wrong order due to premature architecture. A promise passed to one or more functions might be better.


See also: Gardner's Law

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.