We recently held our first Women In Software Engineering Lunch & Learn event! Our Lunch & Learn series is a virtual workshop-style meetup providing you with the opportunity to learn about both upcoming and existing technologies from like-minded professionals in tech.
For our first Lunch & Learn we were delighted to be joined by Software Engineer at Lilium, Sara Figueiredo, who discussed the fundamentals of clean code.
As part of the event Sara spoke about what the term ‘clean code’ means, mentioned some of the benefits of clean code and offered advice on how to write code as if you were writing a book!
“Coding shouldn’t be only about writing functional code. It is about clear expression and collaboration.
In a fast-changing world, we should learn how to work as a team, for quicker adaptation and greater value. We should understand the principles of making our code readable to make our lives easier.”
The Fundamentals of Clean Code
To start the event Sara first emphasised the gravity of bad code. Bad code can create frustration, not just from the client but also within the tech team as it becomes increasingly difficult to maintain ‘messy’ code, making it harder to bring in new features to the application. Sara highlights that in most cases, when asking developers why a company has gone out of business, this tends to be their reason. Bad code can bring an organisation down.
Why does bad code happen? Sara goes on to suggest a few of the causes of bad code; not having enough time to clean up the code due to client deadlines, developers getting bored of the project and wanting to move on to coding a different module and the age-old excuse ‘I’ll do it later’. Making an important point about bad code, Sara emphasises that everybody is to blame for bad code – the developer, your employer. and your client.
Sara then mentions two principles of clean code:
- The Boy Scout Rule – ‘Leave the campground cleaner than you found it.
- Comments – think of comments as a failure to express yourself via your code, take the time to stop and analyse your code before adding a comment.
During her explanation of how to write clean code, Sara notes the importance of meaningful names, catch blocks and classes.
The final topic that Sara discusses as part of her presentation is unit testing and some rules of thumb. Testing your application is essential. The higher your test coverage the less you will fear coding.
- Readability – easy for anyone who comes across your code, not just you!
- Simplicity – in name and structure.
- Density – try to say a lot with as few as expressions as possible.
- Tests should be fast, independent, repeatable, self-validating and timely.
We’d like to thank Sara for speaking at the event and sharing some fantastic insights into clean code. We’d also like to thank all the attendees for helping to make it such a successful and interactive event.
Don’t forget to join us at our next event, check out our Eventbrite page for more information!
If you are interested in speaking or attending one of our Women In Software Engineering events, get in touch today!