Importance of Coding Standards

Programming Help for Beginners

We write programs to instruct computers. When programming using a high level programming language like C++ or Java, we are using a syntax that is somewhat closer to human languages. However, we use these programs as inputs to either compilers or interpreters to be converted to computer understandable binary format. For this reason, as far as the program code adheres to the syntax of the used programming languages, the compilers and interpreters never bother about the layout or visual formatting of the program code. However, as human programmers, we ourselves need to bother about the aesthetics of the program code.

What is a Coding Standard?

A coding standard is a set of guidelines, rules and regulations on how to write code. Usually a coding standard includes guide lines on how to name variables, how to indent the code, how to place parenthesis and keywords etc. The idea is to be consistent in programming so that, in case of multiple people working on the same code, it becomes easier for one to understand what others have done. Even for individual programmers, and especially for beginners, it becomes very important to adhere to a standard when writing the code. The idea is, when we look at our own code after some time, if we have followed a coding standard, it takes less time to understand or remember what we meant when we wrote some piece of code.

Coding Standards Make a Difference

Look at the following example:

int volume(int i, int j, int k) {
int vol;
vol = i * j * k;
return vol;
}

Looking at this code at a glance, it takes some time for one to understand that this function calculates the volume. However if we adhere to a naming convention for variables and method names, we could make the code more readable.

