10 things I learned in my first year as a software engineer

10 things I learned in my first year as a software engineer

After just over a year in the industry, I wanted to reflect on my experience and the things I learned that helped me on my continuous journey to becoming an effective software engineer. To achieve this I put together a number of guidelines I learned (mostly the hard way) that helped me to ensure I produce solid quality code and continue to develop my skills.

# 1. Code readability over over-optimisations 📖

One of the first things you learn when working in a team is the value of clean and readable code. Remember all those times you returned to a piece of code you wrote a few weeks earlier and had no idea what was going on? That is how another teammate feels every time they read a piece of your code that is not written in a readable and clean way. Sure it might have the best runtime possible, but what good is that when a bug is detected, needs patching and they simply cannot wrap their head around what you were thinking when you wrote the code? Even worse, they try to patch the ugly code by adding even more ugly code, supporting the [broken window theory](https://medium.com/@matryer/broken-windows-theory-why-code-quality-and-simplistic-design-are-non-negotiable-e37f8ce23dab).

A good heuristic in this space is: if the code is complex, add a quick comment indicating the intention, someone (or even yourself) will thank you later and you avoid the risk of broken windows. Better yet, if you can write it such that no comment is needed, do it!

# 2. The importance of small incremental changes over a large self-contained Pull Requests 📈

I know the first thing you are going to say: "but what if I need to quickly revert the changes in production?". Well sure, it may be more difficult to revert multiple smaller PRs, but trust me, the advantages of shipping small incremental changes much outweigh the disadvantages. First of all, shipping smaller changes means that a lot of code already lives in production before the feature is released, even if behind a [feature flag](https://www.atlassian.com/continuous-delivery/principles/feature-flags). This gives you more opportunity to uncover bugs and iron out snags by testing the live changes, and gives more confidence that things will not break when a feature is shipped in one large swoop. It also aids in preventing the anti-pattern of sitting on unshipped code, outlined in [Kanban as inventory overflow](https://en.wikipedia.org/wiki/Kanban).

Secondly, maintaining a long-lived feature branch becomes a nightmare when trying to manage and resolve merge conflicts. My only advice is: avoid this if you can. Make use of feature flags wherever possible to get changes out without affecting customers.

Finally, nobody likes reviewing a large PR. Not only does it require taking more time out of their day to successfully review it, but also means they may focus less on the individual changes and miss or overlook opportunities for improvement or even bugs! As well as this, you lose out on the opportunity to get solid constructive feedback on your work from your peers, which allows you to improve your ability to produce clean and good quality code.

# 3. The value of pair programming and verbalising the approach to solve problems 🦆

After the college experience, we were all scarred by those projects that involved group work. But the reality of Software Engineering is that you work as a team and you should use this fact to help you complete your tasks. If stuck on a problem, it can be hugely beneficial to engage in a pair programming session with a teammate. I find this works best when using IDE extensions such as [VScode Live Share](https://code.visualstudio.com/learn/collaboration/live-share) (along with a voice chat app if working remotely), and chatting about the problem whilst looking at the same lines of code. You'd be surprised, but in many of those sessions, I realised that simply explaining the problem using the [rubber duck principle](https://en.wikipedia.org/wiki/Rubber_duck_debugging) leads to an epiphany, where you suddenly find your solution.

As well as this, pair programming sessions often help to mitigate [information silos](https://en.wikipedia.org/wiki/Information_silo), especially when pairing with a team member that has more expertise on the problem at hand.

Finally, pair programming sessions are excellent practise for coding interviews. If stuck in an interview just, like when pair programming, simply discuss the problem you are having. This can either lead you to a solution, or it may prompt the interviewer to give you pointers in the right direction if you are both on the same page.

# 4. Computer science-y problems in interviews rarely represent tasks expected of the job 🧩

The heading speaks for itself. Rarely if ever in your career, you will be asked to implement a known computer science algorithm from scratch (and if you do, there should be alarm bells ringing in your head!). In 99.9% of cases, you will simply grab a ready-to-use library algorithm to complete the task. While it definitely helps to understand what is going on under the hood, it's not absolutely required.

# 5. Inheritance is not the gospel, composition is the way to go 🧬

From day one of programming modules in college, you are told about the magic of "object-oriented programming" and how "inheritance" leads to bug-free code, but sadly in the industry, it's not all rainbows and ponies.

In theory, the idea of inheritance is idyllic but rarely works in practise and frequently causes more problems than it solves. The tight coupling associated with inheritance results in less flexible code and makes refactoring more difficult later down the line, as whenever a parent class requires some modifications all children are inevitably affected. When considering inheritance, ask yourself the question "Can I use composition instead?". Almost in every case, composition is the way to go and supports flexible patterns such as [dependency injection](https://www.freecodecamp.org/news/a-quick-intro-to-dependency-injection-what-it-is-and-when-to-use-it-7578c84fa88f/).

# 6. Don't be scared of Types 🆎

As a beginner programmer, it is easy to become scared of types, especially when starting with a [duck typed language](https://en.wikipedia.org/wiki/Duck_typing) such as Python. It can feel like an unnecessary obstacle, but secretly it saves you a lot more time in the long run (even if you feel like you waste precious minutes every time you define a method).

In large codebases, types become indispensable. They provide a sanity check for free and cannot compare to the effort and time required on constructing trivial tests ensuring method inputs satisfy expectations.

What I am trying to get across here is, if you can, use [TypeScript](https://www.typescriptlang.org/) instead of JavaScript.

# 7. Write up a quick plan and get feedback early before jumping straight into coding 📑

Though it might sound like the long-winded and dreaded [waterfall](https://en.wikipedia.org/wiki/Waterfall_model) approach of developing software, writing a quick plan is hugely beneficial and allows problems and bugs to be eliminated earlier without having to re-write code.

The emphasis here is on "quick". State the problem, list out possible solutions (bonus points for having more than one), indicate your favourite approach, and share with your team asking for feedback.

Additionally, before committing to the final solution, it can be insightful to make use of [Tracer Bullets](https://builtin.com/software-engineering-perspectives/what-are-tracer-bullets) and [Prototypes](https://en.wikipedia.org/wiki/Software_prototyping). This is of course, once you learn to detach yourself from the guilt of throwing away prototype code.

# 8. Not using Web App frameworks is like coding with your arm tied behind your back 🏗️

Coming out of college with a Computer Science degree, I never had a single module on web app frameworks. This always puzzled me because it seems like a vast majority of this industry depends on using frameworks in their product whether a backend MVC or a frontend user interface library. Lack of coverage on frameworks in university education is definitely disadvantageous and an unnecessary barrier to finding an industry job.

So if you have no exposure to frameworks in your coursework, make sure to do your own homework! If you're curious where to start, my current favourite frameworks are [Ruby on Rails](https://rubyonrails.org/) and [React](https://reactjs.org/) for UI (with [TypeScript](https://www.typescriptlang.org/docs/handbook/react.html) of course!).

# 9. Demystifying the coding interview 🧑🏫

Everyone hates the coding interview, here are a few things I have learned from sitting on the other side of the table (or the other side of the Zoom meeting in this case!):

- The interviewer isn't there to catch you out, they want you to succeed but if you don't try to communicate and collaborate with them when solving the problem, they won't force you to speak up.

- Make sure to treat it like a pair programming session and demonstrate how you approach and think about the problem and solution.

- Ask questions! The more you ask the better! Don't try to proceed, masking the fact you don't understand a detail or two. Get clarification. This demonstrates effective communication and shows you are capable of working with others.

- It's not about finding the most optimised solution in the shortest amount of time, it's about showing that you can write clean code, using appropriate conventions whilst effectively working in a team (the interviewer and yourself!). Most of the time it doesn't even matter if you get the problem finished, if you show yourself to be a solid programmer.

- Check out another blog post written by my colleague on this topic: [https://engineering.tines.com/blog/how-to-pass-our-interview](https://engineering.tines.com/blog/how-to-pass-our-interview)

# 10. Read these books! 📚

Though these concepts and principles are often covered in a Software Engineering module, it's hard to identify with them until you see them in practise once joining the industry. To refresh your memory or learn a couple of new concepts, the following book list is a good starting point:

- [The Pragmatic Programmer](https://www.amazon.co.uk/Pragmatic-Programmer-journey-mastery-Anniversary/dp/0135957052/ref=sr_1_1?adgrpid=62019109647&dchild=1&gclid=CjwKCAjwkvWKBhB4EiwA-GHjFt89A2MA6RdiOkVQaqM8iWUvzw7ca5V_RhcY6t8wfkTBvKqjoL_FqxoCdlwQAvD_BwE&hvadid=291426291118&hvdev=c&hvlocphy=1007850&hvnetw=g&hvqmt=e&hvrand=6468956538882285670&hvtargid=kwd-298735734907&hydadcr=1421_1794050&keywords=pragmatic+programmer&qid=1633518435&qsid=261-8379735-8465916&sr=8-1&sres=0135957052%2CB003GCTQAE%2CB00A4OA6UQ%2C1934356050%2C097451408X%2C1937785319%2C1937785459%2C1934356581%2C1934356557%2C1709538937%2C193435645X%2C193435662X%2C1680502468%2C1937785343%2C168050620X%2C1680501844&srpt=ABIS_BOOK) by David Thomas

- [Mythical Man-Month, The: Essays on Software Engineering](https://www.amazon.co.uk/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959/ref=sr_1_1?dchild=1&keywords=Mythical+man+month&qid=1633518463&qsid=261-8379735-8465916&sr=8-1&sres=0201835959%2C0201006502%2CB0006WPPOI%2CB00NBDHQWS%2C9867889185%2C0265763274%2C0321934113%2C1526640872%2CB09CK9XK5N%2C0135957052%2CB07NSF94PC%2C1800560214%2C0321127420%2C1782620745%2C1789133416%2C0008457468&srpt=ABIS_BOOK) by Frederick Brooks Jr

- [Clean Code: A Handbook of Agile Software Craftsmanship](https://www.amazon.co.uk/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?dchild=1&keywords=clean+code&qid=1633518492&qsid=261-8379735-8465916&sr=8-1&sres=0132350882%2CB00666M59G%2C1800560214%2C0137081073%2C1838982973%2CB0874JF87L%2C1788835832%2C1718502184%2C1789957648%2C1484261615%2CB09BGPF2PK%2CB08ZW3JPDF%2CB097GJ6792%2C0134494164%2C1098100662%2C1593279663&srpt=ABIS_BOOK) by Robert Martin

- [Cracking the Coding Interview](https://www.amazon.co.uk/Cracking-Coding-Interview-6th-Programming/dp/0984782850/ref=sr_1_1?dchild=1&keywords=cracking+the+coding+interview&qid=1633518519&qsid=261-8379735-8465916&sr=8-1&sres=0984782850%2C098478280X%2CB09BGKJ3FL%2C145157827X%2CB081969QH5%2CB09556H1Z1%2CB01MZZBLXA%2CB089J5GZC1%2CB084DFZ58Q%2CB01I02UDD8%2C1793296634%2CB08CMF2CQF%2C1537713949%2C0578973839%2C0984782818%2C1617292230&srpt=ABIS_BOOK) by Gayle Laakmann McDowell