|
> From: Paul Holm > > 1. No I don't use any code generation in my approach. Sorry, I guess I misread: > c) Framework goes on to call ServiceCenterRow.validate where both > generate and custom validation can occur I read this to mean generated validation. > 6. Java is good at business programming. OO only codes on an exception > basis, you call all layers usually redundantly from what I see. I still > persist that OO would destroy your mostly procedural approach not to be > confrontational but to solve problems fast and flexibly. I disagree, and we'll see why in an instant. > Here is the code you ask for. This code is invoked as part of add a > warranty claim and handles currency conversion. (snipping some 40 or 50 lines of procedural Java code) Paul, I really don't want to be confrontational either, but I just don't understand your reasoning. Why is your 50-line Java procedure better than the following RPG routine? Convrate = 1.0; Setgt (fromcountry : tocountry) ConvMast; Readpe (fromcountry : tocountry) ConvMast; If %found(ConvMast); ConvRate = CMCONVRATE; Endif; Return Convrate; The simplicity and readability of the code is obviously far better than yours, with no comments. Add to that your potentially massive runtime inefficiency of having to figure out the max effective date using a MAX statement, which means you either need an index over the entire file by effective date or else you have some NASTY runtime problems. Also, your code has an insidious bug that if two currency rates have different effective dates, you can get the wrong conversion rate, which is one of the many things I don't like about complex SQL statements like yours (and this example is nearly trivial!). You have other oddities. For example, you perform a case insensitive comparison of from country and to country, yet you use those same fields untranslated to access the database. The former implies that the user can enter mixed case, but if they do, the conversion won't get a hit because the SQL comparison is case-sensitive, and since you don't require a record, you'll get a rate of 1.0 and no exception. I dunno Paul. I still say my way is quicker. And more flexible. And easier to read and understand and debug and change. But this is good. Now that we're comparing code fragments, we can get out of the stupid "OO is better" gobbledygook that makes Jim so crazy and do some real comparisons. What's next? Joe
As an Amazon Associate we earn from qualifying purchases.
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.