Click here to Skip to main content
15,891,253 members
Articles / Operating Systems / Windows
Technical Blog

The Rules of Minimalist Programming

Rate me:
Please Sign up or sign in to vote.
4.55/5 (5 votes)
3 Oct 2013CPOL1 min read 6.9K   4  
Rules of minimalist programming

Less is often better. In mathematics, physics, and arts, simplifying and shedding every bit of complexity and redundancy have produced remarkable results. It leads to abstraction, elevates expressiveness, and reveals patterns that are otherwise buried in details.

Programming is no different. For a developer that looks for correctness (does my program behave as expected?), efficiency (does my program use CPU and memory resources appropriately?), and robustness (can I reuse my program or extend it easily for future applications?), minimalism is a sure guideline. The beauty of simplicity translates into better programming.

  1. The less code, the less bugs. Reduce the size of your code with factorization, dead code removal, and the use of standard libraries.
  2. Keep function size small. If it doesn’t fit on your screen, it is probably too complex.
  3. Keep the depth of control structure small. Too many imbricated conditional and loop statements are hard to understand.
  4. Minimize accessibility. Make your variables and functions private or protected whenever possible.
  5. Minimize the lifetime of variables. Use persistent data as the last resort.
  6. Minimize the scope of variables. This makes reading the code simpler. And it helps the compiler to better optimize the code.
  7. Make the API as simple as possible. It helps eliminating redundancy and strengthening semantics.
  8. Use meaningful, standardized names for classes, functions, and variables. Just reading the name of a function should be enough to understand what it does.
  9. Clearly differentiate which data is mutable and which is not in the scope of a function. Use const declaration whenever possible.

Now go and rake your Zen garden.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect OC Consulting
United States United States
I have 20 years experience in software architecture and product development, including 10 years experience in research. I worked at eBay, Synopsys, Mentor Graphics, Magma, and I am an independent consultant in software design and development. I have published 50+ research papers or book chapters, and invented several algorithms for which I hold a few patents.

I am interested in technology as a whole, in particular software, hardware, and web-based applications. Check me out on LinkedIn or twitter (@ocoudert).

Comments and Discussions

 
-- There are no messages in this forum --