Best Coding Practices For Software and Website Development

Best Coding Practices For Software and Website Development PHP and ASP

Best coding practices are a set of informal rules that the software development community has learned over time which can help improve the quality of software. Many computer programs remain in use for far longer than the original authors ever envisaged (sometimes 40 years or more), so any rules need to facilitate both initial development and subsequent maintenance and enhancement by people other than the original authors.

In the Ninety-ninety rule, Tim Cargill is credited with this explanation as to why programming projects often run late:

  • “The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.”
  • Any guidance which can address this lack of foresight is worth considering.
  • The size of a project or program has a significant effect on error rates, programmer productivity, and the amount of management needed.

Software quality

There are many attributes associated with good software:

  • Some of these can be mutually contradictory (e.g. very fast versus full error checking), and different customers and participants may have different priorities.
  • Sommerville has identified four generalized attributes which are not concerned with what a program does, but how well the program does it:
    • Maintainability
    • Dependability
    • Efficiency
    • Usability
  • Weinberg has identified four targets which a good program should meet:
    • Does a program meet its specification; “correct output for each possible input”.
    • Is the program produced on schedule (and within budget)?
    • How adaptable is the program to cope with changing requirements?
    • Is the program efficient enough for the environment in which it is used?
  • Hoare has identified seventeen objectives related to software quality, including:
    • Clear definition of purpose.
    • The simplicity of use.
    • Ruggedness (difficult to misuse, kind to errors).
    • Early availability (delivered on time when needed).
    • Reliability.
    • Extensibility in the light of experience.
    • Brevity.
    • Efficiency (fast enough for the purpose to which it is put).
    • Minimum cost to develop.
    • Conformity to any relevant standards.


  • Before coding starts, it is important to ensure that all necessary prerequisites have been completed (or have at least progressed far enough to provide a solid foundation for coding).
  • If the various prerequisites are not satisfied then the software is likely to be unsatisfactory, even if it is completed.
  • From Meek & Heath: “What happens before one gets to the coding stage is often of crucial importance to the success of the project.”
  • The prerequisites outlined below cover such matters as:
    • how is development structured? (life cycle)
    • what is the software meant to do? (requirements)
    • the overall structure of the software system (architecture)
    • more detailed design of individual components (design)
    • choice of programming language(s)
  • For small simple projects involving only one person, it may be feasible to combine architecture with design and adopt a very simple life cycle.


  • A software development methodology is a framework that is used to structure, plan, and control the life cycle of a software product.
  • Common methodologies include a waterfall, prototyping, iterative and incremental development, spiral development, agile software development, rapid application development, and extreme programming.
  • The waterfall model is a sequential development approach; in particular, it assumes that the requirements can be completely defined at the start of a project.
  • However, McConnell quotes three studies which indicate that, on average, requirements change by around 25% during a project.
  • The other methodologies mentioned above all attempt to reduce the impact of such requirement changes, often by some form of step-wise, incremental, or iterative approach.


  • McConnell states: “The first prerequisite you need to fulfill before beginning construction is a clear statement of the problem the system is supposed to solve.”
  • Meek and Heath emphasize that a clear, complete, precise, and unambiguous written specification is the target to aim for.
  • Sommerville distinguishes between less detailed user requirements and more detailed system requirements.
  • He also distinguishes between functional requirements (e.g. update a record) and non-functional requirements (e.g. response time must be less than 1 second).


  • Hoare points out: “there are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies; the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”
  • Software architecture is concerned with deciding what has to be done, and which program component is going to do it (how something is done is left to the detailed design phase, below).
  • This is particularly important when a software system contains more than one program since it effectively defines the interface between these various programs.
  • It should include some consideration of any user interfaces as well, without going into excessive detail.
  • Any non-functional system requirements (response time, reliability, maintainability, etc.) need to be considered at this stage.
  • The software architecture is also of interest to various stakeholders (sponsors, end-users, etc.) since it gives them a chance to check that their requirements can be met.


  • The main purpose of design is to fill in the details which have been glossed over in the architectural design.
  • The intention is that the design should be detailed enough to provide a good guide for actual coding, including details of any particular algorithms to be used.
  • For example, at the architectural level, it may have been noted that some data has to be sorted, while at the design level it is necessary to decide which sorting algorithm is to be used.
  • As a further example, if an object-oriented approach is being used, then the details of the objects must be determined (attributes and methods).

Choice of programming language(s)

  • “No programming language is perfect.
  • There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
  • Understanding the problem and associated programming requirements is necessary for choosing the language best suited for the solution.”

