This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by anes
Introduction
A debate as old as coding itself:
"Math is rudimentary for coding!"
"No, it's not, you just enjoy it and try to force it on us!"
While yes, I do enjoy math, I also recognised its importance in coding, or rather its importance in understanding coding. A pattern you may have recognised when reading through my articles is, that they are all about writing code which you would normally not even think about, but rather just use a framework or library for.
Exactly that shift from coding to using frameworks that do most work for you, is something we are experiencing in the world of software development and it's hurting junior devs. While yes, production code should be written in frameworks and libraries to improve its sustainability and often also its security, a lot of new developers have never learned what exactly is being done behind all that "framework magic" as I like to call it.
Examples
I can't just throw this out there without situations and anecdotes to back it up too, so that's what this part is about.
Drawing a line from A to B
The first time I recognised this problem is when I had to draw a line between two points that could be placed completely randomly. The project (you can look at here, instructions and location are in the readme) was for a course mixing math and IT. My teacher gave me the task to "write a program that makes it able for me to draw dots, connect them with lines of a weight I choose and then the code searches for the minimal spanning tree. If I click the lines I should be able to change their weight".
Now what is step one, when implementing that? Making it able for the user to draw dots and connect the lines. And how do you calculate the line between those two dots? Give it a thought before you read the next part.
Trigonometry and Pythagorean's Theorem could be a very useful tool. If you had that thought, it was (obviously) because you know the math to approach problems like these exist. If the problem was a different one maybe you don't know the math and because it is such a specific task you also won't find any good sources to it.
How did I solve that problem? Every time a user creates a line between two dots, my code plots a triangle, where the created line is the hypothenuse and draws it. Here is the code, if you are interested.
Making AI with TensorFlow
The example above perfectly demonstrated how a lacking understanding of math can be harmful, but what's the case with frameworks? They have a similar issue. When I started doing coding and research on it outside of school, one of my first goals became to write some code that included the use of AI, so I went to learn AI. I started off with a freeCodeCamp seven hours course, hoping I could make AI when I'm done following that tutorial. I was completely wrong. I just followed the steps, did whatever they did and made some very simple AI. When I then tried using that knowledge on my own case, I quickly realised that I have no idea how to do that. And not to mention, every time I had a problem the guy from the tutorial didn't have I would search for hours to solve it. Simply put: I wrote words, neither understanding the sentences they made nor the letters that were used.
The truth was: I was lacking an understanding of the math behind Artificial Intelligence and wanted to directly start coding.
To fix this I started off watching tutorials on the math, learned basic calculus and wrote a copy of the Perceptron in JavaScript. The first article I wrote was about that.
How (not) to store passwords
My last and probably biggest example of this is my own article: How (not) to store passwords. The article talks about storing passwords the wrong and right way. While I have never used that knowledge in the real world, that knowledge gives me the power to wield tools like BCrypt and Devise to do those tasks. And then when I do need something more than what a framework has to offer, I could even fork it and write the function I want myself, because I know how to do it on this level.
Knowing when to stop
I know, I was so persuasive with my last chapter, that you already got together raw ores to build your own PC, but that's not what this is about. While I think it is important to take a step back and also understand what is happening in the background it's even more important to know when that step back was big enough, and when to even take back a step. It is a great way to learn coding and build an understanding for it, but it trades off production speed. Writing a neural network where you create all neurons, their weights and all the needed functions will cost you a lot of time and probably also code efficiency, so you should probably let frameworks do it for you when the project is of commercial and not education purpose. And even if it is educational, the step back should be educative and not just a waste of time. Obviously you could write an API-backend in frameworkless C, but the focus lays on Artificial Intelligence and the API is just a way for you to communicate with the code you wrote.
And what do you want me to do?
Instead of just jumping right into "Creating a chatroom with ReactJS and Firebase", why don't you try creating your own backend with a language where you have to write a lot by yourself, like SpringBoot and do the user auth without a library, or maybe even go without an ORM and write the SQL yourself. Yes, it will be slower and yes the security will be pretty bad, but when you write the next application that is based on libraries, you will have an easier time debugging and adding features on top of your framework.
Conclusion
I believe we should stop just frantically using a framework and a library everywhere we can, but maybe just try to do something ourselves and earn knowledge which we will use our entire life in the process. If you are interested in the magic behind frameworks you should definitely read through my other articles.
Thanks for reading and happy hacking!
This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by anes
anes | Sciencx (2022-10-11T20:36:35+00:00) Frameworks hurt junior devs (and why math is important). Retrieved from https://www.scien.cx/2022/10/11/frameworks-hurt-junior-devs-and-why-math-is-important/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.