× 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.



<Joe>

Paul, what you're trying to sell here is a code generator.  I won't even
go into the code bloat such a prospect engenders in Java.

Paul, I know what a large application takes.  There are two levels of
programming: the grunt stuff we do over and over again that we assign to
a junior programmer, and the real stuff.

You generate the junior programmer stuff, and you say it can be used as
a framework for the other stuff.

But up until this point, all we've seen is the file maintenance stuff.
Supposedly you retrieved a currency conversion rate, and maybe even did
something with it although we didn't see that.  And even that was hidden
in:
Supposedly you retrieved a currency conversion rate, and maybe even did
something with it although we didn't see that.  And even that was hidden
in:

> cc = contact.getField(IContactBuTable.COUNTRY_CURRENCY_CODE);
> getCurrencyExchangeRate(cc.getValueAsString());

Nothing particularly OO here.  This is basically procedural code in
Java, which is not the revolution I had in mind.

> You should
> also understand the majority of Web based applications being developed
> today ARE of a maintenance, or EIS inquiry in nature.  To a much
lesser
> extent, large projects in Java are occurring.

There's a reason for that, Paul!  BECAUSE JAVA ISN'T VERY GOOD AT
BUSINESS PROGRAMMING!



<Joe>

1. No I don't use any code generation in my approach.
With a framework approach, one piece of code handles all occurrences of a
business problem.  Tell me this, if "the grunt stuff we do over and over
again that we assign to
a junior programmer" wouldn't THAT lead to duplicating coding, code bulk,
and low productivity.  Even with Nathen's comments about copying and pasting
to solve each problem you still have to deal with redundant maintenance so
lose your single point of control.  So I would argue it is procedural that
is bloated.
2. We are about solving real business problems for the iSeries, "code bloat"
IMHO is borderline buzzwords usage.  As of yet, you have not proven any of
your advised approaches nor disproven OO principles.  I'm about solving
business problem quickly and effectively,  OO is a technique to aids me in
that pursuit.
3. "Need to custom code validation".   This is true.  I have no mind reading
software of frameworks.  The frameworks allows all standard validation such
as required fields, default values, etc to be handled abstractly and then
YES you need to write some validation code.  It particularly doesn't matter
as much if I write this code in full OO or procedural.  At some point I may
need to add some numbers or parse a String.  If the tasks doesn't reoccur
often, it's find to brute force a solution. Again the value is that I only
code the custom code particular to a company, the rest is automatically
handled resulting in faster time to market and lower development costs.
4. Discussing OO concepts and techniques tend to be difficult without
illustrations, examples, etc although we certainly can.  The true net
tangible result of everything we are discussing is how fast can you solve
business problems in a quality manner that meet requirements.  This is what
it's about in the end.  I still fail to understand how you are going to
achieve productivity wrapping each table in a server redundantly coding
common patterns.
5. I have illustrated how complex price calculations can be performed within
the context of the framework and I can get as complex as you want.  (see
additional code below)
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.

Here is the code you ask for.  This code is invoked as part of add a
warranty claim and handles currency conversion.
/**
 *  Return the currency conversion.  Delegate to a utility class to allow
reuse of currency conversion service.
 */
public BigDecimal getCurrencyExchangeRate(String code) throws CMException {
        return CurrencyManager.getExchangeMultiplier(code, "USD", null);
}

CurrencyManager - reusable utility:

/**
 * Exchange multiplication value can be retrieved by specifying country code
from & to.
 * Creation date: (3/21/2003 1:31:36 PM)
 */
public static BigDecimal getExchangeMultiplier(String fromCountryCode,
String toCountryCode, ExecutingContext ec)
        throws CMException {

        // If countries are the same, no need to check conversion, it will 
always
be 1.00
        if (CMUtility.equalsIgnoreCase(fromCountryCode, toCountryCode)) {
                return new BigDecimal(1d);
        }
        // ensure jde connection started
        if
(!DatabaseManager.doesConnectionPoolExist(IWarranty.CONNECTION_ALIAS_JDEPRDD
TA)) {
                
DatabaseManager.createConnectionPool(DataEngine.getDefaultMetaDataAlias(),
IWarranty.CONNECTION_ALIAS_JDEPRDDTA);
        }

        // !!N WK (9/19/2003 2:22:37 PM) - library, table, and columns probably
shouldn't be hard coded in SQL consider externalizing
        SQLContext context = new 
SQLContext(IWarranty.CONNECTION_ALIAS_JDEPRDDTA);
        context.setSQL("SELECT cxcrr FROM jdeprddta.f0015 WHERE cxcrcd = ? AND
cxcrdc = ? AND cxeft=(SELECT MAX(cxeft) FROM jdeprddta.f0015)");
        context.setUsePreparedStatement(true);

        // changed to cache for only an hour, exchange file updated once a day, 
so
this should be close enough
     // Cache provides performance improvements since claims don't have to
continually lookup exchange rates.
        context.setCheckCache(true);
        context.setCacheResults(true);
        context.setCachingTimeMillis(3600000);
        context.setParameterValue(0, fromCountryCode);
        context.setParameterValue(1, toCountryCode);

        RowCollection rc = DataEngine.getRows(context);

        // !!C MT (4/9/2003 11:50:38 PM) should throw an exception if multiple 
rows
are returned
        if (rc.size() > 1) {
                throw new CMException("CurrencyManager.getExchangeMultiplier() 
- retrieved
multiple results");
        }

        // If currency code is not found then default to USD - multiply times 1
        if (rc == null || rc.isEmpty()) {
                return new BigDecimal("1.00");
        }
        return new BigDecimal("" + rc.getValueAsDouble(0, 0));
}


Thanks,  Paul Holm




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.