Most Important Things First
To me, prioritizing the most important things first is not only a crucial life principle but also a key strategy for developing and maintaining code. The concept may not seem revolutionary, yet I’ve noticed that many developers overlook the significance of organizing their code for enhanced readability. Below are a few examples and posts:
- Ordering of words in a function/variable name.
- Ordering of declaration/calling of functions in a class definition.
- When Validating Inputs
It first struck me that this was worth talking about when a coworker asked me to alphabetize the keys in an object literal, prompting me to think there must be a more effective approach. What’s the value in alphabetizing, and what meaning is lost? How can we get both? That’s discussed in Item 1. This is part of my series on naming.
Above are just a few opportunities to organize your code by importance. Many times, what you want to see in code is first a summary (in some way) and then the actual implementation, buried below it. Item 2 above helps with that. This is part of my series on structuring.
Item 3 calls to mind the “Garbage In, Garbage Out” principle. While this is currently under “structuring”, it also could/should have a place with throwing exceptions in my series on exceptions where we (don’t) handle things outside the scope of our software.
In conclusion, this post serves as an introduction to several series that are all informed by a few principles. Namely, “Most Important Things First”.
tags: Programming - ProgrammingPrinciples - CodingStyle - ItDepends