When I was asked what my favorite color was growing up, I’d always say “the rainbow”. Genuinely, I loved all the colors of the rainbow, and seeing a rainbow always made me smile. One of the things I enjoyed as I started learning how to code was how the key words would turn different colors. Whenever I declared int 6 or string line, all of a sudden it was pink and blue. I love the colors on my screen popping up as I coded. Not only does it make me happy, it makes things clear to me. Variables are one color, different parts of the method call are another, the return value is another – with color everything feels tidier. But there’s one color I’ve been seeing more often: red.
In my last ICS class, I was introduced to the concept of coding style and its significance in programming. It was also a factor in my grade. Essentially, coding style refers to the conventions used in writing readable code. It ensures clarity and consistency throughout a program. It’s been a big topic in this department, and I remember participating in surveys conducted by TAs about determining the most effective approaches for naming variables and methods. My instructor last semester made a point that stuck with me: we live in an age where now we have a lot of resources and a lot of programmers, so the emphasis is making sure that the code we share is readable so anyone can see it, understand it, and work with it.
Using ESLint was my intro into code analysis plugins to check to see if my code meets coding standards. When I first used it in my IntelliJ it colored everything red. It frustrated me, it was like having a nit-picky critic fixing my grammar before I even finished a sentence. From simple parenthesis placement, to spacing, to name choices - ESLint got on me for everything. Hovering over those error highlights let me know what was out of conformity, and slowly my code changed shape and color. While some suggestions, like having a space between the parameters and parenthesis, isn’t something that I feel strongly constributed to a more aesthetic code, others did make my code cleaner. Consistent formatting, clear naming conventions, and organized structure make the code easier to read, understand, and maintain.
Coding standards are invaluable for long-term success in software development. They promote uniformity and efficiency in code development and provide a structured framework for achieving quality in software projects. They also contributes to the longevity of code since well-structured and well-documented code is less prone to errors, easier to debug, and more adaptable to future changes and updates. Investing time and effort in establishing and maintaining a good coding style truly pays off in the long run.
I’m learning how to handle the red underlines. Learning through conforming to a coding standard is conducive to learning the language itself - the errors help you understand the underlying principles of the language. With ESLint constantly looking at my code I feel more mindful of how I write out my code and I understand with each error how my code could be improved.
I’ll be seeing red frequently, but I’m minding it less and less. It is just another pretty rainbow color that allows me to understand my code.