You are here:About>Computing & Technology>Delphi Programming> Coding Delphi Applications> Before you start optimizing Delphi code
About.comDelphi Programming
Newsletters & RSSEmail to a friendSubmit to Digg

Before you start optimizing Delphi code

From Zarko Gajic,
Your Guide to Delphi Programming.
FREE Newsletter. Sign Up Now!

"Any program will expand to fill available memory..."

Sooner or later you'll find out that Murphy has it. The idea behind this article is to help you ease the process of optimizing and debugging your Delphi applications.

Note: why not start with the Speed and Size: Top 10 Tricks article.

  • The High Performance Delphi site has detailed optimization information for the intermediate to advanced Delphi programmer with some working knowledge of general optimization techniques. The Fundamentals section examplains the purpose of code optimization proccess. The bulk of the information presented in these pages concerns optimization from the algorithm level down. The selection or development of the algorithm is not covered. What is covered, is some general considerations about choosing algorithms, and how to adapt and implement those algorithms so that they perform optimally. Delphi Optimization Guidelines section are divided into functional groups: General Guidelines, Integer Guidelines, String Guidelines and Floating Point Guidelines. General guidelines are designed to help you understand why is it better to use local variables instead of global, why you should not use nested routines, what is the difference between linked lists and arrays and how to opti mize Delphi for loops. Integer Guidelines relate to any ordinal type, including characters. Topics like subrange types and integer multiplication are discussed here. String guidelines relate to string and PChar issues. Floating point optimization guidelines are about extended type, mixing real types, function vs procedure and similiar.

  • Writing Robust Code - there are many subtle issues to be aware of when it comes to ensuring code correctness and robustness: the article examines some of these issues, with a special emphasis on contract-based programming.

  • Non-obvious Debugging Techniques - we all have to debug applications, and there are many common techniques available to help things along. This session reveals a number of techniques that can be useful to aid the debugging task, but which are not of a particularly obvious nature.

  • Writing solid Delphi code (aka Fundamentals of Bug Prevention in Delphi) covers a selection of proven techniques that Delphi developers of all skill levels can use to avoid introducing bugs into their software. The techniques range from automated unit testing to smaller tips and tricks. All are based on "project rescues" performed for clients. Also included is the complete source code for an automated unit testing framework used in the paper.

  • Simplifying Pre and Post-Condition Testing in Delphi covers a technique to make adding pre-condition and post-condition tests to your Delphi code very easy. Hopefully if it's easy, it'll get done.

  • In the Delphi Efficiency Optimisation article, the author explores numerous tools and techniques that are available when working on Delphi efficiency and performance optimization. You'll see a structured performance optimization process, how to (top-down) break down the application and optimise step by step. We're also see special bottom-up optimisation, a feature introduced by the re-usable Component nature of Delphi.

  • Extreme Programming. Extreme Programming (XP) is a deliberate and disciplined approach to software development. This methodology emphasizes team work. Managers, customers, and developers are all part of a team dedicated to delivering quality software. The idea behind XP is that "as you write each bit of code, you should also write a little test to go with it". Tests are automated and provide a safety net for programmers and customers alike. Tests are created before the code is written, while the code is written, and after the code is written. The DUnit is an Xtreme testing framework for Delphi programs. The "Testing the World Away" describes the use of Dunit. Another article, "Testing: Quality Time With DUnit", disscusses the use of DUnit in Delphi progr amming.
    Another article is a discussion of benefits to be derived from using testing tools such as JUnit, DUnit, NUnit or CppUnit. The heart of the argument is that such tools encourage programmers to create highly modular, reusable classes that are easy to maintain.

    Before you jump on the bandwagon and start optimizing every line of code, keep in mind that a good application design and architechture can do more for performance than even the most finely tuned code. The Delphi Coding Standards and Conventions will show you how to apply solid design principles and coding practices. The articles present recommendations of standards and conventions for designing, coding, and commenting software projects written in Delphi.

  •  All Topics | Email Article | | |
    Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
    User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.