ITworld.com
  Search  
ITworld Home Page ITworld Webcasts ITworld White Papers ITworld Newsletters ITworld News ITworld Topics Careers ITworld Voices ITwhirled Changing the way you view IT

The four rules of software modeling

ITworld.com 5/22/00

Michael L. Perry, ITworld.com

This column goes out to all the IT professionals ... and I think I know who you are.

You live next door to your boss, your team members, and your users. You do the work of developer, administrator, and one-off magician. You usually don't have the luxury of knowing the requirements of a project, let alone generating a formal design. You want to practice design patterns and object-oriented architecture and design, but you have a list of bugs that dates back to JCL, you're trying to work out a particularly frustrating query optimization problem, and your boss is toying with yet another project-database idea.

On this topic
>

What you really need is a way to find and fix the bugs in your teammates' code, avoid putting in bugs of your own, and quickly turn around your users' requests. You may feel far away from the world of analysis and design, but that world has the answer to your problems.

The answer is modeling.

The rules
Modeling is simply the practice of creating a small system that has some of the same features of a larger system. When applied to software, the word modeling usually conjures up images of wall-sized UML diagrams. Internal software, however, changes so quickly that such diagrams are usually out of date by the time they are printed. Fortunately, such large-scale and often unwieldy methods are not the only kind available for modeling software.

A software model does not have to start from scratch. It does not have to permeate the entire system. And, most importantly, it does not have to be set in stone before implementation begins. The only thing that a software model needs is a set of rules. I'm going to go out on a limb here with a generalization, but so far it appears to be true: The same four rules apply to all software models.

The four rules of software modeling are:

  1. Ownership
  2. Dependency
  3. Interface
  4. Identity

Unlike the rules of object-oriented design, these four apply to legacy systems as well as to new projects. Think back to the last serious bug that you fixed. You can probably identify a violation of one of these rules as the cause.

Briefly, ownership means that every object has exactly one owner (the object responsible for its creation and destruction), and that ownership is not transferable. Dependency means that any bit of data used to evaluate a dependent quantity is a precedent, and that dependents must be up to date whenever referenced. Interface means that every object implements some set of interfaces, and that these interfaces allow objects to be interchanged. Identity means that all objects have unique identity, that an interface inherently identifies an object, and that all clients accessing an identical object can expect uniform behavior.

Can you spot the bug?
The goal of this column is to explore the rules of software modeling and to demonstrate their application in day-to-day tasks. For the first few weeks, we will examine some common bugs to find their core modeling violation.

Take, for example, a financial ledger displayed in a list-view control. The ledger is an in-memory list of transaction objects. The ledger maintains a balance, and each transaction contains an amount. The pointer to each transaction is stored in the data area of the corresponding list item. When the user selects an item and presses the Delete key, the item subtracts the transaction amount from the ledger balance, deletes the transaction, and then removes itself from the list. When the user presses the F5 key, the list view removes all items, iterates through all transactions of the ledger, and adds a new item for each.

0519_fig
Figure 1. Object diagram of a buggy financial ledger application.

Can you spot the bug? Can you fix it? Next week, we will examine this bug to determine which of the four rules it violates. When you work from the mindset of software modeling, you will be able to quickly spot bugs and avoid writing them.

Michael L. Perry has been a professional Windows developer for over six years and maintains expertise in COM+, Java, XML, and other technologies currently shaping the programming landscape. He formed Mallard Software Designs in 1998, where he applies the mathematical rigor of proof -- establishing the correctness of a solution before implementing it -- to software design. He is the moderator of ITworld.com's Windows Application Development discussion.




Sponsored Links

Workflow Enabled Help Desk & IT Service Management
Automate service desk activities and integrate processes across IT. Learn more here.
IP Networks Boost Secure Health Communications
AT&T provides secure communication to keep health care moving forward.
New Webcast: How to PROFIT WITH REMOTE SUPPORT
Discover how REMOTE SUPPORT can fuel your IT business in ways you've never thought of before.
TOSHIBA SATELLITE PRO Notebook – Save With Synnex!
SYNNEX RESELLERS - Great Deals On Toshiba. Business Computing Has Never Been More Affordable!
TAKE CONTROL OF REMOTE COMPUTERS
Support, configure and install applications and updates remotely for greater efficiency.
» Buy a link now

Advertisements
Sponsored links
Top 5 Reasons to Combine App Performance and Security
KODAK i1400 Series Scanners stand up to the challenge
Bring harmony to your mix of UNIX-Linux-Windows computing environments
Locate Hidden Software on business PCs with this free tool
 Home   Applications  Engineering/scientific software  Modeling and simulation software
www.itworld.com    open.itworld.com     security.itworld.com     smallbusiness.itworld.com
storage.itworld.com     utilitycomputing.itworld.com     wireless.itworld.com

 
Contact Us   About Us   Privacy Policy    Terms of Service   Reprints  

CIO   Computerworld   CSO   GamePro   Games.net   Industry Standard   Infoworld   ITworld  
JavaWorld   LinuxWorld  MacUser   Macworld   Network World   PC World   Playlist  

DEMO   IDG Connect   IDG Knowledge Hub   IDG TechNetwork   IDG World Expo  

Copyright © Computerworld, Inc. All rights reserved

Reproduction in whole or in part in any form or medium without express written permission of Computerworld Inc. is prohibited. Computerworld and Computerworld.com and the respective logos are trademarks of International Data Group Inc.