reading getting down to business. training target: read the following reading materials and use the...

Click here to load reader

Upload: asher-freeman

Post on 28-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

  • ReadingGetting Down to Business

  • Training target: Read the following reading materials and use the reading skills mentioned in the passages above. You may also choose some parts of this passage to practice.

  • Text

    In this partIll be focusing on the implementation phase of a software projectand suggesting some general techniques and approaches that might come in handy when you finally sit down to write your application. The ideas discussed in the following pages are not new heckbut they should nevertheless help you deliver cleanerfaster and more maintainable code.

  • In the world of software developmentnaming conventions and coding standards acquire significance in making your code easier to readunderstand and maintain. There are some basic rules to be kept in mind when naming objects within your application. Heres a brief list: The Name Game

  • Choose meaningful names for your objects. Capitalize the first character of each word in your chosen nameor use underscores to separate wordsthis makes the name easier to read. Use names that are short and easy to pronounce. Ensure that the chosen name is not ambiguous. Use capitalization and/or underscores to differentiate between private and public variablesor local and global variables.

  • Its also important to decide on and follow a specific coding standard when naming your variables and functionsand to carry this convention through consistently in all your scripts. This coding standard should specify the naming conventions for variablesfunctions and objectsfile name prefixes and suffixesfile organization rulesindentation and comment style. Ensure that the document specifying the coding standards includes examples that illustrate each rule clearly.

  • Make sure that your application file system is structured properlyand that the different components are all in the right place. Spend some time developing a suitable directory structure within which your application code will resideand clearly demarcate the locations in which different bits of data are to be stored. If your application files will be named according to a specific notationconsider all cases when defining this naming convention and ensure that it covers all possible situations.

  • Finallycommentcommentcomment! It might seem like a drag to add comments to your code while youre developing an applicationbut observations have shown that comments play an important role in improving the quality of your code. Not only does a comment serve as a handy reminder of the thought processit also helps other developers read and review your code.

  • Breaking it down You should also spend time modularizing your application by breaking it up into discrete componentsthis simplifies development by allowing you to focus on smaller pieces of the puzzleand also makes the code easier to maintain. Code modularization can be as simple or as complex as you like. At one end of the scale is very basic abstractionseparating common interface elements or configuration variables into independent files.

  • Global changes then become as simple as altering a single file. The next step is to do the same with your codeseparate common functions into subroutines that can be invoked wherever needed in your application. This has a couple of advantages: firsta subroutine allows you to separate your code into easily identifiable subsectionsthereby making it easier to understand and debug. And seconda subroutine makes your program modular by allowing you to write a piece of code once and then reuse it multiple times within the same program.

  • As your familiarity with code modularization increasesyou will find yourself grouping your functions into reusable objectsand writing code using OOP techniques. Remember to clearly define the input and output interfaces of each objectand the interfaces between objects. Create standard APIs so that you can implement black box techniques and thereby minimize the impact of a change in one module on other modules.

  • Since objects allow for inheritance and extensibilityyou should consider building a library of standard objectsand using this library whenever needed in your development activitiesthis can significantly reduce the time you spend on coding standard functionsand also give you a base of stable code.

  • As you develop new objectsalways try to make them as generic as possibleso that they become reusable and useful for subsequent projects. And dont forget the Webthere are rich code repositories for almost every programming language onlineand you can often substantially reduce development time by using a freeopen-source widget instead of building your own from scratch.

  • Batteries Not Included In order to increase the portability and maintainability of a Web applicationconsider making the following components standard inclusions in every project you develop.

  • 1.An interface abstraction layer: By substituting variable placeholders for actual content in an HTML pagetag-based scripting languages like PHPPerl and JSP make it easy to construct dynamic Web pages; simply alter the values of the variables embedded within the HTML codeand the content displayed on the page changes appropriately.

  • 2.A database abstraction layer: If youve worked with different databasesyouve probably seen that each database operates in a slightly different manner from the others. The data types arent always uniformand many of them come with proprietary extensionstransactionsstored proceduresetcthat arent supported elsewhere. You may need to change specific function calls in your code as your RDBMS changes.

  • 3.An exception handler: No developerno matter how good she/he iswrites bug-free code all the time. Consequentlymost programming languages come with built-in capabilities to catch errors and take remedial action. Typicallythis action involves displaying a warning message and depending on the severity of the error and terminating program execution.

  • Key words

    variable function script comment maintainability stored procedure extention transaction portability repository

  • The End