From The Challenges - Traceroute
Exploring the software engineering lessons we can learn from the solutions I've seen.
Hi this is John with this week’s Coding Challenge.
🙏 Thank you for being one of the 85,347 software developers who have subscribed, I’m honoured to have you as a reader. 🎉
If there is a Coding Challenge you’d like to see, please let me know by replying to this email📧
🙋♂️ Hey I Have A Question For You❓
I’m keen to make the Coding Challenges newsletter more useful for paid subscribers, so I’d love to know what would make it worth you becoming a paid subscriber, or if you’re a paid subscriber already - thank you - what would make it more valuable.
If you’re happy to share, please hit reply and let me know. I’ll read every response.
Many thanks, John.
Now, back to coding…
Welcome To Coding Challenges - From The Challenges!
In this Coding Challenges “from the challenges” newsletter I’m sharing some of the common mistakes I see software engineers make when tackling the Coding Challenges.
I’m sharing both the mistakes people make and some thoughts on how you can you avoid making the same mistakes when taking on the coding challenges or when writing software professionally. Sometimes we have to make mistakes to learn from them, somethings we can learn from other people’s mistakes, then make our own new ones! 😀
Recapping The Traceroute Coding Challenge
In the build your own traceroute coding challenge the goal was to implement a traceroute tool.
Traceroute is a tool to that allows you to trace the route network packets will take from one computer to another over a network.
For example, here’s what using it to look at the route from my laptop to www.google.com
:
% traceroute www.google.com
traceroute to www.google.com (172.217.169.36), 64 hops max, 40 byte packets
1 (192.168.1.1) 6.429 ms 5.058 ms 5.959 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 192.178.46.84 (192.178.46.84) 13.740 ms
142.250.215.124 (142.250.215.124) 11.846 ms
172.253.66.100 (172.253.66.100) 13.209 ms
7 192.178.97.54 (192.178.97.54) 12.272 ms
lhr48s08-in-f4.1e100.net (172.217.169.36) 11.987 ms
172.253.66.87 (172.253.66.87) 13.166 ms
You can see that there are 7 hops from my laptop to www.google.com
. This makes traceroute a useful tool to dig into networks and the routes between different devices on them.
If You Enjoy Coding Challenges Here Are Three Ways You Can Help Support It
Refer a friend or colleague to the newsletter. 🙏
Sign up for a paid subscription - think of it as buying me a coffee ☕️, with the bonus that you also get 20% off any of my courses.
Buy one of my courses that walk you through a Coding Challenge.
Five Common Mistakes Software Engineers Make Solving The Traceroute Coding Challenge
I’ve pulled together this list of common mistakes from the hundreds of submissions I’ve been sent privately and the many shared in the Coding Challenges Shared Solutions GitHub Repo.
Mistake 1 - Writing A Wrapper Around The Actual Traceroute Command
I’ve been sent a few solutions that are just a thin wrapper around the traceroute already installed on the user’s operating system.
There’s a couple of problems with this. Firstly it’s not portable, the traceroute command has different names on different operating systems and may not even be available.
Secondly and more importantly by doing this you mis out on the learning goals of this project. You miss out on learning about the:
OSI model for network layers - most applications we build are dealing with application layer (layer 7) protocols, i.e. HTTP. For this challenge you go down the stack to the network layer (layer 3) and use…
The Internet Control Message Protocol (ICMP).
Setting Time To Live (TTL) for network packets and even learning about the TTL concept, which is new for many software engineers and it’s a concept that appears in many other places, i.e. TTL for data.
Using raw sockets - a lower level that UDP or TCP.
building binary packets - again many programmers have never done this.
Resolving hostnames - introducing you to using DNS in your programming language.
The algorithm used to trace a route through a network.
Mistake 2 - Example.Org
Java, Go and other programming languages encourage us to create globally unique names by using domain names or Github handles.
In many examples and tutorials authors then use example domains such as example.com/.org in their tutorials. Please don’t blindly copy that.
You’ll get the most benefit from the coding challenges if you use them to practice building good habits and if the code you build can represent your best work.
Mistake 3 - Everything In One Main Function
Traceroute might be one of the smaller coding challenges, but I’d still encourage you to structure the code well. Rather than creating one massive main function break out the separate bits of functionality.
I saw a few examples that had functions that were hundreds of lines long. Learning to break up those functions so they’re both readable and testable is a useful skill.
Mistake 4 - No Readme Or Incomplete
This is the most common mistake that I see in the solutions share with me.
A README in your repo doesn’t have to be long, but it should contain the basics of what tech stack is used, what the project does and how to use it.
An interviewer or hiring manager looking at your work / a take home task they’ve sent you will appreciate it if you do this, so try to make a habit of it.
It really helps if your repo makes it clear either what the tech stack is or how to clone, build (if applicable) and run the repo in clear simple steps. Those steps should not include or reference paths that exist only on your local machine.
Mistake 5 - Abusing Source Control
Please don’t put IDE files in a version control system. They’re about you and your tools, not the project.
Please also don’t leave commented out code in what you commit. If you ever want it back you can recover it from the version control history.
Request for Feedback
I’m writing these coding challenges and this new from the challenges series to help you develop your skills as a software engineer based on how I’ve approached my own personal learning and development.
What works for me, might not be the best way for you - so if you have suggestions for how I can make these challenges more useful to you and others, please get in touch and let me know. All feedback greatly appreciated.
You can reach me on Bluesky, LinkedIn or through SubStack
Thanks and happy coding!
John
P.S. If You Enjoy Coding Challenges Here Are Four Ways You Can Help Support It
Refer a friend or colleague to the newsletter. 🙏
Sign up for a paid subscription - think of it as buying me a coffee ☕️ twice a month, with the bonus that you also get 20% off any of my courses.
Buy one of my courses that walk you through a Coding Challenge.
Subscribe to the Coding Challenges YouTube channel!