[Sussex] Simple OOP tutorial

Geoff Teale gteale at cmedltd.com
Fri Aug 27 14:05:13 UTC 2004


>Thanks to NIk and Geoff the their informative postings.

Anytime..

>I'm an old lag when it comes to programming.  What do I mean by that? 
>Well, it's my 59th birhtday today and I started programming in 1970.

;)  Things have changed somewhat, ne pas?  Actually OOP is routed in
 the AI research going on at places like MIT's AI Lab in the 1960's -
 also the spiritual root of the Free Software movement.  

The first real OO language was, IIRC, Simula, which was developed by
the Swedish(?) telephone company to develop apps that simulate and manage their
telephone system.  That was in the early '70's. 

I started programming in 1983.. I was 6.  I didn't come across OOP
until I did SAS C++ stuff on Amiga's when I was a teenager.  I didn't
really get it until Uni some years later.

>I am also a bit of a laggard when it comes to programming.  I devised ways
>to write code that was robust and easy to maintain before I had ever heard
>of OOP and one of the systems "what I wrote" in 1985 has only just been
>moth-balled and that was a result of change of ownership of the company. 
>Now, I admit that in a modern and much much technically demanding
>programming environment these techniques might not be as applicable as
>they were then; but they worked equally well for me in Assembler, PL/I,
>COBOL and C.

...really?  The differences between COBOL and C and then again between C and
Assembly are really quite large.  That said good programming techniques
can be language agnostic. 

>After a few years of not programming when I stupidly let it slip because
>people told me that you can't do "that" all your life, I have been lucky
>enough to land a full scale new software system to build from the ground
>up on my own.  In the intervening time I have dabbled with VB (which I
>liked at first but liked less and less as I continued to use it and found
>things that just didn;t work), C using a few ++ benefits to an extremely
>limited extent, PERL which I thought was great but only played enough to
>write a generic table maintenance screen for PostgreSQL databases, still
>learning bash and, then finally, I had to learn PHP because I wanted to
>write some plugins to SquirrelMail.

OK...

>So when I came to looking for tools to write this new system with I
>thought "OOP, that's got to be the way to go, let's take a look at Java". 
>The web pages said it was very quick to learn and easy to use, so I
>started on the tutorial "looks great" I thought; until I got about chapter
>3 or 4 and started to think "this is going to take me months to learn, I'm
>going to have to find something else".

Well, Java is pretty big.  It's actually a good tool for the sort of
stuff described below, it just isn't the be all and end all of OO as a
lot of it's fans seem to think.

>My application has to have a Windows-style GUI (like VB or whatever), has
>to run an SQL database and has to be able to run client-server over a wide
>area network.  Just what M$ are punting .NET to do; and, oh yes, it has to
>be cross-platform (because I say so) and there is no way I would consider
>anything that has anything to do with .NET, even if I could be persuaded
>that it is cross-platform in the sense that I mean.

I would have plumped for (in order):

 - Ruby or Python + (a portable toolkit)
 - Java
 - Smalltalk
 - C# / VB.NET
 - C++

> I actually had a go at doing something with just HTML and JavaScript and
>almost got listboxes with dynamic partial-key matching to work before I
>realised that I was flogging a dead horse.

All experience is useful.

>And then, as if by chance, I stumbled (again) on Mozilla XUL.  With some
>trepidation I started out with my "must have" element - the partial-key
>matching listbox; XUL almost does this the way I want it "out of the box"
>and I could probably persuade someone to change it to suit my needs
>completely; but, no matter, it was easy enough to do it with a little bit
>of my own JavaScript.  Add to this PHP and PostgreSQL on the server-side
>and I can't see why Microsoft have made such a fuss about .NET and who
>needs it anyway?

Well, Mozill XUL is great.  W3C XForms are schweeeeet too. .NET is a
whole different thing though - much more in the Java mold, and the
reason no-one really has a handle on what .NET is all about is that
it's like Java - it's a lot of hype that boils down to:

 - portable runtime,
 - JIT compiling
 - Eye candy IDE's

.. the main selling point of all these technologies:

 - It's easier than C++
 - People don't mock you like they do VB developers

>Oh yes, OOP.  Well, I thought about it and I have written classes for all
>the data tables but beyond that it's beyond me.  And, bliss of bliss,
>those old techniques that I thought out 30 years ago work just as well
>with JavaScript and PHP!  

Good programming, is a state of mind perhaps..

>Well, actually not quite all of them because one
>of my major triumphs was to devise a style of programming using GO TO that
>was robust, maintainable and completely bullet-proof providing that you
>followed a very simple set of rules; I also managed to get rid of all
>those tiresome AND, OR and parentheses in IF statements; which just goes
>to show what a grounding in Assembler can do for you.

GOTO ???  *splutter*

Tony Austin considered harmful... now routing around him..

>So, a few months down the road I have 27 (small) client programs that have
>run over wide-area from the start, updating an SQL database and have a
>reasonable GUI.  Oh, and one more thing, it's an M$DOS system that I am
>replacing and they (sensibly) want it all to be able to be operated very
>simply without the mouse if the choose (I think of it as "expert" mode),
>XUL does this easily.

Sounds good.  Glad your not let loose with GOTO...

-- 
Geoff Teale




More information about the Sussex mailing list