Paul will talk about the challenges of inheriting someone else's code. Paul will discuss 5 tips: Use an IDE, Variable Usage, Jump To Implementation and Declaration, Global Search, and Inspection.
I've spent the past few weeks updating software. I was not the primary developer, mostly I was working with other people's code. I ran into several challenges, here are some tips for when you are in this situation:
Use an IDE - My project is Python, so I chose to use PyCharm. I am a hardcore Vim user, however, I use Vim emulation and it works good enough. There are several advantages to using an IDE vs. a command line text editor
Variable Usage - The editor will highlight variables that are unused and those that are undefined. Handy for making updates to code you are not familiar with.
Jump To Implementation and Declaration - This is super handy as you are likely not familiar with the application flow or the code base. You can right click on anything and follow it to the declaration or where it is being used.
Global Search - I use this all the time to find out where functions or object references are being used. Usually to make sure I am not breaking anything and to trace back the flow of execution. You can double click on a result and it takes you to it.
Inspection - There are many plugins for this, I use the built-in one. This tells me all of the errors, warnings, etc... in the code. I use this as the first step to figuring out what negative impact my code changes may have had.
Logging and Exceptions - Spend some time adding additional logging and exceptions, especially around new code that you write. Often times developers will leave out logging or debugging statements once they are comfortable with the code. Go ahead and add some back in, you can always adjust them later if you are concerned about performance. Python exception handling is really neat as well.
Don't Trust Logs or Comments - Logging statements and comments get stale very fast. So many times I've reviewed code, understood what it does, but the log entry or comment says it does something completely different. They cannot be trusted. Also, many developers write either no comments at all or crappy comments. Here's a tip, if you are writing anything, write good descriptive comments. It will help you as the developer, and those that follow. For tips, read Code Complete, great book!
Beware Of Spelling Mistakes - In the code I am working on, there are spelling mistakes. Lots of spelling mistakes. In comments. In code. Across multiple files. Your IDE likely has a spell checker, use it. Don't leave any spelling mistakes in code! If you are making changes, be sure you are spelling it incorrectly or do a search and replace.
Unit Testing - This helped me tremendously to clean-up a ton of code fast. Most languages have unit testing modules (e.g. Python unittest). This allows you to automatically test your code, and more importantly someone else's.
[caption id="attachment_210" align="alignleft" width="120"] Lee Neely - Senior Cyber Analyst , Lawrence Livermore National Laboratory.[/caption]
[caption id="attachment_210" align="alignleft" width="120"] Paul Asadorian - CTO, Security Weekly.[/caption]
Register for our upcoming webcasts with SaltStack, DomainTools, and LogRhythm by going to securityweekly.com/webcasts. If you have missed any of our previously recorded webcasts, you can find our on-demand library at securityweekly.com/ondemand
The CIO of Artesia General Hospital in rural Southeast New Mexico shares the ongoing staffing and resource challenges he faces on a daily basis, and how his IT team tackles risk and workforce training.
The Federal Energy Regulatory Commission is asking input on information collection regulations for how energy companies secure bulk electric systems while its CIO speculated earlier this month that regulated energy utilities will likely need to follow recent government actions around implementing zero trust architectures.