From Meek & Heath:

  • “The essence of the art of choosing a language is to start with the problem, decide what its requirements are, and their relative importance since it will probably be impossible to satisfy them all equally well.
  • The available languages should then be measured against the list of requirements, and the most suitable (or least unsatisfactory) chosen.”
  • It is possible that different programming languages may be appropriate for different aspects of the problem.
  • If the languages or their compilers permit, it may be feasible to mix routines written in different languages within the same program.

Coding standards

This section is also really a prerequisite to coding, as McConnell points out:

  • “Establish programming conventions before you begin programming. It’s nearly impossible to change the code to match them later.”
  • There are different conventions for different programming languages, so it may be counterproductive to apply the same conventions across different languages.
  • The use of coding conventions is particularly important when a project involves more than one programmer (there have been projects with thousands of programmers).
  • It is much easier for a programmer to read code written by someone else if all code follows the same conventions.


  • Due to time restrictions or enthusiastic programmers who want immediate results for their code, commenting of code often takes a back seat.
  • Programmers working as a team have found it better to leave comments behind since coding usually follows cycles or more than one person may work on a particular module.
  • However, some commenting can decrease the cost of knowledge transfer between developers working on the same module.
  • In the early days of computing, one commenting practice was to leave a brief description of the following:
    • Name of the module.
    • Purpose of the Module.
    • Description of the Module (In brief).
    • Original Author
    • Modifications
    • Authors who modified code with a description of why it modified.

Naming conventions

  • Use of proper naming conventions is considered good practice.
  • Sometimes programmers tend to use X1, Y1, etc. as variables and forget to replace them with meaningful ones, causing confusion.
  • In order to prevent this waste of time, it is usually considered the good practice to use descriptive names in the code since we deal with real data.
  • Example: A variable for taking in weight as a parameter for a truck can be named TrkWeight or TruckWeightKilograms, with TruckWeightKilograms being the more preferable one, since it is instantly recognizable.

Keep the code simple

  • The code that a programmer writes should be simple.
  • A complicated logic for achieving a simple thing should be kept to a minimum since the code might be modified by another programmer in the future.
  • The logic one programmer implemented may not make perfect sense to another.
  • So, always keep the code as simple as possible.


  • Program code should never ever contain “hard-coded” (literal) values referring to environmental parameters, such as absolute file paths, file names, usernames, hostnames, IP addresses, URLs, UDP/TCP ports.
  • Otherwise, the application will not run on a host that has a different design than anticipated.
  • A careful programmer can parametrize such variables and configure them for the hosting environment outside of the application proper (for example in property files, on an application server, or even in a database).
  • Remember the mantra of a “single point of a definition” (SPOD).
  • As an extension, resources such as XML files should also contain variables rather than literal values, otherwise, the application will not be portable to another environment without editing the XML files.
  • For example, with J2EE applications running in an application server, such environmental parameters can be defined in the scope of the JVM and the application should get the values from there.

Code development: Code building, Testing & Debugging the code and correcting errors

Code building

  1. A best practice for building code involves daily builds and testing, or better still continuous integration, or even continuous delivery.


  1. Testing is an integral part of software development that needs to be planned.
  2. It is also important that testing is done proactively; meaning that test cases are planned before coding starts, and test cases are developed while the application is being designed and coded.

Debugging the code and correcting errors

  1. Programmers tend to write the complete code and then begin debugging and checking for errors.
  2. Though this approach can save time on smaller projects, bigger and complex ones tend to have too many variables and functions that need attention.
  3. Therefore, it is good to debug every module once you are done and not the entire program.
  4. This saves time in the long run so that one does not end up wasting a lot of time on figuring out what is wrong.
  5. Unit tests for individual modules, and/or functional tests for web services and web applications, can help with this.
Best Coding Practices Guidelines in brief (Summary) A general overview of all of the above:
  • Know what the code block must perform.
  • Indicate a brief description of what a variable is for (the reference to commenting).
  • Correct errors as they occur.
  • Keep your code simple.
  • Maintain naming conventions which are uniform throughout.
  • Deployment is the final stage of releasing an application for users.

CMS Layer: Most Powerful PHP CMS Using CodeIgniter

CMS Layer The Most Developer Friendly CMS PHP and ASP

CMS Layer

CMS Layer The Most Developer Friendly CMS

The most flexible platform & programmer-friendly content management system (CMS Layer) all around the world! Build using powerful PHP framework CodeIgniter.

CMS Layer has built-in 100% Optimize SEO Comparable.

CMS Layer Plugin and Extensions are Page, Post, Product, Service, Portfolio, Forum, Package, Video, Slideshow, Classified, Download, Listing, Advertisement, Communities, Payment Gateway, ADP Template and AMP Theme.

