Page 216 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 216

Principles of Software Engineering



                   Notes         ADO-Specific
                                    •  Tune the RecordSet.CacheSize property to what is needed. Using too small or too large a
                                      setting will adversely impact the performance of an application.
                                    •  Bind columns to field objects when looping through recordsets.
                                    •  For Command objects, describe the parameters manually instead of using Parameters.
                                      Refresh to obtain parameter information.
                                    •  Explicitly  close  ADO  Recordset  and  Connection  objects  to  insure  that  connections  are
                                      promptly returned to the connection pool for use by other processes.
                                    •  Use adExecuteNoRecords for non-row-returning commands.
                                 Superior coding techniques and programming practices are hallmarks of a professional
                                 programmer. The bulk of programming consists of making a large number of small choices
                                 while attempting to solve a larger set of problems. How wisely those choices are made depends
                                 largely upon the programmer’s skill and expertise.

                                 The  document addresses  some  fundamental  coding  techniques  and  provides  a  collection  of
                                 coding practices from which to learn. The coding techniques are primarily those that improve
                                 the readability and  maintainability of  code,  whereas  the programming  practices  are  mostly
                                 performance enhancements.

                                 The readability of source code has a direct impact on how well a developer comprehends a
                                 software system. Code maintainability refers to how easily that software system can be changed
                                 to  add  new  features,  modify  existing  features,  fix  bugs,  or  improve  performance.  Although
                                 readability and maintainability are the result of many factors, one particular facet of software
                                 development  upon  which  all  developers  have  an  influence  is  coding  technique.  The  easiest
                                 method to ensure that  a team of developers will yield quality  code is to establish a coding
                                 standard, which is then enforced at routine code reviews.
                                    •  Coding Standards and Code Reviews

                                    •  Coding Techniques
                                    •  Best Practices
                                    •  Conclusion

                                    •  Suggested Reading
                                 10.3.1 Coding Standards and Code Reviews

                                 A comprehensive coding standard encompasses  all aspects of code  construction and, while
                                 developers  should  exercise  prudence  in  its  implementation,  it  should  be  closely  followed.
                                 Completed source code should reflect a harmonized style, as if a single developer wrote the code
                                 in one session. At the inception of a software project, establish a coding standard to ensure that
                                 all developers on the project are working in concert. When the software project will incorporate
                                 existing source code, or when performing maintenance upon an existing software system, the
                                 coding standard should state how to deal with the existing code base.
                                 Although the primary purpose for conducting code reviews throughout the development life
                                 cycle is to identify defects in the code, the reviews can also be used to enforce coding standards
                                 in a uniform manner. Adherence to a coding standard can only be feasible when followed
                                 throughout the software project from inception to completion. It is not practical, nor is it prudent,
                                 to impose a coding standard after the fact.





        210                               LOVELY PROFESSIONAL UNIVERSITY
   211   212   213   214   215   216   217   218   219   220   221