Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38720

Re: How to make my library independent using DI

From Martin Gregorie <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How to make my library independent using DI
Date 2019-01-29 19:29 +0000
Organization albasani.net
Message-ID <q2q9iq$41a$2@news.albasani.net> (permalink)
References <c9bc00ee-744c-49e2-b026-08a68841cf48@googlegroups.com>

Show all headers | View raw


On Tue, 29 Jan 2019 10:11:52 -0800, mike wrote:

> Hi,
> 
> I am creating a library that can be used with different java
> applications.

I've had one for years - just like a similar C library that I started 
even earlier. I think its best to just let these things grow:

- I didn't like the standard C getopt() function, so wrote my own, which 
can also parse out non-option items on the command line and, knowing I'd 
use this a lot, it went straight into my support library. Somewhat later 
it got reimplemented in Java as my ArgParser class: there is no standard 
equivalent and something like it is essential if you tend to write non-
graphical Java programs. 

- I've done the same for tracing and debugging packages, and added other 
stuff as and when I needed to write it: circular buffers that hold the 
last 'n' log messages, a CSV support package, also my own design of 
regression testing support code ....

The trick is simply to recognise that a piece of code may be useful in 
other places too, write it from the outset to be free from application-
specific dependencies, add a regression test harness for it, and lob it 
into your support package rather than blindly building it into the 
application you're working on.
 

-- 
Martin    | martin at
Gregorie  | gregorie dot org

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to make my library independent using DI mike <mikaelpetterson@hotmail.com> - 2019-01-29 10:11 -0800
  Re: How to make my library independent using DI Martin Gregorie <martin@mydomain.invalid> - 2019-01-29 19:29 +0000
  Re: How to make my library independent using DI Andreas Leitgeb <avl@logic.at> - 2019-01-30 10:11 +0000
    Re: How to make my library independent using DI mike <mikaelpetterson@hotmail.com> - 2019-01-30 06:13 -0800
      Re: How to make my library independent using DI Andreas Leitgeb <avl@logic.at> - 2019-02-01 14:13 +0000
  Re: How to make my library independent using DI Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-02-04 16:33 +0100

csiph-web