× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




This is a good starting point for the discussion.

> What did you have to do to get to the above statement? A chain? A > read? How were those sub procedures written that have the chain and > read in them?

Or an SQL statement. What ever it takes to get the data you want. The
internals are important only during the design and implementation. The
object is to make the end-product reliable and easy to use. Plus, it's
not necessary to think of everything upfront. There's no need to code
for a data access method that's never used. If someone decides to use it
in the future, they just update the service program.

The problem with this is that there's no way the service program can know of how a caller is going to use it, unless business logic is specified in the design of the module.

Some programs will want to read some logical files. Others will want to read the PF in arrival sequence for best performance. Some will want to use blocking to speed up the process. Some will want each record locked so they can perform an update. Some will want an SQL query that joins files together, filters on certain criteria, and orders the data by certain criteria.

Since there's no way that your service program can possibly know how it'll be used, what happens? You end up writing routines like

     invoice_open_with_blocking()
     invoice_open_for_update()
     invoice_chain()
     invoice_read()
     invoice_open_sql_query()
     invoice_read_sql_cursor()

Now the calling application needs to know whether it wants blocking or not. It needs to know whether it wants the file open for update. It needs to know whether it wants to use SQL.

In other words, the caller is no longer completely separate from the database logic! It needs to understand something about the underlying implementation -- and that's exactly the problem with this type of thinking.

Instead, you need to look at it as a business problem, not a database operations. You need business logic to make that happen.

Your routines should be:

   invoice_load();
   invoice_change();
   invoice_getAllUnpaid();
   invoice_findByCustomer();
   invoice_findByTotal();

That way, you can completely separate the implementation of the routine. The caller doesn't need to know whether a database is used, or whether it's a stream file, XML file, web service, etc. All it knows is that it wants to find the unpaid invoices -- it doesn't care how the file encapsulation routine goes about doing that.

That's the point I've been trying to make (and I'm not sure I've succeeded) in this thread.

If the need for more of these functions comes along later, you're absolutely right, you can write the additional routines then and add them on -- no need to try to figure them all out in advance, or code things that may never be used.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.