Old code Log Out | Lost Password? | Topics | Search
Contact | Register | My Profile | SO home | MOL home

M-SO Message Board » Technology & The Internet » Archive through March 29, 2005 » Old code « Previous Next »

  Thread Originator Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page          

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

D.
Moderator
Username: Dave

Post Number: 5550
Registered: 4-1998


Posted on Friday, March 11, 2005 - 8:03 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

What's the oldest programming code you have access to? I learned Fortran at CHS in '82 and it looked like this.

 
C This program demonstates a while loop

C declerations
integer number, i
C something new, set a value to one of the numbers
i = 1

C main
print *,'Enter an integer, less than -100 to exit'
read *,number

while (number.gt.-100) do
print*,'THis is in a while loop'
print*,i
i = i + 1
print *,'enter an integer, less than -100 to exit'
read *,number
endwhile
print *,'Now you are out of the while loop.'
end
Top of pagePrevious messageNext messageBottom of page Link to this message

sac
Supporter
Username: Sac

Post Number: 1900
Registered: 5-2001
Posted on Friday, March 11, 2005 - 8:15 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

If I dig, I might be able to find some Fortran I wrote in the late 70s when I was in college. However, I'm sure that there is lots older code than that lying around somewhere.

Your code is actually pretty nicely structured ... a characteristic that was not always prevalent in early programming. Classic (not necessarily pretty) code wouldn't have while loops and probably would have GOTOs in strong evidence. In fact, I don't recall Fortran even having a "WHILE" construct when I learned it.

I know that I'm showing my age here but actually, when I first went to work in computing, I was one of the young ones and there were some old guys (yes, mostly guys) around who had been coding for well over a decade.
Top of pagePrevious messageNext messageBottom of page Link to this message

Brett
Citizen
Username: Bmalibashksa

Post Number: 1520
Registered: 7-2003
Posted on Friday, March 11, 2005 - 8:20 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Well Basic of course
10 ? "Hi Dave"
20 goto 10

I learned Pascal in ‘88
Program prog1(input,output);
Uses Wincrt;

Var
answer : integer; { }

Begin
writeln('Hello World, are you happy today? Ans 1 for yes, 2 for no');
readln(answer);

if(answer=1) then
writeln('That''s good, carry on having a good day')
else
writeln('Well, cheer up');
End.
Top of pagePrevious messageNext messageBottom of page Link to this message

ken (the other one)
Citizen
Username: Ken

Post Number: 241
Registered: 5-2001


Posted on Friday, March 11, 2005 - 10:06 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

I learned machine language in HS in the 70's, like 59 is add, if I remember correctly...
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5809
Registered: 1-2003


Posted on Friday, March 11, 2005 - 12:35 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

I don't have any code I wrote before about 1992 or 1995.

In college, I was an IBM mainframe JCL hacker!

I programmed in Fortran, PL/1, and 360 Assembler on the mainframe. Then we got PC's, and I learned Pascal. I heard COBOL was for losers, so I avoided it.
Top of pagePrevious messageNext messageBottom of page Link to this message

sac
Supporter
Username: Sac

Post Number: 1905
Registered: 5-2001
Posted on Friday, March 11, 2005 - 12:45 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

COBOL really isn't (wasn't) that much different from PL/I and Fortran. I learned Fortran and PL/I in college and then got to my first job and found out they were using COBOL. After my initial chagrin (similar reaction to your statement) wore off, I found out that it was just more of the same for the most part.
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5810
Registered: 1-2003


Posted on Friday, March 11, 2005 - 12:53 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

How do I post in a fixed-width font? I just found code of mine from 1991.

sac, it's not the language itself. Lots of jobs that required COBOL sounded like they just weren't my speed.

But some aspects of COBOL seem downright silly. Like the identification division. Why do you have to write your name and your object computer before the code will even compile?
Top of pagePrevious messageNext messageBottom of page Link to this message

susan1014
Supporter
Username: Susan1014

Post Number: 447
Registered: 3-2002
Posted on Friday, March 11, 2005 - 12:56 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

