[PLUG] java accounting math

Rich Shepard rshepard at appl-ecosys.com
Wed Jun 6 18:02:34 UTC 2007


On Wed, 6 Jun 2007, Carlos Konstanski wrote:

> It appears that you are correct in presuming that BigDecimal is java's way
> of handling accounting arithmetic.  I found a Sun java API for smart card
> programming, which contains a class called BigNumber, which encapsulates
> BCD representation.  But it looks far too chunky to use in an accounting
> app, while BigDecimal seems adequate for the task.

Carlos,

   I remember struggling to learn BCD for use in FORTRAN IV with the WATFOR
compiler on main frames. Those IBM manuals were terrible!

> In a world where languages exist that can easily handle the math (fortran,
> lisp, caml), why do we use java for accounting anyway?  What a marketing
> triumph.  Maybe we should rename lisp after an addictive beverage, and
> then everyone will want it.  I propose "Urquell".

   Well, here's something to think about: use java for the middleware and
front end (with SWING), but use PostgreSQL (or SQLite3) for the back end.
They have data types (NUMERIC and DECIMAL, with postgres; INTEGER in sqlite)
with sufficient precision, but you need ancillary functions to make them
work like the deprecated MONEY type in postgres. But, storing the accounting
data in tables makes present and future maintenance so much easier.

   If you want to look at a perl example for ideas, look at SQL-Ledger
<http://www.sql-ledger.org/>. You might be able to port it from perl to java
to meet your company's needs.

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |          Accelerator(TM)
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the PLUG mailing list