Importing Your Database Tables

Importing Database Tables

Most new scripts come with a built-in installer. All that is resuired to pose it, is to alluviation the ‘lay.php’ author in your browser and participate your database information in the represent that is provided. When the info is submitted, the playscript creates all database tables automatically. Helping of cake. Alas, rattling ofttimes there’s no such installer included, and you’ll hit to create the database tables manually. – don’t headache – there’s nothing to it, When this is the human, a isolated database file faculty be included in the script’s folder (instruction: ‘.sql’). Unremarkably it’s titled ‘db.sql’, but this can be anything. Halt your script’s beginning drill to mature out. This is the record you poorness to meaning into your meaningless database to make the database tables. To conceptualise out how to do this for Importing Database Tables,

Still on the same page in your cPanel, click ‘phpMyAdmin’ for Importing Database Tables.

Importing Your Database Tables PHP and ASP

Importing Your Database Tables

This will open phpMyAdmin in a new window to Importing Database Tables.:

Importing your Database PHP and ASP

Importing Your Database

For  Importing Database Tables > In the left drop down menu, select the database you’ve just created. The database name will be followed by ‘(0)’, since you haven’t created any tables yet. The nigh compose instrument impart the masses content: ‘No tables plant in database’. In the reactionary build, stop the ‘Import’ tab. Click the ‘Browse’ button. Browse to your script’s folder, select the ‘db.sql’*-file and click ‘Open’.

 For Importing Database Tables Just Click ‘Go’ to start the import .

Importing Your Database Tables PHP and ASP

Importing Your Database Tables

Importing Database Tables> When your intend has been productive, your tables instrument be created. In the port redact, you’ll see the merchandise of tables that feature been created happen behindhand your database repute, and you’ll see a move of all those tables below that. You can close both phpMyAdmin and cPanel and go on installing your script for Importing Database Tables.

How to Create a database

Create a database

First, you need to log in to cPanel. You will find it when you load, then You can see this image,

How to Create a Database PHP and ASP

How to Create a Database

A new screen will appear, showing you a list of all your existing databases and database users for Create a database:

How to Create a Database PHP and ASP

How to Create a Database

Scroll down until you see a field and a button that says ‘Create Database’.

How To Create a Database PHP and ASP

How To Create a Database

Give your database a name and click the ‘Create Database’ button. A new window appears, confirming your action:  Click ‘Go Back’ to go back to the previous page. On that page, scroll down until you see two fields and a button that says ‘Create User’. Choose a username and password, and click the button. The confirmation screen will appear again. Click ‘Go Back’ to go back to the previous page. On that page, scroll down until you see ‘Add Users To Your Database’.

How To Create a Database PHP and ASP

How To Create a Database

In the first drop down menu, select the user you just created. In the second drop down menu, select the database you just created. Make sure the box next to ‘ALL’ is checked. Click the button that says ‘Add User To Database’. Again you will see a confirmation message. Click ‘Go Back’ to go to the previous page.

Scroll down until you see ‘Access Hosts’. Make a note of what’s written there (usually, this will be ‘localhost’).

How to Create a Database PHP and ASP

How to Create a Database

Your database has been created and by now you have all the info you need to run Script’s installer (or to manually edit the script’s configuration file):

  • your database name
  • your database username
  • your password
  • your host

Configuring WordPress Settings

Configuring WordPress Settings

You can find the general settings through “Settings” > “General” in the left menu. In this screen you can configure the basics of your site setup.

Configuring WordPress Settings PHP and ASP

Configuring WordPress Settings

  • Site Title: here you can fill in the title of your site / blog.
  • Tagline: in a few words, explain what your site / blog is about.
  • WordPress address (url): here you find the url of your site / blog. Be careful when you change this!
  • Site address: for regular installations, you can leave this field blank.
  • E-mail address: this address is used for admin purposes, like new user notification.
  • Membership: can everyone register to your site / blog?
  • New User Default Role: what’s the role of new users (IF they can register)? Select “Subscriber” here. Users with more experience can also select another default role here.
  • Timezone: select your timezone.
  • Date Format: select a date format.
  • Time Format: select a time format.
  • Week starts on: select the first day of the week.
Configuring WordPress Settings PHP and ASP

Configuring WordPress Settings

For now, only 2 settings are important to Configuring WordPress Settings:

  • Default Post Category: here you can choose the default post category. But you’ll first need to create other categories
  • XML-RPC: check this option to update your blog / site from mobile devices (smartphone, tablet,…) for Configuring WordPress Settings.
Configuring WordPress Settings PHP and ASP

Configuring WordPress Settings

