Shop OBEX P1 Docs P2 Docs Learn Events
Old-school programming techniques you probably don't miss — Parallax Forums

Old-school programming techniques you probably don't miss

heaterheater Posts: 3,370
edited 2011-07-29 15:53 in Propeller 1
Just a heads up to a nice article describing "obsolete" programming techniques for the young'ns.

www.computerworld.com/action/article.do?command=viewArticleBasic&taxonomyName=Development&articleId=9132061&taxonomyId=11&pageNumber=1

To quote:

"11 skills and tactics that every programmer once needed to master ... and today can blissfully forget"

Amusing because us Propeller Heads HAVE to use all of those techniques all the time and we love it[noparse]:)[/noparse]

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
«1

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-04-30 07:27
    That is a great read. And of course like you say, almost all those things are still highly relevant for microcontrollers today, eg propeller, picaxe, arduino.

    I've got my own handcoded shellsort doing great service every day, and it is still *much* faster than dropping the data into any of the .net supplied methods. It uses GOTO and the writer made no apologies for that - as he says, it simply works faster that way.

    My 13 year old son recently asked me for some tips on getting started on programming. And I started by showing him .net, but it all got too complicated to explain. It was easier to go back to the simpler languages and start from there. A bit like the way Physics is taught in schools, you start with what people knew in 1850, and then you build on it one decade at a time. It makes more sense that way.

    Writing machine code and computer code the 'old skool' way is good brain exercise, a bit like doing crosswords (but more productive!). And exercising the brain is a good way to stave off dementia!

    Post Edited (Dr_Acula (James Moxham)) : 4/30/2009 7:33:07 AM GMT
  • RossHRossH Posts: 5,519
    edited 2009-04-30 07:45
    Thanks heater - that was hilarious.

    I nearly choked on my coffee when I read how C++ had "eliminated the need for structured programming"!

    I'm guessing that this article was originally intended for publication on April 1, but that some young sub-editor failed to see the joke.

    Ross.
  • AleAle Posts: 2,363
    edited 2009-04-30 08:36
    We assembler programmers love goto, there is nothing better than to jump to the middle of a routine to reuse some code. The small memory of the prop brings all those not-so-recommended-but-neat-and-widely-use-techniques again. I love it.
    self-modifying code ? check !
    goto all over the place ? check !
    spaghetti ? and also penne, rigatoni usw. ? check !
    no stack ? check !
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-04-30 09:21
    Oops - better stop using i,j,k smile.gif
    And I am still a night owl from computer access midnight till dawn.
    Do you know how any programmers were around at 2am on a Sunday morning when the nightclub next door caught fire smile.gif
    And I remember issuing patches on the 29th Feb 1976 to customers over the phone because the computer would not accept the 29th (not my code thankfully)

    While I am at it, look at the·ICL System Ten Instruction set and 20 CPU's (hardware timeslicing)·http://members.iinet.net.au/~daveb/Sys-10.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

    Post Edited (Cluso99) : 4/30/2009 9:34:16 AM GMT
  • heaterheater Posts: 3,370
    edited 2009-04-30 09:55
    DR_A, Why don't you just show your son a Prop Demo board the Spin tool and some LEDS ? Simple to get started programming in Spin, instant gratification with the LEDS. Move up to something that moves with some servos maybe. There is nothing like that combination of abstract software and concrete reality to make connections in the brain and provide motivation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-04-30 10:39
    I might just do that, heater [noparse]:)[/noparse]
  • heaterheater Posts: 3,370
    edited 2009-04-30 10:48
    Yep Dr_A, That's why those old time Commadores and Sinclairs etc were so brilliant, turn it on, immediately start typing some BASIC, bingo something happens on the screen. You could get some tiny thing working without having to learn a whole language / frame work first. Take it one line at a time.

    I was reminded of this recently trying to write some simple app using the Qt library. Qt is great but you need to know a lot about C++ first, then you need to write a whole class or classes to get "Hello World" up. No one liners here. Not to mention the fuss with make files and qmake for Qt etc etc etc.

    The Prop and Prop tool seem to be the about nearest we have to that now a days. I think it's a sin that all those millions of game consoles sold don't have even the rudimentary programmability for their owners of a ZX81.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-30 17:28
    I've still got the I-through-N-is-integer habit developed from Fortran and reinforced through QuickBASIC (DEFINT I-N). Some things never change.

    -Phil
  • SRLMSRLM Posts: 5,045
    edited 2009-04-30 18:18
    Huh. I'm currently in college as a CS major, and we're learning all those things! I don't know: are they out of touch with the real world, or are my professors the ones that are out of touch?
  • hippyhippy Posts: 1,981
    edited 2009-04-30 20:03
    I suppose it's no different to people who eat ready-meals and don't have a clue as to how
    to make the same from first principles. Even those who can cook probably don't have much
    of an inkling when it comes to making their own cooking utensils form a pile of ore.

    It's all a matter of needing to know something or other so I can understand that coders these
    days would call Sort() rather than wondering about the intricacies of how to roll their own. I
    do the same when using MSComm32 in VB, or using the TV Driver in Spin smile.gif

    That "I" for integer / control loop indexing is so ingrained in I get confused if I see it used
    for anything else !
  • Carl HayesCarl Hayes Posts: 841
    edited 2009-04-30 21:31
    Edsger Dijkstra was a Quiche Eater.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • RossHRossH Posts: 5,519
    edited 2009-04-30 22:54
    Hi SRLM,

    No, your professors are not out of touch - they are teaching you fundamental things you will need to understand (or at least be aware of) to be something more than just another code monkey (http://en.wikipedia.org/wiki/Code_monkey).

    Maybe not very interesting, and certainly not very sexy - but necessary.

    Ross.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-30 23:26
    hippy, you still use mscomm32? What a pile of suck. Years ago I got PO'ed when it refused to run on a customer's computer in the VB IDE (he had Standard instead of Pro edition, so the control was only registered to work in run not development mode) and I figured out how to control the serial ports straight to the API in VB4 up. It doesn't require threading and works well, though it doesn't work in the 16 bit core OS's (Win95, 98, ME). Much less buggy and more reliable than mscomm. Email me if you want the VB6 source code.

    Remembering the experience, I did the same thing for TCP when I got into that. Most of my VB apps run without running an installer because their only dependency is the VB6 runtime, which has been on every XP-up box I've ever seen out of the box.

    Of course, this only reinforces your point about being able to move beneath the hood...
  • SSteveSSteve Posts: 808
    edited 2009-04-30 23:30
    It's funny they should mention the Sorting and Searching volume of The Art of Computer Programming. I'm in the middle of reading it right now! In my spare time I'm rewriting the MIX programs in MMIX. Studying the MMIX architecture makes me sad the 8088 descendants won out over the 68000 descendants. Happily (but not surprisingly) the Propeller is architecturally closer to MMIX than to the i386.

    I definitely don't miss Hungarian notation. I always refused to use it.

    They can complain about "Enter 1 to Add Records, 2 to Edit Records, 3 to Delete Records" all they want, but at my wife's vet practice we still use archaic software with that kind of interface and our employees can fly on that software. If we brought in a mouse-based system their productivity would plummet. If someone is using a program eight hours a day it should be 100% keyboard-based.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    links:
    My band's website
    Our album on the iTunes Music Store
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-05-01 00:25
    SSteve: You are spot-on with the keyboard interface for speed. Unfortunately todays decision makers don't appreciate operator speed. And also the 68000 architecture vs 80x86 Smile.

    localroger: I'd love a copy. I gave up with VBnet and still use VB6 with mscomm. cluso@bluemagic.biz

    hippy: Nice to see you still lurking about.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-01 01:01
    I got in the habit of using Hungarian notation with php. never been strict but with no define mechanism it helped Me keep things straight and I like.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-01 01:07
    @Cluso99 -- I'll post it in this thread tomorrow. I'm at home right now and this PC doesn't have a serial port, so I don't have the code on it.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 01:51
    Nice find and thanks for sharing the link.
  • Roger LeeRoger Lee Posts: 339
    edited 2009-05-01 03:42
    I like to stick with what I started with.

    I'll give up Punch Cards when they pull them from my cold, dead hand [noparse];)[/noparse]

    Roger
  • AleAle Posts: 2,363
    edited 2009-05-01 05:31
    I like single letters as integers or counter in general. Sometimes I use idx as an index and tmp is a temporary. My proble is that if I have to think of variable names too long I cannot decide. So better to keep it simple smile.gif.

    The big thing here is that businesses like ms like to push a new "coding" style with every language and to change languages quite often. So people has to re-buy tools and so on. And they do not care how much time it take for people to learn all those things.
    I wanted to learn java some years ago, so I started coding an app (I wanted it multiplatform too) to manipulate my mass spectrometry files. It is still not perfect, not finished and has a lot of dead code. I still have to look for tutorials and API docs to know how to go forward. It has been almost 5 years. For someone who is not programming 8 h a day learning all those little things is quite a task. And I have been programming for some 20 years already.

    I used to have my shellsort around, I do not like recursion that much smile.gif.
  • jazzedjazzed Posts: 11,803
    edited 2009-05-01 07:32
    I tend to use ii or jj for index variables ... sometimes I use n or m. The worst possible variable name is l.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2009-05-01 16:00
    SSteve said...
    ·makes me sad the 8088 descendants won out over the 68000 descendants.
    That reminds me of my dumbest bet ever. Which was that by the end of 1991 or 1992 (I forget which), the world would realize that 68K was a better chip than anything Intel had and INTC·stock·would be lower than MOT.

    Fortunately, I kept the stakes to a nickle.

    Later I decided the active factors were probably price·and the nexus between INTC and MSFT with their various kickbacks to their users. It surely wasn't ease of use and orthogonal architecture.
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-01 22:51
    Dang, I almost forgot to do this -- here is the VB6 code for controlling a serial port without using mscomm.· It's pretty heavily commented.
  • hippyhippy Posts: 1,981
    edited 2009-05-02 14:05
    Maybe I am just lucky with VB and MSCom32 but I've never had a problem with it. I suppose that's
    the thing; you only need to get under the hood and work out how a provided component works when
    it doesn't do what you want it to.

    Most people here don't know how Spin bytecode works and don't suffer through that. Many I suspect
    are happy to use what they are given and don't have any interest in how it works as long as it does.
    That 'not reinventing the wheel' does lead to a problem though when the wheel doesn't exist in the
    first place. For example C. Many people have said they'd like it, it's not an insurmountable task to
    deliver it on the Propeller, but apart from a few hardy souls very few are involved in the effort to
    make it a reality. There are many reasons for that; it's a small community, pressures of time and
    other projects, lack of prerequisite knowledge, but I suspect that a lot of it is because people want
    it delivered on a plate with zero effort on their part.

    That I think is the real difference between now and back when computers were new. If you wanted
    something you had to do it yourself. We seem to have lost something since then. Is it 'consumer
    society', a dumbing down of of people's skills, or modern day laziness ? Maybe it's all too complex
    to understand it ? I don't know, but the art of hacking ( in its good sense ), wanting to know how
    things work, seems more lacking as time moves onwards. Innovators, experimenters and hackers
    are seemingly becoming rarer by the day.
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-02 14:58
    @hippy -- Most programmers aren't in the habit of stressing their code. I like to say that anybody can write a program that works when everything goes right, but it is the test of one's skill that your program fails gracefully when things go wrong. If my code fails it's very likely that my phone will ring at 3:00 AM and I'll have to drive 300 miles to figure out why, and I don't like doing that. So at every turn I ask questions that seem silly -- what happens if this interrupt doesn't occur? What happens if the interlock is never made, even though that should be physically impossible? What happens if this message I just sent is neve received? You'd be surprised how much grief can be avoided by simply displaying a message like "closing door" on an operator display, even if it normally only flashes for 1/5 second. When an interlock suddenly stops working that message can be the difference between fixing it over the phone and not fixing it for weeks. I have seen many in-place systems (by other people) that fail intermittently because two devices get in a state where each is waiting for the other to respond. You can't debug that kind of behavior out of a system; you have to design it out from the start, by asking at every step how it will recover when something goes wrong.

    On C vs. Spin, I've noticed that people whose background is C tend to call Spin BASIC-like, and people whose background is BASIC tend to call Spin C-like. When you look at the math operators, the lack of memory protection, crappy string handling, and block comment structure, it's C-like. When you look at the syntax, the use of whitespace to delimit code blocks, the case insensitivity, the nonuse of curly braces, and the apostrophe comments it's BASIC-like. What it is is an efficient (and dangerous if you're not careful) language like C that is designed to be inviting for beginners like BASIC. Beginners often don't get how to do block indentation, so Spin makes them get it right or the code doesn't work. Spin uses objects and lacks GOTO, but its objects are permanent so issues like scope and lifespan don't muddy it up.

    And then, as with early BASIC, Spin is a bit slow so it's complemented with the completely different and vastly more powerful PASM. I cut my teeth in professional programming with a similar combination, coding in MS Series 100 compiled BASIC (written for a non-IBM MS-DOS machine and having no non-DOS I/O functions at all) and 8086 ASM to get the stuff done BASIC was too slow or lacked functions for. (I had to do long string handling in ASM because, on rare occasions, BASIC would crash if you were manipulating a lot of long strings. The 8088 had a bug which would cause string copies to not be completed if they were interrupted, and this would corrupt the string heap. Whenever I mentioned this to other programmers they would shrug and say well, it doesn't happen very often; I took the trouble to code around it.) My projects used to run 10-20% ASM (in source), and with that experience the relationship between hub and cog memory seems perfectly natural and correct.

    I cannot really imagine a task for the Prop which would be better served by C than Spin over PASM; I think the main reason for wanting C is that some people are so used to thinking in C that they'd rather not learn another model. But the Spin/PASM model was custom designed for the Prop's architecture, and for maximum versatility I think it's more useful to learn how the chip is meant to be used than to try and force it into a model that was meant for a much different architecture.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-02 15:34
    There's another skill that many programmers don't seem to have. It's the ability to see their own code as someone else (or a processor) might. Many programmers get caught up in what their program is supposed to do or was designed to do rather than what's written down and miss a bug due to a simple typo or mixing up two instructions by accident or some such.

    Playing devil's advocate on the C vs. Spin/PASM bit ... There is a lot of existing code written in C. Although it's not difficult to transliterate C code to Spin, it's time consuming at best. If compile-time macros are used a lot, it's downright annoying and error prone. It would be interesting to see what would happen with the Propeller if there were a C to Spin-bytecode compiler and a PBasic to Spin-bytecode compiler.
  • hippyhippy Posts: 1,981
    edited 2009-05-04 10:01
    localroger said...
    @hippy -- Most programmers aren't in the habit of stressing their code. I like to say that anybody can write a program that works when everything goes right, but it is the test of one's skill that your program fails gracefully when things go wrong. If my code fails it's very likely that my phone will ring at 3:00 AM and I'll have to drive 300 miles to figure out why, and I don't like doing that.
    I agree, and I think the original article this thread leads on from shows that it comes down to how critical operation of code is.

    Only when it is critical do we really have to work from first principles and even then we are often never sure we've caught every nuance of what could go wrong. When not very critical we take pre-written code, be that MSComm32, a supplied Sort() routine or a Propeller Object from OBEX, and say that will be good enough. It's that difficult measure of deciding "what is good enough".

    It's the same for hardware; we should ideally fit caps close to regulators, decoupling capacitors and fit current limiting resistors on I/O 'just in case', but we frequently skip doing so.
  • heaterheater Posts: 3,370
    edited 2009-05-04 13:20
    I don't miss: 1) Writing the required algorithm(s) in pseudo code. 2) Compiling that to assembler manually 3) Assembling the result into hex manually. 4) Entering the hex into a prom blower manually. 5) Plugging the PROM into the target to find, of course, it does not work. 6) After 2 months of doing this having my boss turn up all smiles with an 8 inch floppy disk in hand and announcing he's now got an assembler for the target CPU.

    That's how we wrote a debug monitor for the 6809 very soon after the first chips landed in England.

    A good into to the life of a programmer I guess....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-05-04 13:22
    I do miss: Paper tapes. Wish I could get my hands on a paper tape punch and optical reader for the Propeller [noparse]:)[/noparse] Can you still buy computer tape?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • potatoheadpotatohead Posts: 10,261
    edited 2009-05-04 14:40
    I miss that too.

    There are still NC machine shops that use 1" ASCII paper tape punchers and readers.

    http://www.westnc.com/paper-tape-rolls.html

    A new puncher is gonna run you about a grand, or so... Rolls of tape, which will hold about 170K, are $50 / 80, depending on oiled or not, mylar or not.

    The punchers run about 70cps or so. I once put an 8K version of space invaders for the DOS PC, onto a paper tape roll. Still have it in the little blue can somewhere.

    The bits got punched out of the tape. They, of course, fell into the "bit bucket" and are as far as I know the only real physical manifestation of "bits"! I've a little can full of "bits" somewhere too. It contains the "bits" from the invaders tape.

    It's funny to see such progress then walk into a shop to watch an old AMADA NC punch, producing parts from a looped program, where the loop is literally the paper tape (oiled for sure) ends, secured so that it will feed through the reader over and over. That's a physical manifestation of a "program loop" then too!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
Sign In or Register to comment.