You should have asked this question before I cleaned out my father's storage locker. He learned programming on UNIVAC #2, in the basement of the Pentagon, in the late 50s, early 60s.

I don't think that he kept anything that old, but we threw out our fair share of old code binders, and even a few boxes of punched cards (one of the favorite craft materials of my childhood...).
Top of pagePrevious messageNext messageBottom of page Link to this message

sac
Supporter
Username: Sac

Post Number: 1907
Registered: 5-2001
Posted on Friday, March 11, 2005 - 1:27 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Re identification division - You're right ... but hey, you only do it once (if ever) because from then on you just copy one that you (or someone else) did before. I think that we might even have had something that did it for you where I worked, although I really don't remember for sure. I know it never really got in my way.

If you worked on any kind of business or financial information systems in the early 1980s, it was pretty hard to avoid COBOL. At least, that was my experience.
Top of pagePrevious messageNext messageBottom of page Link to this message

D.
Moderator
Username: Dave

Post Number: 5557
Registered: 4-1998


Posted on Friday, March 11, 2005 - 1:28 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Tom,
Just use \ pre {xxxxx}

(no spaces though)
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5813
Registered: 1-2003


Posted on Friday, March 11, 2005 - 1:53 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Here's my program from 1991 to calculate loan payments. I still use it!

 
#include <stdio.h>
#include <math.h>