An interesting option here is “Front page displays” to Configuring WordPress Settings. Here you can choose what will be shown on your front page. If you want to use WordPress as a website, select “a static page” and pick a page to act as your frontpage. And just like the front page, you can also select another posts page. Don’t forget, these pages have to be existing pages, so you have to create them before you can select them.

Discussion Settings for Configuring WordPress Settings

You’ll find the Discussions Settings page through “Settings” > “Discussion” in the left menu. On this page you’ll retrieve the
settings for several options. Let’s take a look!
This part is important for bloggers. If you’re planning to use WordPress as a CMS, this part is less important.

Configuring WordPress. Settings. PHP and ASP

Configuring WordPress. Settings.

  • Attempt to notify any blogs linked to from the article: if you publish an article with links to other blogs in it, your blog will try to notify those other blogs to “tell” them you linked to them (and you published an article). This will result in a automatic comment on that blog (only when you checked this option).
  • Allow link notifications from other blogs: when other blogs link to you and they notify you, they’ll place an automatic comment. Uncheck this setting to not publish these comments (I always uncheck these setting).
  • Allow people to post comments on new articles: give your visitors the possibility to write a comment under your article.

Before a comment appears to Configuring WordPress Settings

  • An administrator must always approve the comment: when someone places a new comment, an administrator always hasto approve this comment.
  • Comment author must have a previously approved comment: when someone places a first comment, you’ll have to approve this comment. After that, comments of that user will show up without any approvel.
  • Comment moderation: Hold a comment in the queue if it contains a certain amount of links (defined by you). You also have a field where you can fill in words. Fill in one word per line. When a comment contains those words, it will be held in
  • the moderation queue.

Thats it For Configuring WordPress Settings, that is the way to Configuring WordPress Settings , Try it and enjoy your wordpress Blog.

Preparing to Install WordPress

Before starting to install WordPress, you need a couple of things:
• A domain name and web hosting
• WordPress software

A domain name and web hosting for Install WordPress

The first step is choosing a domain name (for example and web hosting. There are a lot of sorts of web hosting. In most cases the registration of the domain name is included with the web hosting. If you’re just starting with WordPress, then I advise you to go for cheap shared web hosting. At any time, you’ll be able to move your blog to another web host if you need more power.

WordPress software for Install WordPress

You can download WordPress for free at  WordPress is famous for its “5 minutes installation”

Step 1: Upload the WordPress software for Install WordPress
After you downloaded WordPress and unpacked the zip file, you have to upload WordPress through FTP to your web hosting. Normally you don’t have to create an extra folder, unless you want WordPress to be installed in a subfolder.
Step 2: Start the installation for Install WordPress
In your web browser, visit the url where you installed WordPress. In most cases this will be something like

Step 3: Create a configuration file to Install WordPress
In this screen you’ll see next message:

Preparing to Install WordPress PHP and ASP

Preparing to Install WordPress

Click the “Create a Configuration File” button.

Step 4: Welcome message for Install WordPress

It’s possible that WordPress can’t create the configuration file. When you experience this problem, search for wp-configsample. php on your web space. Just make a copy of wp-config-sample.php and rename it to wp-config.php. Now try again. The succeeding door is a welcome substance. It also reminds you to the fact that you impoverishment all the information you got from your web Host.

Preparing to Install WordPress PHP and ASP

Preparing to Install WordPress

Step 5: Fill In The Database Connection Details to Install WordPress
In the following screen you need to fill in the database connection details:

  • Database Name: the name of your database
  • User name: the MySQL username
  • Password: the MySQL password
  • Database Host: by default this is localhost (only change this if you have anoter database server from your web host)
  • Table Prefix: by default this is “wp_” but for security reasons it’s better to fill in another table prefix.

Click the “Submit”-button to proceed. If you see this screen, your database connection details are ok:

Preparing to Install WordPress PHP and ASP

Preparing to Install WordPress

Click the “Run the install” button to start the installation of WordPress

Step 6: fill in the basic information to Install WordPress

In the following screen you have to fill in some basic information

Preparing to Install WordPress PHP and ASP

Preparing to Install WordPress

  • Site title: fill in the title of your blog or website.
  • Username: choose a username. By default “admin” is filled in but for security reasons I advise you to choose another
  • username. This makes it harder for hackers to guess your administrator username.
  • Password, twice: fill in a password. For security reasons, pick a strong password that’s not easy to guess!!
  • Your E-mail: fill in a valid e-mail.
  • Allow my site to appear in search engines like Google and Technorati: select this so your website can be found and indexed by search engines.

Click the “Install WordPress” button after you filled in the needed information. That’s it! Click the “Log In” button to get access to the back office where you can manage WordPress