Our Need for AC is on the Rise

According to the International Energy Agency, “ The world faces a ‘cold crunch.’ By 2050, around 2/3 of the world’s households could have an air conditioner. China, India and Indonesia will together…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Cleaning House

There is something psychological about the environments you find yourself in throughout the day. Let’s say you are trying to study. We can probably all agree that a coffee shop and library are very different kinds of environments. Depending on the type of person you are, you might be able to study in a coffee shop but not a library, or maybe it is the opposite, or maybe you can study wherever! Either way, the environment you are in can either enable or prohibit your studying. This week’s post is going to explore messy vs clean code and how it can affect a project.

We have all probably experienced a messy environment at some point in our lives: did anyone say messy room by chance? With a messy room, you can find things as you need them, maybe not efficiently, but you can find them. And hey, it might not be a pretty sight, but it works, for the most part.

Sometimes, the room gets to a point where it no longer works. You can’t find things, its hard to navigate, and oh god, it smells because there’s some hidden mac and cheese hidden somewhere! Cleaning your room will fix pretty much all of these problems and put you back in control of your room. You will know where to find things. It will be easy to walk through your room again and it looks good! Not only that, but you found and disposed of the moldy mac and cheese, so it no longer smells in your room too!

You can think of cleaning your room in two parts: throwing out junk you don’t need and reorganizing. When you throw out junk you don’t need such as receipts, wrappers, or moldy mac and cheese, your room’s appearance improves. When you reorganize things, you are putting things in logical places so that you’ll know where to find them in the future. To clean a room effectively you’ll have to do both these tasks.

Refactoring code can be thought of like cleaning up a messy room. At some point in a program’s lifespan, the code will go out of control to the point where you don’t even know what some things do anymore (even if you put in some really good comments)! Sometimes, even comments can’t help to explain the complexity of certain pieces of code. It’s very likely that someone just wanted to get a feature working and didn’t want to waste time making it efficient, so they just did whatever was necessary to make it functional (*cough* that certainly wasn’t me *end cough*). Now, you’re sitting here in the not-so-far future and wondering what the hell they could have possibly been thinking / trying to accomplish. You now have to clean up the messy code like you would your room.

Is this amount of indentation even legal?
The reorganization is like night and day!

While refactoring (cleaning) code isn’t the most exciting of tasks, it is nonetheless an important one. Without being able to read code you previously wrote, there is no hope for improving it in the future. Too much time will be spent trying to decode your (or somebody else’s) thought process and logic: time that could be better spend being productive and adding new features! And I don’t know about you, messiness is not a pleasant sight. Cleanliness is significantly better looking and it makes sense! Just like after you clean a room, the more effort you put into maintaining this cleanliness, the less likely you’ll have do a cleaning marathon in the future.

Add a comment

Related posts:

Veterans Day 2018

Veterans Day began as “Truce Day” on Nov. 11, 1919, the primary commemoration of the finish of World War I. Congress passed goals in 1926 for a yearly recognition, and Nov. 11 turned into a national…

Bringing Clarity to the Murky Area in My Otherwise Brilliant Economic Paradigm

Some years ago I stumbled upon a way to transform the outcomes for the nation of the existing economic system. The basic idea is to create money as needed to fund a (sufficient) minimum guaranteed…