How do we really feel about women leaders?

The Reykjavik Index for Leadership measures how people feel about women in leadership. It measures the perceived legitimacy of male and female leadership in politics and across twenty professions, as…

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:

Welcome to the Biology Graduate Research Blog!

Stay tuned for current updates from our graduates in the Biology Department at CSUSB. This blog is associated with the Professional Writing in Biology class as part of the graduate program…

5 Unique Holiday Sweater Ideas

Holiday sweaters are a great way to share the holiday spirit, wow your friends, and (shockingly) stay warm! But if you’re any sort of interesting person, a normal grandma-knit sweater just won’t cut…

What to do about the Garbage Collector when moving from Java 8 to Java 11

Our most common current Java upgrade is from Java 8 to Java 11 (unsurprisingly as these are the two current long term support versions), and a FAQ we have from our teams asks: what should they do…