Here are few sample conventions:

  • use meaningful variable names
  • use verbs in method names
  • use nouns for variables
  • use 4 spaces to indent
  • int calculateVolume(int height, int width, int length) {
    int volume = 0;
    volume = height * width * length;
    return volume;
    }

    It takes more time to type this code, however this saves far more time. This code is far more readable than its original version. With a little bit of effort, we could make the code much more understandable.

    The Benefits

    It is not only the readability that we get through a coding standard in programming. Writing more secure code could also be encouraged through a coding convention. As an example, in C++ we could say that each pointer variable must be initialized to NULL.

    char* myName = NULL;

    This ensures that we would not corrupt memory while using this pointer variable.

    Code readability is just one of the aspects of maintainability. Coding standards help a great deal with program maintainability, our ability to change programs with ease. Consistency imposed through a coding standard is a key factor to achieve success in maintaining prorams.

    Defining Your Own Coding Standard

    A programmer can define his or her own coding convention and adhere to that in writing programms. However there are many coding conventions available on the Internet. Those who program in Java should have a look into http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html - Code Conventions for the Java Programming Language by Sun.

    For C++ coding standards, I would recommend that you have a look into http://www.bbc.co.uk/guidelines/webdev/AppB.Cpp_Coding_Standards.htm - C++ Coding Standards from BBC.

    http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-14.html - C++ Programming HOWTO has some C++ Coding Conventions and also a bunch of links that lead to several coding standards that you can pick from.

    John Dirk
    Programming Consultant
    http://www.programminghelp4u.com/
    Programming ( Assignment / Project ) Help

    shuttle to Midway Beardstown .. Lockport Chicago limo O’Hare
    In The News:

    The FBI has issued a warning that scammers are impersonating doctors, police and banks using spoofed numbers as "smishing" texts surge nationwide.
    Communities with unreliable internet service stand to gain after Amazon's Project Kuiper launched its first full batch of satellites into orbit April 28.
    Tech expert Kurt “CyberGuy" Knutsson says unsubscribing from spam might actually backfire. Learn when to avoid it and stop junk effectively.
    Tech expert Kurt “CyberGuy" Knutsson talks about how the first nonstop beating heart transplant, called zero ischemic time, at Taiwan hospital changes surgery.
    Kurt “CyberGuy" Knutsson: FBI warns of "time-traveling" hackers.
    Kurt “CyberGuy" Knutsson talks about a soft, vine-like robot called SPROUT that aids safe survivor rescues in collapsed buildings.
    Health insurance giant Blue Shield of California confirmed it had been sharing private health data of 4.7 million users with Google for three years without even realizing it.
    Delta and JetZero’s blended wing body aircraft marks a meaningful step toward a cleaner, quieter and more efficient future for air travel.
    Recent reports show many common passwords can be cracked in literally seconds. Kurt the CyberGuy explains how to strengthen your passwords.
    Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
    Iron, a robot that stands 5 feet, 8 inches tall and weighs 154 pounds, combines advanced artificial intelligence with human-like movement and exceptional vision.
    Hertz, the rental car giant, recently confirmed that customer information was exposed through a cyberattack on one of its software vendors.
    There are a number of features with AirPods you may or may not know about to take your listening experience to the next level. Kurt the CyberGuy explains.
    These 35 Chrome extensions have privacy and security concerns. Tech expert Kurt “CyberGuy" Knutsson says to delete them now.
    Tech expert Kurt “CyberGuy" Knutsson says 329,000 mph fusion rocket promises to be fast, disruptive and enable deep-space missions.
    Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
    Tech expert Kurt “CyberGuy" Knutsson says a new autonomous AI is a game changer that also raises privacy risks. Is your data safe?
    Tech expert Kurt “CyberGuy" Knutsson says robots and drones are revolutionizing fruit farming with faster picking and smarter handling.
    Landmark Admin revises May 2024 cyberattack scope to show twice as many people were affected. Kurt “CyberGuy" Knutsson gives tips to help stay safe from an insurance data breach.
    Tech expert Kurt “CyberGuy" Knutsson talks about how Yamaha’s hydrogen outboard motor could revolutionize boating with zero emissions.
    Tech expert Kurt “CyberGuy" Knutsson reveals how to memorialize or remove a deceased loved one’s Facebook account and protect their digital legacy from misuse or scams.
    Tech expert Kurt “CyberGuy" Knutsson says an Apple Watch saved psychiatrist Amanda Faulkner by detecting deadly leukemia early.
    Scammers and fraudsters are increasingly targeting the most vulnerable, especially nursing homes and the personal data of their residents. Kurt the CyberGuy has safety tips.
    Infected USB flash drives can spread malware among multiple organizations in ways that can easily bypass traditional security systems.
    With a fully automated warehouse system and AI-powered robots, Ocado's Hive picks, packs and delivers grocery store orders in just a few minutes.

    Open Source Concepts: Dual Licensing Explained

    We were recently faced with a decision: either to let... Read More

    Did You Ever Want to Completely Erase Everything on Your Computer?

    Did you ever want to erase everything on your computer?... Read More

    Microsoft Great Plains Upgrade ? Things to Consider and FAQ

    If you have Microsoft Great Plains and support it for... Read More

    Microsoft Great Plains ? Licensing & Product Versions

    Current Microsoft Business Solutions Great Plains has more that 10... Read More

    Spyware Statistics -- Whats New in May 2005?

    Although statistics often is blamed for various deadly sins --... Read More

    Looking for an Alternative to Microsoft Office? You Should Be!

    Now is the time to look at an alternative to... Read More

    Free PDF Publishing Software

    In a previous article, I wrote about OpenOffice... Read More

    Perfectly New Database Query Tool - Foxy SQL Pro Released

    Are you a database professional? Do you work with a... Read More

    Create ASP in Minutes

    DBxtra goes ASPGetting to the information hidden within corporate databases... Read More

    Spyware - The Internet Devil Of Our Times!

    Spyware and Adware infest over 90 percent of computers in... Read More

    SQL: Querying Microsoft Great Plains ? Overview for Database Administrator/Developer

    Looks like Microsoft Great Plains becomes more... Read More

    How to Make Attractive and Effective PowerPoint Presentations

    Microsoft PowerPoint has dramatically changed the way in which academic... Read More

    How To Avoid Getting Hooked By Pfishing

    "Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More

    OS 101: Suggestions for Choosing an Operating System

    An operating system (abbreviated OS) is essentially the path through... Read More

    Microsoft Blues

    With the advent of 'Service Pack 2' for Windows XP... Read More

    Windows Screensavers Explained

    In this article you will find some background information about... Read More

    Microsoft Great Plains: Customization Upgrade & Recovery ? Visual Studio VB 6.0

    Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More

    Microsoft CRM Development

    Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More

    Microsoft CRM Customization: Integration with Third Party SQL Application/Database

    Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More

    Basic Steps To Optimize Your Internet Security

    After seeing many people complain about their weak Internet security... Read More

    Lotus Notes Domino and Web: Application Development ? Tips for Programmers

    Beginning with Domino version R4 it has integration with the... Read More

    Best Spyware Removers

    Finding the best spyware removers to detect and remove spyware... Read More

    Microsoft CRM Modification ? Overview for IT Specialist

    Microsoft CRM is now on the scene and it is... Read More

    Does Microsoft have any real competition?

    Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More

    Microsoft Great Plains Implementation: Collection Management ? Overview For Consultant

    Microsoft Business Solutions Great Plains is very good fit for... Read More

    Green Bay Hummer H2 SUV rentals ..