avatarNicklas Millard

Summary

Nicklas Millard shares 32 pieces of opinionated advice and lessons learned from his professional experience in software development, emphasizing practicality, code quality, and continuous learning.

Abstract

Nicklas Millard, a software development engineer in a leading bank, presents a compilation of software development advice based on his years of experience with various clients, including those with high safety and reliability requirements. His advice ranges from the practicality of writing "trash code" when necessary to the importance of defensive coding and avoiding hardcoded application settings. Millard advocates for depth of knowledge over breadth, the use of design patterns, and the refinement of code through refactoring without introducing new functionality. He also stresses the significance of writing testable code, understanding business problems, and viewing software development as a craft. The article includes links to his other works on Medium, covering topics such as collection features in C# and replacing If-Else statements, and invites readers to connect with him on LinkedIn and YouTube.

Opinions

  • It's acceptable to write less optimal code for non-critical parts of an application.
  • Proficiency in a few languages is preferable to superficial knowledge of many.
  • Prototyping is valuable, but should not inadvertently become production code.
  • Defensive coding is crucial to prevent application failures due to unexpected inputs.
  • Application settings should be configurable rather than hardcoded.
  • Code should be written to facilitate testing, avoiding tight coupling with external systems.
  • Exceptions should be used judiciously for truly exceptional situations.
  • Over-reliance on If-Else statements can indicate poor design, with alternatives like design patterns often providing better solutions.
  • Refactoring should focus on improving existing code without adding new features.
  • Learning and applying design patterns is essential for effective software development.
  • Criticizing others' code is counterproductive and does not demonstrate seniority.
  • Interfaces should be introduced only when necessary, not by default.
  • Access modifiers should be used carefully to encapsulate state and behavior appropriately.
  • Simple problems warrant simple solutions, avoiding unnecessary complexity.
  • Refactoring should be accompanied by tests to ensure that changes do not introduce regressions.
  • Established libraries and packages should be leveraged instead of reinventing the wheel.
  • Complex problems may require complex solutions, but simplicity should always be the goal when possible.
  • Developers should focus on learning through practice rather than passively watching tutorials.
  • Recognizing that most developers sometimes write less-than-ideal code can foster a more understanding community.
  • Staying informed through conference talks and thought leadership can provide inspiration and insights.
  • Seeking advice from experienced developers can help overcome plateaus in skill development.
  • Using GUIDs/UUIDs for entity IDs can simplify development but comes with tradeoffs that should be understood.
  • Adhering to SOLID principles leads to better code quality and maintainability.
  • Enums should be preferred over strings when dealing with a limited set of options.
  • Modular code organization helps maintain clarity and manageability in software projects.
  • The primary focus should always be on solving the business problem at hand.
  • Software development is a craft that requires continuous skill refinement and a commitment to writing purposeful and beautiful code.

PRACTICAL SOFTWARE DEVELOPMENT ADVICE

32 Opinionated Advice and Lessons Learned in Software Development

Useful advice for any developer

For the past few years, I’ve been developing software professionally for both small and large clients. Some of the software has been used in very strict environments where safety and reliability were of highest concern.

I’ve compiled a list of useful advice based on my experience thru the years. Without further ado, here’s my opinionated list of advice, lessons learned, and best practices.

  1. It’s okay to write trash code sometimes. Not all parts of your application are born equal.
  2. You don’t need to learn a new language to learn new things. The same thing can most often be done in many languages. Prefer depth over breadth.
  3. Write throw-away-code to test different approaches. Just don’t let the throw-away-code become production code.
  4. Code defensively. Do you remember the method parameter that you thought would never be null? Yeah, it turned out to be null anyway and your application exploded. Just write those guard clauses and get it over with.
  5. Never. Ever. Hardcode application settings. Write configurable components and pass environment variables to them. It’s easier to restart an application than to recompile and redeploy.
  6. Write code that’s easy to test. That means stop “newing” up a database object inside your command handler, service class, etc. Instead, turn it into a dependency.
  7. Only throw exceptions when exceptional things happen.
  8. Learn suitable substitutions for If-Else. If-Else is often overused and an early sign of poor design. Lots of design patterns remove the need for If-Else statements.
  9. Not every IF needs an ELSE IF or ELSE. IFs by themselves are fine and often encouraged.
  10. Refactoring means refactoring. Do not try to add new functionality while you’re on a refactor crusade. It won’t end well.
  11. When you identify trash code, take some time to clean it up and make it better — whatever “better” means in the specific context.
  12. If you’re not learning design patterns, you’ll have a difficult time. They’re everywhere and recognizing them makes your life easier.
  13. Applying design patterns will most likely improve your code.
  14. Bashing other people’s code is not going to make you a better programmer and is not a display of seniority. Primarily beginners bash other developers' code because they have a difficult time understanding even simple concepts.
  15. Don’t create an interface before you’re going to need one. It’s completely fine to just start with concrete classes.
  16. Are you sure the field/property/method needs to be public? No, that’s what I thought. Make it private or internal.
  17. Super simple classes — like one method simple — are the way to go.
  18. Write simple code for simple problems.
  19. Make sure to have tests in place for every part you’re refactoring. Otherwise, you’ll not know what you’ve broken.
  20. No — the code you just jotted down is not better than the NPM/NuGet/pip package with 11 million downloads. Download the f*kn package and move on.
  21. Don’t be afraid to come up with complex solutions for complex problems. Just don’t go the other way.
  22. It’s fine to pick up a few languages. Try to go for one back-end, front-end, and database language. You’ll have a greater appreciation for what other members of your team are dealing with then.
  23. Stop watching them d*mn tutorials. Do your own thinking. Sure, the occasional tutorial is fine when you’re stuck on some problem or need to learn something fast. Just exit the tutorial limbo.
  24. Most other developers write trash code as well. Don’t lose your sh*t over it. They surely did it for a reason.
  25. Watch developer conference talks and follow thought leaders. Lots of great experience to draw from and easy way to gain inspiration.
  26. We all hit a plateau in our journey to become better developers. Seek advice from accomplished developers. Don’t be afraid to send a random developer a message.
  27. Using GUIDs/UUIDs as entity IDs are often making things easier to work with. But be aware of the tradeoffs you’re making.
  28. Adhere to SOLID principles. They’re easy to understand and improve your code quality. Statements like “Open/Closed principle is not important” will come back to bite you.
  29. Use enums over strings as arguments if there’s a finite number of options.
  30. Arrange your code in modules (projects in .NET terms). Don’t just place everything in one module. It quickly gets out of hand.
  31. The business problem you’re solving or business application you’re developing is the most important thing to keep in mind. To a business, your code is just a means to an end.
  32. View software development as a craft. Write purposeful and beautiful code. Actively seek to refine your skills.

I’m sure there’ll be developers disagreeing heavily with some of my advice. But that’s the nature of opinionated content. You’ll always find differing opinions, approaches, and mindsets.

It’s healthy to take in lots of perspectives. Stay critical and incorporate what you find makes sense to you.

Nicklas Millard is a software development engineer in one of the fastest-growing banks, building mission-critical financial services infrastructure.

Previously, he was a Big4 Senior Tech Consultant developing software for commercial clients and government institutions.

New YouTube Channel (@Nicklas Millard)

Connect on LinkedIn

Technology
Programming
Software Development
Software Engineering
Web Development
Recommended from ReadMedium