Skipping the Maths: How A Lazy Developer Has Probably Built That Thing You Need Before You
Skipping the Maths: How A Lazy Developer Has Probably Built That Thing You Need Before You
It's a classic rookie mistake. A noob error. I've done it a lot. You're problem solving.
You come across a problem and you think: what I need here is maths.
I need to write out all of the equations and subtract the thing from something.
I need to assign everything to a variable and write out all of the maths.
I need to do all the things manually.
INCORRECT.
A lazy software developer has probably solved it before you
Software developers are inherently lazy.
This is what makes us good at our jobs.
If there is a common problem that you are trying to solve, a software developer before you has probably written some reusable code (a package? a library? a method?) that you can reuse.
Examples of this would be:
- Calculating the difference between two datetime objects versus using a timedelta - next blog post will be on this I hope.
- Using the Levenshtein library to compare two strings - versus writing a function that compares the two strings manually.
- Regex - I WOULD BE LYING IF I SAID I KNEW THIS VERY WELL
- ARRRGH I NEED TO LEARN THIS PROPERLY PLEASE ARRRRGH.
There are often methods and functions that just solve these things for you.
The more you problem solve, the more you will learn them.
Problem Solving
The more you problem solve, the more it is normal to get better at knowing these things.
A part of problem solving is looking up these kinds of things and finding the solution.
Don't Reinvent The Wheel...
... if you don't need to.
Choose your battles wisely in software engineering.
If you need to do the maths yourself then you can do it... but if you don't need to... then... don't. Working on problem solving both in a work context and through learning tools like CodeWars is surely the best way to learn.
Comments
Post a Comment