Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Future reuse of code

Reply
Thread Tools

Future reuse of code

 
 
=?ISO-8859-1?Q?Thomas_Gagn=E9?=
Guest
Posts: n/a
 
      08-04-2003
I've been very successful reusing COBOL, but mostly by virtue of it being
accessible behind CICS. I can connect to CICS from any platform using various
combinations of middleware, and avail my new system of the legacy of
COBOL-implemented functions as long as those function serve the customer's
purpose.


Donald Tees wrote:
> "Peter E.C. Dashwood" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>

<snip>
> Aren't you talking about marriage or something? About the *only* code I
> know that is still running after 15 years use is in Cobol. I could say the
> same for 30 years.
>
> Even in the last five years, the components I have used have evolved into
> different packaging, required updates for each OS, etc. etc.
>
> Donald
>
>


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Thomas_Gagn=E9?=
Guest
Posts: n/a
 
      08-04-2003


Peter E.C. Dashwood wrote:
>
> The source language is irrelevant in terms of code re-use. (It is OBJECT
> code that will be re-used...)
>

Simply by virtue of being OO it is not guaranteed to be reusable. Paradigm is
no substitute for design.

> You should select a source language SUITABLE FOR THE JOB YOU WANT TO DO!!!


Well said.

>
> Then make sure that an OO or modular approach is adopted, wrap your
> functions as components, and you can reuse them FOR EVER not just 15 years.


Again, well said. Good advice.

 
Reply With Quote
 
 
 
 
jce
Guest
Posts: n/a
 
      08-04-2003
"James Cameron" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi I'm developing a program and the client is worried about future
> reuse of the code. Say 5, 10, 15 years down the road. This will be a
> major factor in selecting the development language. Any comments on
> past experience, research articles, comments on the matter would be
> much appreciated. I suspect something like C would be the best based
> on comments I received from the VB news group.
>
> Thanks for the help in advance
>
> James Cameron


<---repeated from another post---->
In 5/10/15 years the questions come down to (a) Do we have time and money to
port (b) Can we survive with what we have or (c) is there a market product
that has what we want.

In general the argument seems to go straight to (b) and (c). No one wants
to pay for an upgrade.
<---repeated from another post---->

Java already has issues. The backward compatibility isn't the 100%
promised....you constantly need to upgrade to get the latest and greatest.
The API s have a lifecycle of a year or two so you are constantly faced with
question (a).

Seems to me that .NET would work best here because then you can pick the
source of your choice. I don't know much about this so I shouldn't really
comment.

You don't say what the application is which makes the response hard. Some
language are better for some things than others
It might be better for example as a plug-in to another application (say
eclipse) rather than you developing an entire framework.

I would always suggest a search on sourceforge to see if something is out
there that helps....

Personally I have four views - when you are talking of multiple programmers:

1. If you have COBOL programmers use COBOL. If you have C programmers use
C. This is built on the shaky assumption that they are good coders. I
would rather have competent programmers writing competent code that provides
higher stability than competent programmers writing immature code. Bear in
mind that COBOL has an underground "cool" factor now....no, really...

