Programming Basics
  Home arrow Programming Basics arrow Page 2 - Coding
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PROGRAMMING BASICS

Coding
By: lig
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2006-01-17

    Table of Contents:
  • Coding
  • Thinking before Coding
  • Commenting
  • Coding Style
  • Error Reporting
  • Error Handling
  • Security
  • Reinventing the Wheel
  • Advanced
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Coding - Thinking before Coding


    (Page 2 of 10 )

    You have a brain--use it before you ever set finger tips to keyboard. By taking the time to make a few decisions and thinking out the design of a script, you can save yourself hours, days, even weeks of time when your "great" idea turns out being not so great. One thing every programmer should have nearby is the simple paper and pencil. Writing code is the easy part; if you do proper planning then your just writing syntax.

    Procedure or Object Oriented

    One of the decisions you should make before you start coding is what methodology your code will follow. Will you code it procedurally with a library of functions, object oriented with classes or a combination of the two? PHP is a language that doesn't dictate one way or the other--which in my opinion is one of its greatest strengths. Each has its strengths and weaknesses, so pick the method that will work best for your script.

    Basic Logic Flow

    Have you ever heard of flowcharting or pseudocode? They are simple non-language specific methods of working through the scripts logic. With your pencil and paper you write/draw out your logic and do simple bench testing to make sure it works. Here is where you should be spending the majority of your time. You can write out your logic from the step by step if/else level up to the script level calling the classes or functions. Take your time--the more problems you find here the fewer problems/bugs there will be to fix later, and a piece of paper is easier to crumple up and redo then rewriting 1000 lines of code.

    Breaking it up

    Now that you have some of your logic figured out, start looking for things/patterns that are done repeatedly or just seem to go together. Maybe these things can be moved into small self contained functions or classes. Breaking up your code into reusable pieces saves you time in typing and debugging. Typing because you don't have to type the same thing over and over again, debugging because once it is bug free for the first call it will be bug free for the last call.

    More Programming Basics Articles
    More By lig


       · The link to Chris Shiflett's blog is broken.The blog can be found at...
       · Be careful when you log stuff to rotate the logfile, otherwise it'll fill up and...
       · Sorry about that.
       · Thanks very much for taking the time to write this. Although most was over my head,...
       · That was pretty convincing Gospel. I hope this stuff is gonna work for...
     

    PROGRAMMING BASICS ARTICLES

    - PHP: Hypertext Preprocessor: What is it?
    - Loops and PHP Decision Making
    - Operators, Conditionals, and PHP Decision-Ma...
    - PHP Decision-Making
    - Coding
    - Server Statistics
    - Looping in PHP
    - Cookies in PHP
    - Working with text files
    - Beginning Object Oriented Programming in PHP
    - A Tour of Decision Making Structures in PHP
    - PHP Strings Primer
    - PHP Control Structures
    - Intro to Vim
    - Reading Directorys with PHP





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek