Being on the software development side of LeanCor, it is important to have structure to your code. Something that we as developers do to maintain our code is practice DRY. DRY simply means "Don’t Repeat Yourself." Rushing is a common problem that can occur when balancing emergencies and standard projects. It’s much easier to copy and paste a function, manipulate it, and push it out. By doing this however, you create the opportunity for errors in the code later when you have to manipulate both of the functions. It’s very possible that a developer won’t know of or will miss one of the functions that need altered now, thus creating emergencies.
Refactor Your Code
How does one overcome this problem? Find commonalities in the code, and re-factor it. Take the functions that are similar and if possible, break them into several smaller functions. Maybe make a call to one main function that calls all those several smaller ones from multiple locations. This allows you the ability to keep your code dealing with a specific functionality all in one area.
While coding if you find yourself asking, “What is the next step to accomplish the goal?” You should probably break that next step out into it’s own function. What this allows is the code to be very modularized and any errors that occur are much easier to find and correct.
Use Long Function and Variable Names
Another major step in making life as a coder easier is long function names and variable names. This allows commenting your code without actually commenting your code. Why is this good? It reduces the file size, everything you need to reference is right in front of you, and most importantly the programmers don’t need to maintain the documentation - the code is doing that itself!
Clean Up Old Issues
What if you find poor coding practices from others around the area you're coding? We have a saying in our IT department: “Leave the campground cleaner than you found it.” Go ahead and fix it. It solves future headaches and cleans up the code for when others have to “camp” there.
Not having always been a believer in some of these methodologies, I’ve challenged myself both in practice at home and at work. I’ve found myself not having nearly as many problems in logic or frustrations.
So let’s recap. Structure is vital to having functioning code. Practicing DRY will prevent future issues from occurring because you don’t have to manipulate multiple locations. Refactoring your code allows the programmer to travel easier through the code and find errors quicker as functions are much smaller. Think about each step and its own individual function. Create long function and variables names. Who needs comments now?! If you see something that appears to be rushed or was poorly coded, fix it now.
Written by Roman DeNu, Software Development Specialist at LeanCor
- Key paradoxes in agile (softwaretrading.co.uk)
- .NET Framework Gives Splendid Set of Object Class Libraries Incorporated into its CLR (jamescatalano.typepad.com)
- Maslow's Hierarchy of Needs of Software Development (hanselman.com)
- Massive-scale Online Software Development (whathecode.wordpress.com)
Posted by LeanCor Supply Chain Group
LeanCor Supply Chain Group is a trusted supply chain partner that specializes in lean principles to deliver operational improvement. LeanCor’s three integrated divisions – LeanCor Training and Education, LeanCor Consulting, and LeanCor Logistics – help organizations eliminate waste, drive down costs, and build a culture of continuous improvement.Facebook LinkedIn Twitter Google+