Lessons learnt in the trench as a software engineer
Photo by Matt Duncan on Unsplash

Lessons learnt in the trench as a software engineer

One of the most obvious ways to become a better programmer is to read code. The other ways are to actually code and read the documentation. I was lucky enough to be a full-stack developer of product teams dealing with huge projects early In my career. My first task, when in a new team is usually to understand the project architecture and then read the existing code base. It gave me a sense of the rigor of the project and the coding style.

 It has also enabled me to have a nose for code smells. As you gain experience you can read the source code and easily grasp the problems occurring frequently with it.

 The important lessons I learnt during my journey were:

  1. Test coverage: If you do not have complete test coverage, it becomes difficult to identify what breaks on changing code either written by yourself or by others.
  2. Common standards and tools: Developers on a single project have to adhere to common specifications like using spaces vs tabs, naming conventions, when to use switch vs if/else etc. It's necessary that all developers use the same tools and stylistic preferences while coding for consistency. You wouldn't want to scroll through commits containing stylistic changes like addition and removal of blank lines and spaces when comparing code changes.
  3. Usage of design patterns: Some usages are obvious from the outset. Some are realized after writing bloated code. I learnt more about using design patterns while reviewing my own written code.
  4. Interfaces: Use them liberally. Never accept a concrete object as a parameter, build on abstractions.
  5. Reduce dependencies: Use minimum dependencies as you can.
  6. Reduce bloat: Simplify, Simplify, Simplify! The more unused code that builds up, the more difficult it is to understand and debug issues. Do not try to over-generalize solutions. It only leads to bloat and confusion in the minds of the developers.
  7. Naming: Use relevant names that goes for both methods and variables. It makes reading easier. As someone said, naming is the biggest challenge in programming
  8. Re-read: Read and re-read what you have written. The first draft is always the worst one.
  9. Write for clarity first and cleverness later: Do not try to be clever to skip a few additional lines. Remember you may have to edit later what you have written now.
  10. Test all outside data in a class/method: Test all inputs to a method and class.
  11. Log all exceptions. Do not catch what you can't handle: It is better not to catch all exceptions. When writing exception handling code be as specific as possible so as to make the lives of the ones coming after you easier.
  12. Commit messages: Commit Messages should contain information on why the change was made rather than just the changes
  13. Using code quality tools: Controlling Code quality is one of the ways of achieving all of the points mentioned above.

If any of these resonate with you or you wish to add to it, please leave a comment. I would love to hear from you!!


To view or add a comment, sign in

More articles by ☘️Ashutosh Singh

  • Service workers

    Service workers are an important part of building PWAs. A service worker is a script that runs in the background…

  • Web Services and Microservices

    What are Web Services? Web services provide a way of exposing functionality of the application via API over HTTP. It…

  • Introduction to testing web apps using Lighthouse

    Introduction: I already have an article up on how I have improved page load times of projects shortening it by 100% -…

  • Getting meta about Meta tags

    Meta tags provide metadata about the HTML document. It is generally used to instruct browsers and other services like…

  • Fixing bugs in your .NET web project by ELMAH

    Error logging is a crucial part of applications. I have significant experience looking at error logs and debugging…

  • What is Do Not Track (DNT)?

    The DNT header is a HTTP header field which requests that websites do not enable cross-site tracking for an individual…

  • Cookies - To be or not to be

    What are cookies? Cookies are text files stored on the user's machine and are typically transferred between client and…

  • Speeding your Pages Up

    I personally believe in the adage make it correct, make it concise, make it readable and then make it quick in that…

  • Tools of the trade

    Growing up I was always fascinated by tools, especially how easy they made certain tasks easy to perform. Apart from…

Others also viewed

Explore content categories