2. Java is the easiest answer to sell and as pointed out here...it's
pretty vanilla (which doesn't mean no gotchas) but should be relatively
readable. So if you're in competent programmer you can understand this
easily enough.

3. Does anyone really look to an application to last this long? Seems to
me that everything goes through a rewrite as part of natural evolution. I'd
rather go for quality than anything (which means I invested in Betamax over
VHS and Token Ring over Ethernet I suppose).

4. The MOST important question is ........does it matter if I can reuse it
in 5 years if I cannot get it out of the door quickly now? No point
architecting a 15 year plan if it takes 5 years to execute and you need it
in 3 months. I didn't get that priority from your original note.

If you are on your own then I only have one comment:
Narrow choices down to what you are comfortable with then add those
languages you are confident of handling. You have to deliver the quality
product NOW and not 15 years from now.

Here's the kicker:
Imagine......Sun goes belly up in 2006....Microsoft antes up with a few
billion to buy the Java licensing rights....woo hooo.....We'll all try
desperately to port to Inga's free open source virtual software layer Ingot
that runs on EyeBeeEmux to remove Microsoft dependencies....(remember they
once thought the earth was flat and that Senators were for the people).
In 2015 we no longer run processors as we know them. Electrons have been
isolated on switches that are built on self managed bio matter developed in
the Democratic People's China by po'd shepherds who refuse to divulge their
methods to the Communist States of America.

JCE

(Notice the lack of Pascal support here....why did we ignore ADA?)


 
Reply With Quote
 
Harley
Guest
Posts: n/a
 
      08-04-2003

"Jacob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| James Cameron wrote:
| > Hi I'm developing a program and the client is worried about future
| > reuse of the code. Say 5, 10, 15 years down the road. This will be a
| > major factor in selecting the development language. Any comments on
| > past experience, research articles, comments on the matter would be
| > much appreciated. I suspect something like C would be the best based
| > on comments I received from the VB news group.
|
| NOTHING will run 10 years from now!

You might want to qualify this by language.
(NOTHING written in ? will run 10 years from now!)
Be careful, there are people out there with 10 year old software that is
still running.

Come to think of it, you might want to include the hardware, and operating
system.

|
| So just make sure (in logical design, system architechture,
| well written easy-to-read code, proven algorithms, adequate
| domain and storage models and system documentation presence)
| that the fundamental ideas can move along.
|


 
Reply With Quote
 
Jacob
Guest
Posts: n/a
 
      08-04-2003
Harley wrote:


> | NOTHING will run 10 years from now!
>
> You might want to qualify this by language.


Just keep it as a rule of thumb. If something made today
runs 10 years from now it is either pure luck or a dead
slow organization. If you expect the world to go on, you
oraganize your software so it can go along.

The fact that 15 years old Cobol (or C or PL/1 or UniFace)
software is still out there is no *proof* that it has
outlived time. Maybe it's is just written in a way that
makes it impossible to move on.

 
Reply With Quote
 
Dario
Guest
Posts: n/a
 
      08-04-2003
Jacob wrote:
> James Cameron wrote:
>
>> Hi I'm developing a program and the client is worried about future
>> reuse of the code. Say 5, 10, 15 years down the road. This will be a
>> major factor in selecting the development language. Any comments on
>> past experience, research articles, comments on the matter would be
>> much appreciated. I suspect something like C would be the best based
>> on comments I received from the VB news group.

>
> NOTHING will run 10 years from now!


Ehm....

I have a lot of C programs that run perfectly
after more than 10 years!

E.g. see the following C programs that play Draughts
(Dama in italian) written on september 1989:
You can compile the original untouched C-source
(e.g. using gcc) and play it again immediately!

- Dario

#define linee_bianche (void)printf("\n\n");
#define odd(exp) ((exp)%2)

typedef int scacchiera[9][9];

struct mossa {
int a,b,a1,b1;
int valutatore;
};

static scacchiera s;


static
inizializza(s)
scacchiera s;
{
int r,c;

for (r=1; r<=8; r++)
for (c=1; c<=8; c++)
if (odd(r+c) || (r==4) || (r==5))
s[r][c] = 0;
else
{
if (r>=1 && r<=3)
s[r][c]= -1;
else
s[r][c] = 1;
}
}


static
read_2n(a,b)
int *a;
int *b;
{
char c;

*a = 0;
*b = 0;
do
if (1 != scanf("%c",&c))
c = '0';
while (c<'0' || c>'8');
*a = c-'0';
if (*a)
{
do
if (1 != scanf("%c",&c))
c = '0';
while (c<'0' || c>'8');
*b = c-'0';
if (*b == 0)
*a = 0;
}
}


static
posizione_in_scacchiera(r,c)
int r;
int c;
{
return (r >= 1) && (r <= && (c >= 1) && (c <= ;
}


static
muovi(s,r,c,r1,c1)
scacchiera s;
int r,c,r1,c1;
{
s[r1][c1] = s[r][c];
s[r][c] = 0;
if (abs(r1-r) == 2)
s[(r1+r)/2][(c1+c)/2] = 0;
if ( ((r1==1) && (s[r1][c1]== 1))
|| ((r1== && (s[r1][c1]==-1))
)
{
s[r1][c1] = s[r1][c1]*2;
(void)printf(" DAMA!\n");
}
}


static
leggi_mossa(s)
scacchiera s;
{
int casella_partenza_giusta;
int r,c;
int fine;

fine = 0;
casella_partenza_giusta = 0;
do
{
linee_bianche;
(void)printf(" DA? ");
read_2n(&r,&c);
if (posizione_in_scacchiera(r,c))
{
if (s[r][c] > 0)

leggi_posizione_arrivo(s,r,c,&casella_partenza_giu sta);
else
(void)printf(" POSIZIONE DI PARTENZA ERRATA.\n");
}
else
{
fine = 1;
linee_bianche;
(void)printf(" HAI ABBANDONATO E QUINDI HAI PERSO.\n");
}
}
while (!(casella_partenza_giusta || fine));
return fine;
}


static
leggi_posizione_arrivo(s,r,c,mossa_giusta)
scacchiera s;
int r,c;
int *mossa_giusta;
{
int r1,c1;

(void)printf(" A? ");
read_2n(&r1,&c1);
if (posizione_in_scacchiera(r1,c1))
{
if (mossa_corretta(s,r,c,r1,c1))
{
*mossa_giusta = 1;
muovi(s,r,c,r1,c1);
if (abs(r1-r) == 2)
leggi_altre_prese(s,r1,c1);
}
else
(void)printf(" MOSSA SCORRETTA.\n");
}
else
(void)printf(" RICOMINCIA DA CAPO.\n");
}


static
mossa_corretta(s,r,c,r1,c1)
scacchiera s;
int r,c,r1,c1;
{
int casella_arrivo_vuota, senso_giusto, presa_corretta;
int rr,cc;

casella_arrivo_vuota = s[r1][c1] == 0;
senso_giusto = (abs(r1-r)==abs(c1-c)) &&
(abs(s[r][c])==2 || (r1-r)*s[r][c] < 0);
rr = (r1+r)/2;
cc = (c1+c)/2;
if (abs(r1-r) == 2)
presa_corretta = (s[r][c]*s[rr][cc] < 0) &&
(abs(s[r][c]) >= abs(s[rr][cc]));
else
presa_corretta = abs(r1-r) == 1;
return casella_arrivo_vuota && senso_giusto && presa_corretta;
}


static
leggi_altre_prese(s,r,c)
scacchiera s;
int r,c;
{
int r1,c1;

do
{
(void)printf(" +A? ");
read_2n(&r1,&c1);
if (posizione_in_scacchiera(r1,c1))
{
if ((abs(r1-r)==2) && mossa_corretta(s,r,c,r1,c1))
{
muovi(s,r,c,r1,c1);
r = r1;
c = c1;
}
else
(void)printf(" PRESA SCORRETTA.\n");
}
}
while (posizione_in_scacchiera(r1,c1));
}


static
stampa_scacchiera(s)
scacchiera s;
{
int r,c;

linee_bianche;
(void)printf(" 1 2 3 4 5 6 7 8\n");
for (r=1; r<=8; r++)
{
(void)printf(" %1d ",r);
for (c=1; c<=8; c++)
switch (s[r][c])
{
case -2: (void)printf("DN"); break;
case -1: (void)printf("-N"); break;
case 0: if (odd(r+c))
(void)printf(" ");
else
(void)printf("--");
break;
case 1: (void)printf("-B"); break;
case 2: (void)printf("DB"); break;
}
(void)printf("\n");
}
}


static
elabora_mossa(s)
scacchiera s;
{
int r,c;
int fine;
struct mossa m;

fine = 0;
m.valutatore = -99;
for (r=1; r<=8; r++)
for (c=1; c<=8; c++)
if (s[r][c] < 0)
esamina_mossa(s,r,c,&m,0);
if (m.valutatore == -99)
{
fine = 1;
linee_bianche;
(void)printf(" HAI VINTO.\n");
}
else
{
/* (void)printf("%c",12); */
linee_bianche;
(void)printf(" DA %1d %1d\n",m.a,m.b);
do
{
(void)printf(" A %1d %1d\n",m.a1,m.b1);
muovi(s,m.a,m.b,m.a1,m.b1);
m.valutatore = -99;
if (abs(m.a1-m.a) == 2)
esamina_mossa(s,m.a1,m.b1,&m,1);
}
while(!( (m.valutatore == -99)
|| ( (m.valutatore <= 1
&& ( (m.a==1) || (m.a== || (m.b==1) || (m.b== )
)
));
}
return fine;
}


static
esamina_mossa(s,r,c,m,mangia_solamente)
scacchiera s;
int r,c;
struct mossa *m;
int mangia_solamente;
{
int r1,c1,dr,dc;

for (dr= -1; dr<=1; dr++)
for (dc= -1; dc<=1; dc++)
if ((dr!=0) && (dc!=0) && ((s[r][c]==-2) || (dr==1)))
{
r1 = r+dr;
c1 = c+dc;
if (posizione_in_scacchiera(r1,c1))
{
if ((s[r1][c1] == 0) && ! mangia_solamente)
valuta_mossa(s,r,c,r1,c1,m);
else
if ( (s[r1][c1] > 0)
&& (abs(s[r][c])>=
abs(s[r1][c1]))
)
{
r1 += dr;
c1 += dc;
if
(posizione_in_scacchiera(r1,c1))
if (s[r1][c1] == 0)

valuta_mossa(s,r,c,r1,c1,m);
}
}
}

}


static
valuta_mossa(s,r,c,r1,c1,m)
scacchiera s;
int r,c;
int r1,c1;
struct mossa *m;
{
int dr,dc,v;

if (r1>r)
dr = 1;
else
dr = -1;
v = 0;
if (r==1)
{
if (s[r][c] == -1)
v-= 8;
else
v-= 1;
}
if (dr ==- 1)
v+= 1;
if (s[r][c] == -1)
v+= 2;
if ((r== || (r==1))
v+= 4;
if (s[r][c]==-1 && r1==
v+= 8;
if (abs(r1-r)==2)
v+= 20;
else
if (presa(s,r,c))
v+= 6;
for (dc= -1; dc<=1 ; dc++)
if (dc!=0 && posizione_in_scacchiera(r1+dr,c1+dc))
{
if (s[r1+dr][c1+dc]<0)
v+= 4;
else
if (s[r1+dr][c1+dc]>0 &&
possibile_presa(s,r,c,r1,c1,dr,dc))
v-= 8;
}
if (v > m->valutatore)
{
m->valutatore = v;
m->a = r;
m->b = c;
m->a1 = r1;
m->b1 = c1;
}
}


static
possibile_presa(s,r,c,r1,c1,dr,dc)
scacchiera s;
int r,c,r1,c1,dr,dc;
{
int cas_davanti_vuota;
int cas_dietro_occupata;
int avversario_temibile;

if (posizione_in_scacchiera(r1-dr,c1-dc))
{
cas_davanti_vuota = (s[r1-dr][c1-dc]==0) ||
(r1-dr==r) && (c1-dc==c) ||
(r1-2*dr==r) && (c1-2*dc==c);
avversario_temibile = s[r1+dr][c1+dc] >= -s[r][c];
cas_dietro_occupata = 1;
if (abs(r1-r)==2 && posizione_in_scacchiera(r1+2*dr,c1+2*dc))
cas_dietro_occupata = s[r1+2*dr][c1+2*dc] != 0;
return cas_davanti_vuota && cas_dietro_occupata &&
avversario_temibile;
}
else
return 0;
}


static
presa(s,r,c)
scacchiera s;
int r,c;
{
int dr,dc;
int p;

p = 0;
if ( (r>=2) && (r<=7) && (c>=2) && (c<=7) )
for (dr= -1; dr<=1; dr++)
for (dc= -1; dc<=1; dc++)
if ( (s[r+dr][c+dc] > 0)
&& (s[r-dr][c-dc] == 0)
)
p = p || (dr==1) || (s[r+dr][c+dc]==2);
return p;
}


static
help()
{
(void)printf("Dama (c) 1987 - Dario Dariol\n");
(void)printf("\n");
(void)printf("Il computer (nero) gioca contro l'avversario (bianco)\n");
(void)printf("adottando le regole della Dama italiana.\n");
(void)printf("L'unica eccezione e' che le prese NON sono obbligatorie\n");
(void)printf("\n");
(void)printf("Le mosse vengono comunicate scrivendo riga e colonna\n");
(void)printf("della casella da cui si muove o su cui si arriva.\n");
(void)printf("Uno 0 significa abbandono e/o mossa scorretta.\n");
(void)printf("\n");
}


main()
{
help();
inizializza(s);
while(1)
{
stampa_scacchiera(s);
if (leggi_mossa(s))
break;
if (elabora_mossa(s))
break;
}
}


 
Reply With Quote
 
=?iso-8859-1?Q?Juli=E1n?= Albo
Guest
Posts: n/a
 
      08-04-2003
Dario escribió:

> E.g. see the following C programs that play Draughts
> (Dama in italian) written on september 1989:


(snip)

> help()
> {
> (void)printf("Dama (c) 1987 - Dario Dariol\n");


1989 or 1987?

Regards.
 
Reply With Quote
 
jce
Guest
Posts: n/a
 
      08-04-2003
"Jacob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Harley wrote:
> The fact that 15 years old Cobol (or C or PL/1 or UniFace)
> software is still out there is no *proof* that it has
> outlived time. Maybe it's is just written in a way that
> makes it impossible to move on.


Or that it works and has done what it was supposed to for 15 years.
That's like saying that everyone over 75 has outlived their time coz they're
not supposed to be that old.

JCE


 
Reply With Quote
 
jce
Guest
Posts: n/a
 
      08-04-2003
"Dario" <(E-Mail Removed)> wrote in message
news:bglt5q$o06$(E-Mail Removed)...
> > NOTHING will run 10 years from now!

> I have a lot of C programs that run perfectly
> after more than 10 years!

<code snipped>
I like the previous post that said to use english I don't think I can
follow this very easily.
JCE


 
Reply With Quote
 
jce
Guest
Posts: n/a
 
      08-04-2003
"Andy Fish" <(E-Mail Removed)> wrote in message
news:nDpXa.11704$(E-Mail Removed)...
> I would have to put my vote for java, simply because it's less
> hardware-dependent than the others.
>
> It's quite possible that JVM's in 10-15 years will be able to execute java
> code you build now (in the same way that office XP can still open up a

word
> 2 document). If the source got lost you could even have a reasonable go at
> decompiling it, which I would definitely not fancy with any of the binary
> formats.
>
> Andy

Not likely.

http://java.sun.com/products/jdk/1.2...atibilities1.2

If you link to 1.1 you get:

Products listed on this page have completed the Sun End of Life process.

None of the items listed though would send a development area into apoplexy


JCE


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To reuse or not to reuse jacob navia C Programming 19 12-18-2006 07:22 AM
code reuse and design reuse sailor.gu@gmail.com C Programming 16 02-12-2006 09:09 PM
Reuse paramter list and reuse connection tshad ASP .Net 5 05-17-2005 12:33 AM
To reuse or not to reuse.... Hylander Java 0 02-26-2004 12:00 AM
Future reuse of code James Cameron C++ 244 08-26-2003 07:39 PM



Advertisments