1. https://appdevelopermagazine.com/programming
  2. https://appdevelopermagazine.com/understanding-your-own-code/
1/8/2013 8:08:39 AM
Understanding your own code
\news_old\files\Screen Shot 2013-01-08 at 8.08.14 AM-20130108-080831.png
App Developer Magazine
Understanding your own code


Understanding your own code

Tuesday, January 8, 2013

Richard Harris Richard Harris

Updating your apps in the app stores is something that is inevitable. Devices change, operating systems change, or perhaps just general updates or revisions to your applications are needed. Whatever the case may be it's imminent that you will need to update your app at some point during its lifespan. Let's have a show of hands for everyone that has dug back into their app source code and spent more time deciphering what you did previously, than actually updating what needed to be updated (my hand it raised here!)

Being able to identify what you wrote in your apps source code is critical to the growth of your app. Often times apps are written in an environment that lends itself to over a few thousand lines of code on a single page and sometimes simple comments can help you identify areas of execution and functionality, that can help you in the future to modify, or change the structure as needed.

A good way of thinking about programming is also to remember that the code needs to be readable, even by yourself so that when you open your source code up in your development environment you can quickly summarize where the individual sections, and functions reside.

Here are a few things you can do to help yourself along this process:

Comment as you go along
I know this one is difficult for a lot of developers to do because it seems cumbersome, and unnecessary in that moment but it's very important to comment your code.

Use descriptions
This goes hand-in-hand with the above, commenting your code. But it's important to emphasize that just one
Comments sometimes don't fit the bill. For example you might need to explain in a short paragraph what the function is that you are about to execute in a certain location of your source code.

Use artwork
I have sometimes used ASCII art in my comment sections to help me have a pictorial view of what's happening in my source code. It seems a little silly I know but I can open up some of my source code and within a few seconds now to get to the section that I need to in order to modify it.

Name your files what they are
Here is another one that in particular is easy to skip over when your project has started, but as the app grows and you end up with a few hundred files, it is a breath of fresh air to look at your file structure and be able to identify where each file goes or belongs to in your source code.

Group functions and routines together
It's also a good idea to group things that are similar together within your applications. So if a particular page of source code has two or more functions involved in it, maybe move those functions to certain area of the page and comment them as to what they are and declare that area as the functions area for example.

There are many ways to make your source code readable by your self, and others that might be laying eyes on it. Whatever they are it's important to use them into remember that as you write your programs you might have to one day explain it to yourself -so who better to write those explanations than you! :)

Read more: http://appdevelopermagazine.com

Subscribe to App Developer Magazine

Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.


  • - Exclusive content from leaders in the industry
  • - Q&A articles from industry leaders
  • - Tips and tricks from the most successful developers weekly
  • - Monthly issues, including all 90+ back-issues since 2012
  • - Event discounts and early-bird signups
  • - Gain insight from top achievers in the app store
  • - Learn what tools to use, what SDK's to use, and more

    Subscribe here