main(argc, argv)
int argc;
char *argv[];
{
float months, amount, rf, payments;

if (argc != 4) {
fprintf(stderr, "usage: %s amount rate months\n", argv[0]);
exit(1);
 
amount = atof(argv[1]);
rf = atof(argv[2]) / 1200;
months = atof(argv[3]);
payments = amount * (rf / (1 - (1 / (pow((1 + rf), months)))));
printf("%1.2f\n", payments);

}
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5815
Registered: 1-2003


Posted on Friday, March 11, 2005 - 2:04 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Here's a quiz. What does this program do? Ignore the fixed size buffer and the possibility of overflow.

 
#include <stdio.h>

main()
{
char line[1024];
if (gets(line) != NULL) {
main(); /* Look! Recursion! */
puts(line);

}
Top of pagePrevious messageNext messageBottom of page Link to this message

magmasystems
Citizen
Username: Magmasystems

Post Number: 296
Registered: 1-2002
Posted on Friday, March 11, 2005 - 7:01 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Well, it won't compile.... the braces don't match
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5829
Registered: 1-2003


Posted on Friday, March 11, 2005 - 9:47 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Oops. That's because it's hard to post code here. Add a closing brace. But try reading it before running it.
Top of pagePrevious messageNext messageBottom of page Link to this message

stefano
Citizen
Username: Stefano

Post Number: 430
Registered: 2-2002


Posted on Friday, March 11, 2005 - 10:07 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Your code launches submarine-based nuclear warheads targetting Vanuatu.
Top of pagePrevious messageNext messageBottom of page Link to this message

magmasystems
Citizen
Username: Magmasystems

Post Number: 298
Registered: 1-2002
Posted on Saturday, March 12, 2005 - 6:17 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

I did not try to run it... I thought that it was a trick question because of the missing brace.

But, let's see... You are going to wait for the user to input a line from stdin (the console). When the user inputs the line, you will call main() again. This will gobble up 1024 bytes of stack space and wait for the user to input a line again. So, I would say that eventually, you will get a stack overflow (I am assuming that the compiler is emitting stack checking logic at the beginning of each function, as most old C compilers did).

So, in my best guess, eventaully, this program will print out a stack overflow message.
Top of pagePrevious messageNext messageBottom of page Link to this message

magmasystems
Citizen
Username: Magmasystems

Post Number: 299
Registered: 1-2002
Posted on Saturday, March 12, 2005 - 6:19 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

As a follup, I forget if gets() returns NULL if you just hit the ENTER key without typing any characters. If it does, then as soon as you enter a blank line, then all of your previous output should appear on the screen, with the last line entered displayed first.
Top of pagePrevious messageNext messageBottom of page Link to this message

LibraryLady(ncjanow)
Supporter
Username: Librarylady

Post Number: 2294
Registered: 5-2001


Posted on Saturday, March 12, 2005 - 9:36 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

This is Mr. LibraryLady (Rich).

I learned to program in Fortran in the mid-1960s on a protoype compiler called "MAD". The machine was an IBM 7040, I think. I also learned a bit of PDP 8 assembler. Threre were no disks in those days. Tape drives made the computer room exciting, since they had to grind back and forth for "large" programs (> 32K)with lots of blinking lights.

Later, from 1977 to 1983, I wrote GIS systems in a languge called FORTH. That was the most creative environment ever. FORTH was a threaded code interpreter. There was no separate compilation and linking phase. Recursion was easy, and the programming environment presented a user stack, a return stack, and an hierarchical memory resident dictionary for "compiled" code. You could very easily build a set of modular keyboard commands tailored to your application. Variable typing was up to the user, as it should be. Powerful programs would require maybe 5% of the code needed in C++.

In the late 80's and 90's I used C, but I always saw it as somewhat FORTRANish compared with Forth. Nevertheless, you could write recursive, self-modifying code if you wanted to.

C++ was created to make SW managers feel more comfortable - like COBOL. I found it ponderous and bureaucratic. But maybe I'm just becoming a curmudgeon....
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5842
Registered: 1-2003


Posted on Monday, March 14, 2005 - 10:07 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

magmasystems, you're right. It reverses input to output. Remember, it can do this non-interactively, so if (for example you are using unix), you can take a file that looks like

a
b
c

and turn it into a file that looks like

c
b
a

simply with

myprogram <infile> outfile.

Not that it's an efficient way to do it in the least bit. But it's fun to ponder the simplicity of the expression.
Top of pagePrevious messageNext messageBottom of page Link to this message

Cathy
Supporter
Username: Clkelley

Post Number: 808
Registered: 6-2002
Posted on Monday, March 14, 2005 - 10:47 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

I wrote a Basic program (with the line numbers) to calculate biorhythms when I was a freshman in college - so it was either fall 1979 or spring 1980. I don't have the code any more though.

It worked pretty well and was really fun to write. It output three sine-wave graphs (on paper of course) with a little "x" on where you are on each of your "cycles" (which are I think intellect, physical, and emotional - anybody remember?). By "worked pretty well" I mean it worked as expected - I did not then nor do I now believe in biorhythms!

I haven't done any programming for a long time though. I've never taken a class, I'm entirely self-taught. (my husband is a CS prof and has given me books to read, pointers, etc. - and swears that I did more coding for my psych Ph.D. than most CS Ph.D.s he knew about.) I miss it a bit - it is (or can be) very creative work - but not enough to change occupation.
Top of pagePrevious messageNext messageBottom of page Link to this message

sac
Supporter
Username: Sac

Post Number: 1930
Registered: 5-2001
Posted on Monday, March 14, 2005 - 3:13 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Trust me, it is not an occupation to which you want to change at this point ... that is, unless you want to work for $10 per hour in India or similar.
Top of pagePrevious messageNext messageBottom of page Link to this message

Cathy
Supporter
Username: Clkelley

Post Number: 811
Registered: 6-2002
Posted on Monday, March 14, 2005 - 3:57 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Horrors - not an occupation I ever aspired to!! But some of my former jobs required a little bit of coding for a project here and there. Fun stuff, easier & cheaper to do in-house than to farm out. I did enjoy this sort of thing. Now I'm the boss of people who do this. :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

woodstock
Supporter
Username: Woodstock

Post Number: 929
Registered: 9-2002


Posted on Monday, March 14, 2005 - 11:06 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

In 1983 I wrote a couple of thousand line program that plays D&D (well, let's you play D&D), complete with dice rolls, random monsters, and random rooms. It was a summer school project, written in APL. I have a printout of the code lying around somewhere. I keep telling myself I'll find it and scan it in one day. By far the most complex programming I've ever done.
Top of pagePrevious messageNext messageBottom of page Link to this message

Mark Fuhrman
Citizen
Username: Mfpark

Post Number: 1416
Registered: 9-2001


Posted on Tuesday, March 15, 2005 - 7:30 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

In high school in 1976 I was lucky enough to work on a large IBM mainframe at Technion University in Haifa--at that time, one of the more powerful computers available to civilians outside of MIT. We lived on punchcards and late night coffee trying to learn COBOL fast enough to write a program to solve a complex math problem--part of a challenge from our teachers. None of us had ever worked with punch cards before, and we experienced first hand the joys of bent card edges, dangling chads, and dropping a stack of cards on the way to the compiler. One kid started a program late one night then left to go to sleep, only later to find he had left out the "end" to a "do" loop. He ran our entire class account to zero overnight (back then access was so expensive that we were all allocated small budgets to use the computer, and we were supposed to watch it like a hawk). The University had to intervene and pay up from a special slush fund so we could continue our programming classwork.

After that, is it any wonder I never got into programming! Ran as fast as I could to the world of social sciences, where the worst trouble I could get into was with SPSS and Minitab, which were already compiled and impervious to my sloppy code-writing tendencies and impulse to take disastrous shortcuts. I still try to do some "programming" in Excel using macros, and that is as close as I will get again. It takes a special intelligence or world view to be a good programmer, but I sure appreciate the creativity and elegance of a well-written piece of code.
Top of pagePrevious messageNext messageBottom of page Link to this message

Rick B
Citizen
Username: Ruck1977

Post Number: 506
Registered: 8-2003
Posted on Tuesday, March 15, 2005 - 10:36 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

you guys are old... lol! {just kidding of course, you are all just highly experienced}


C++ was created to make SW managers feel more comfortable - like COBOL. I found it ponderous and bureaucratic. But maybe I'm just becoming a curmudgeon....

C++ is an extremely powerful language. SW managers could not even begin to understand its power. Sure, for writing simple code, its pretty readable, but object oriented programming and advanced inheritance characteristics make it top notch in my book baby! I wish i had more time to use it! :-)

Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5856
Registered: 1-2003


Posted on Tuesday, March 15, 2005 - 10:43 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Yes, I take issue with that statement about C++, too, and I haven't even programmed in it. The reason I doubt it's true is that the statement is not consistent with the Bell Labs culture. C++ was invented at Bell Labs, and I worked there for many years.

COBOL was, however, written with managers in mind. The goal was to make the code legible to non-technical managers of the people who wrote the code.
Top of pagePrevious messageNext messageBottom of page Link to this message

sac
Supporter
Username: Sac

Post Number: 1933
Registered: 5-2001
Posted on Tuesday, March 15, 2005 - 3:10 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

If that was the goal, it failed miserably.
Top of pagePrevious messageNext messageBottom of page Link to this message

LibraryLady(ncjanow)
Supporter
Username: Librarylady

Post Number: 2308
Registered: 5-2001


Posted on Tuesday, March 15, 2005 - 9:59 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Tom:

I worked at Bell Labs for 18 years. Both C and C++ were invented at Bell Labs. I remember Stroustrup's orignal memo on C++ entitled "Programming with Coroutines" or something similar. It was utterly incomprehensible.

Nevertheless, the attraction of C++ was that it is a strongly typed language, meaning you have to
declare every variable, as in FORTRAN but without
an built in or implicit type convention.
In C, you use "struct's" to define data structures and give them inheritance properties too if I am not mistaken. I took a C++ course while at BTL but never used it in any projects.

If I'm not mistaken, Windows is written in C++. Maybe that is why it is so bloated and out-of-control. C++ promises all the usual good things like object orientation, code reusability,programmer productivity, and the like but given the outrageous size of contemporary programs it does not deliver, and every programmer writes his own support anyway.

If I'm correct, there is also no way to write recursive programs in C++ - you have to write them in C and merge to the C++ modules during link/loading. I had to write a command interpreter one time in C++ but soon had to switch over to C.

Nevertheless, C++ is the dominant language now, and a generation has known nothing else. Programming used to be a creative endeavor, but for the past 15 years or so the fun and crativity has gone out of it.

Rich Janow (Mr. Liblady)
Top of pagePrevious messageNext messageBottom of page Link to this message

bets
Supporter
Username: Bets

Post Number: 1047
Registered: 6-2001


Posted on Tuesday, March 15, 2005 - 10:09 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)


quote:

and a generation has known nothing else.



Very true statement, considering that freshmen who will enter college this year were born (on average) in 1987.

Top of pagePrevious messageNext messageBottom of page Link to this message

magmasystems
Citizen
Username: Magmasystems

Post Number: 301
Registered: 1-2002
Posted on Wednesday, March 16, 2005 - 7:57 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

> If I'm not mistaken, Windows is written in C++.

Windows was written in a combination of C and highly-optimized assembly language. When Microsoft decided to write Windows NT (from the ground up), they used C++.

> If I'm correct, there is also no way to write recursive programs in C++

Of course you can write recursive programs in C++. Why wouldn't you be able to? You can write recursive programs in every modern object-oriented language.

> Nevertheless, C++ is the dominant language now, and a generation has known nothing else.

Substitute the word Java for C++. Witness the Advanced Placement compsci classes.. they switched over to Java from C++ one or two years ago. The only place where I see C++ job requirements is for legacy Unix-based systems. C# is catching on.
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5874
Registered: 1-2003


Posted on Wednesday, March 16, 2005 - 9:53 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Rich,

I wouldn't and can't defend C++. I never used it. It sounded like a bear to use. I've heard praises for it and also lots of harsh criticism. The latter made more sense to me, but that's all I know. I just don't think it Stroustrup invented it to make managers happy. The goal, as I understand it, was to enable the programmer to write reusable (and thus sharable) code. My understanding is that he ended up making that harder.
Top of pagePrevious messageNext messageBottom of page Link to this message

kmk
Supporter
Username: Kmk

Post Number: 496
Registered: 5-2001
Posted on Sunday, March 20, 2005 - 2:27 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

My dad worked for TI for almost 40 years. I saw all sorts of experiments with silicon wafers that would come home. "We managed to get 40 circuits on this one!" he would say holding up a 6" diameter shiny disc.

What was the "code" used to program those TI calculators in the 70's that you would shove a yellow magnetic stick into to "play" games like lunar lander?

The little red lights for numbers were so space age and he actually looked like he thought it was fun to play!

Later at UT in 1980 almost every engineering student could be seen walking around campus with their stack of punched COBOL cards.
Top of pagePrevious messageNext messageBottom of page Link to this message

LibraryLady(ncjanow)
Supporter
Username: Librarylady

Post Number: 2326
Registered: 5-2001


Posted on Sunday, March 20, 2005 - 6:54 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Magmasystems:

Almost all financial and other modeling applications call for C++, sometimes Perl.

Java is an interpretive language that is a subset of C or C++, if I recall.

You may be right about Windows/XP not having much application work for C++. Those systems are in effect almost completely pre-programmed. But Linux/Unix is very much with us for real programming, despite the fact that Unix is 30 years old and still not real user friendly. I see that as a testimony to the massive damage done by microsoft's brain dead monopoly on computing.

Tom: I didn't think Stroustrup wrote C++ to make managers happy. But it was sold to managers as a way of quelling their worst fears: a key programmer leaves and it takes 5 years for a replacement to understand and maintain his code ( a task no self-respecting programmer would do). So the only practical tactic is to let the next guy rewrite everything.

Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5925
Registered: 1-2003


Posted on Monday, March 21, 2005 - 12:09 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

Rich,

Thanks for the clarification about the history of C++. It makes a lot of sense.

But you are incorrect about java. It is not a subset of C or C++, and it is not interpreted, either. It is compiled into byte-code, so it's sort of in between interpreted and compiled.

Topics | Last Day | Last Week | Tree View | Search | User List | Help/Instructions | Credits Administration