>When I was a younger man, I owned a box. And in this box, were all the clothes I ever owned.
Even after being washed, they went back into the same box. Last In, First Out. I did not separate them.
My philosophy: just put whatever on. And for most of the time, this one box system worked out perfectly. I could pick up some clothes and put any of them on.
During this time, I wrote CSS code in similar fashion. I was writing long, thousands of lines of code, all linearly.
Whatever I needed that HTML to do, I just tacked it on at the end of the CSS file. New additions were added day in and day out. If I was editing someone else’s code, I searched for line and edited it there, otherwise I’d tack it too at the end of the file. This too, worked out perfectly.
At the end of the day, no one cared how the code was written, just that it was working.
And no one really know how I kept my clothes organized, and why would they? It is none of their business.
Then one day, I needed to get some dress clothes. Another day I needed a pair of matching colored socks, and another day, I needed some boxers.
On these days, I would dig and dig my way through the box. I also added more clothes to my collection as I grew. It was beginning to take forever to find anything, and I can’t even take a proper inventory of anything. This happened on the coding front as well. I was writing more and more code as time progress. Trying to come back to an issue was tough after a few weeks. If I needed to change something, let’s say the header of the site. It was probably in twenty different places in the file. Some of the code was at the top, some at the middle, and finally some at the end. Each section also had conflicting code that would overwrite itself.It was becoming too complicated to make edits to this file. The code was becoming very bloated, and I never got rid of any code.
It was becoming too complicated to make edits to this file. The code was becoming very bloated, and I never got rid of any code.
I did not delete anything because the code was too fragile to try and delete anything. I was afraid it interfered with something else. Things were a mess, and I’ll admit, I was a mess. Maintaining this one box system was becoming very hard as things became more complex. Something needed to change.
And it did.
I become a proper adult. I did some thinking and I bought myself a dresser and some hangers. Things were looking better already.
Everything had its place, and everything was properly placed. Finding things and getting rid of things were easier than ever.
As with life, the coding was changing as well. I became a proper grown up developer, doing proper grown up things. I took to modular coding, putting aspects of CSS code into their own separate files and folders. Organizing them by similar modules and functions. Now things are more manageable.
Still from time to time, a sock will make its way to the shirts drawer. But I’ll see it and put it in its proper place, eventually.