Future reuse of code

J

James Cameron

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
 
H

Harald Hein

James Cameron said:
I'm developing a program and the client is worried about future
reuse of the code. Say 5, 10, 15 years down the road.

Tell your customer a lie. No one can predict 5 years, let alone 15 into
the future in this business. If your client asks, he doesn't have much
clue and will be happy with any answer.
 
A

A Bag Of Memes

James Cameron said:
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

Why would language choice affect code reuse? You can reuse code written in
any language as long as you care to.
 
M

Malcolm

James Cameron said:
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.
Your best bet is conservative C89.

Why not C++? Because the standard template library is only a few years old.
Things might have changed out of recognition in 15 years time. You will
stillbe able to compile the code, probably, but it will be difficult to
maintain.

C99 may never be implemented.

Java COBOL and Visual Basic I know little about. VB is unstable, COBOL is
virtually obsolete. Java might be an OK choice but is rather tied to the
net. A C file, OTOH, will almost certainly be linkable in ten years time.
 
J

John D.

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.

The best language to ensure future reuse of the code is english.
Whatever programming language you chose always remember to document
your code.
 
D

Donald Tees

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

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

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.

Pete.

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
 
L

LX-i

James Cameron wrote:
^^^^^^^^^^^^^
You're a great filmmaker - why are you switching to programming? :)
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

(I'm a regular poster in comp.lang.cobol)

You really need to have them define what they mean by "code reuse". In
general, if the design of the system is done using components, this
really doesn't have to be an issue. A component could be written in any
number of languages, as long as it adheres to a standard interface (such
as COM).

And, 5 to 15 years down the road, what are they going to be "reusing"?
Seems to me, if they're interested in reuse, they'd use whatever
language you use on this project. At that point, the only decision you
need to make is, what language best supports the business logic you're
trying to automate?

Once you make this decision, structure the system in such a way that it
resembles a collection of building blocks (whether it's broken out by
component, by a collection of common subroutines, copybooks/macros,
whatever). Then, using your rationale for your language choice, and the
modularity design you've chosen, formulate a point paper for your client
detailing why the language you've chosen is the best for their needs,
and how you're posturing them for future code reuse.

Personally, I work on a large aircraft maintenance program for a major
military branch ;) . The system is written in COBOL, and we mostly use
copybooks (similar to macros in C) for our reuse. Each copybook has
comments that define the input parameters expected, and the output one
can expect from it. That way, if the process changes, we change the
copybook. The disadvantage to this technique is that it requires each
program that copies it to be recompiled (rebuilt).

I'm working on a few initiatives to convert this to common subroutines,
that can be modified and "switched out" without having to modify the
underlying programs. This is showing a lot of promise, and I know that
there are other regular posters here who have not only done this
successfully, but have also utilized C, VB, C++, even .NET classes and
components from within COBOL.

Of course, the bottom line - decide what language would be best, then
convince your client of your genius. :)


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ AIM: LXi0007 ~
~ _____ / \ | ~ E-mail: (e-mail address removed) ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ I do not read e-mail at the above address ~
~ Please post if you wish to be contacted privately ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
L

LX-i

Malcolm said:
Java COBOL and Visual Basic I know little about. VB is unstable, COBOL is
virtually obsolete.

What? COBOL is obsolete? I guess OO and .NET are obsolete too... ;)


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ AIM: LXi0007 ~
~ _____ / \ | ~ E-mail: (e-mail address removed) ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ I do not read e-mail at the above address ~
~ Please post if you wish to be contacted privately ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
H

Harley

|
|
| > 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.
| >
| Java COBOL and Visual Basic I know little about. VB is unstable, COBOL is
| virtually obsolete.

COBOL ain't dead yet.
It has a history, and some code that surpasses the 15 year reusability
requirement.
 
?

=?ISO-8859-1?Q?Thomas_Gagn=E9?=

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

=?ISO-8859-1?Q?Thomas_Gagn=E9?=

Peter said:
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.
 
J

jce

James Cameron said:
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?)
 
H

Harley

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

Jacob

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

Dario

Jacob said:
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 <= 8) && (c >= 1) && (c <= 8);
}


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==8) && (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_giusta);
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 <= 18)
&& ( (m.a==1) || (m.a==8) || (m.b==1) || (m.b==8) )
)
));
}
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==8) || (r==1))
v+= 4;
if (s[r][c]==-1 && r1==8)
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;
}
}
 
?

=?iso-8859-1?Q?Juli=E1n?= Albo

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

jce

Jacob said:
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
 
J

jce

Dario said:
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
 
J

jce

Andy Fish said:
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/compatibility.html#incompatibilities1.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top