Shop OBEX P1 Docs P2 Docs Learn Events
How to learn programming !!! ;) — Parallax Forums

How to learn programming !!! ;)

whiteoxewhiteoxe Posts: 794
edited 2014-06-05 12:24 in General Discussion
Well I did a couple of programming courses at Uni twenty years ago. The first was COBOL and though i enjoyed it , but making a booking system and having to write your own calendar code was no fun at all... from there I went on to the next and only available language i was allowed to enroll in since my degree was a hybrid of Business and IT, that was Visual basic.

At the time i thought it was great, making Windows forms with the click of a button and hundreds of drop on controls and easy database access etc. But I did never really understand memory and variables until i bought my first picaxe chip and it was an 08 with very little memory for code or eeprom. I think they should teach basic stamp or picaxe even prop programming as a starter for wanna be programmers ;)

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-06-04 20:15
    whiteoxe wrote: »
    Well I did a couple of programming courses at Uni twenty years ago. The first was COBOL and though i enjoyed it , but making a booking system and having to write your own calendar code was no fun at all... from there I went on to the next and only available language i was allowed to enroll in since my degree was a hybrid of Business and IT, that was Visual basic.

    At the time i thought it was great, making Windows forms with the click of a button and hundreds of drop on controls and easy database access etc. But I did never really understand memory and variables until i bought my first picaxe chip and it was an 08 with very little memory for code or eeprom. I think they should teach basic stamp or picaxe even prop programming as a starter for wanna be programmers ;)

    I noticed that Ken had mentioned that when they got the school kids learning to program that they used BASIC, but not the C that they are touting or even Spin. I partly agree with this decision as BASIC is interactive, however it is still BASIC and GOTO 100 is not very friendly when you compare that to Forth where you extend the language with your own words and actions, much much friendlier. In fact, Forth is ideal for robotics as you can also communicate with a bot via bluetooth and issue commands, debug, and change the code etc all without having to be tethered to a PC and the Prop tool or a compiler.

    In Forth I would define words for a bot so that you could talk to it in plain English like this:

    FAST FORWARD
    LEFT TURN
    500 ms
    STOP
    1 second
    SLOW REVERSE
    RIGHT TURN
    500 ms
    RETREAT
    3 seconds
    STOP

    So you think "I want to make that into a demo word that runs automatically on startup rather than having to type all that in", okay:
    pub DEMO FAST FORWARD LEFT TURN 500 ms STOP 1 second SLOW REVERSE RIGHT TURN 500 ms RETREAT 3 seconds STOP ;
    AUTORUN DEMO

    All that in one line plus a directive!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-04 23:07
    Well, I am plodding along finally learning GCC on the Propeller in all its glory.

    But I strongly prefer Forth for really understanding what is going in any particular micro-controller that can support it. (It needs about 32K RAM for a Forth Dictionary and 32bits is more handy than 8 bits. 8 Cogs in Forth is a lot of fun).

    The situation is simply whether you are 'write-compile-load' kind of programmer, or you prefer to work interactively at a terminal.

    Forth is nearly the opposite of C as it is certainly NOT a 'strongly typed' language.

    But one really can get the most comprehension of the micro-controller's features. With C, it seems that one expects a library to be written for everything so one doesn't have to think about the underlying architecture. Floating-point tends to consume a big chunk of resources that might be required elsewhere in a project. I suspect that Forth teaches one how to get tighter code to do the same thing.

    Basic just gets a new learner to be aware of the power of looping and branching. And it can be deployed in very tiny RAM spaces. The original BasicStamp has only 32 bytes of RAM!

    +++++++++++++++
    In sum, the choice of programing language to target may be related to the actual size of your targeted device. Scale will affect the choice of what you want to use.

    COBOL is an accounting language, isn't it? A rather specialized language. FORTAN is specialized for maths.

    I'd stay with the generalized languages instead.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-06-04 23:21
    Basic just gets a new learner to be aware of the power of looping and branching. And it can be deployed in very tiny RAM spaces. The original BasicStamp has only 32 bytes of RAM!

    Wasn't this a PC compiled BASIC so all that the BasicStamp had to do was execute compiled code but it's not interactive like BASIC is normally?
  • whiteoxewhiteoxe Posts: 794
    edited 2014-06-05 00:56
    I was talking to a contract programmer not long ago. He works for banks and yes Cobol is still big in the banking area. You can get COBOL.net, Ive no idea what that's about ?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-05 09:33
    Wasn't this a PC compiled BASIC so all that the BasicStamp had to do was execute compiled code but it's not interactive like BASIC is normally?

    Gawd, I wish you weren't always so right. You make me look bad. But the point is still there that it doesn't really require lots of ram to do something in Basic. On the other hand, the Forth dictionary really needs quite a bit to work well. I guess 8K or 16K might work; but it is wonderful with the 32K that the Propeller offers.

    A new user might think that more RAM is always better. Actually more fast memory is better as your projects grow larger, but it doesn't all have to be RAM.

    I guess COBOL is the language to learn if you want to rob an ATM. I am not interested in doing so.
  • lardomlardom Posts: 1,659
    edited 2014-06-05 09:51
    Peter Jakacki, Which is more useful for robotics, Forth or Tachyon? There is a need for robotics in farming, snowplowing, lawn mowing, garbage collection etc.
  • Mike GMike G Posts: 2,702
    edited 2014-06-05 10:17
    The best way to learn programming, like anything else, is practice.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-06-05 10:18
    Gawd, I wish you weren't always so right. You make me look bad. But the point is still there that it doesn't really require lots of ram to do something in Basic. On the other hand, the Forth dictionary really needs quite a bit to work well. I guess 8K or 16K might work; but it is wonderful with the 32K that the Propeller offers.

    A new user might think that more RAM is always better. Actually more fast memory is better as your projects grow larger, but it doesn't all have to be RAM.

    I guess COBOL is the language to learn if you want to rob an ATM. I am not interested in doing so.

    You can also get PC compiled Forths that squeeze into tiny targets much like PBASIC does, but of course you don't actually get Forth on the target, just compiled code of some sort and no interaction :(
    I think JDForth does this too but it compiles from Forth to Spin!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-06-05 10:30
    lardom wrote: »
    Peter Jakacki, Which is more useful for robotics, Forth or Tachyon? There is a need for robotics in farming, snowplowing, lawn mowing, garbage collection etc.

    Sorry, Tachyon is actually Tachyon Forth (TF for short), so it's Forth through and through although it is rather Prop-centric in places :) Well of course it is, it's designed especially for the Prop, not a PC.

    TF is built for speed so that you don't have to write any assembler in Tachyon itself but the code is fast enough plus it has little helper instructions and modules for SPI etc. There is also hardly any need to dedicate a cog just for simple functions either such as I2C or SPI etc as all these high-speed functions run straight from the same cog that's executing your application code unlike Spin.

    To play with it you can load the kernel into your Spin tool and F11 it to the board then talk to it with a terminal at 230,400 baud. First thing to do after that though is copy and paste in EXTEND.fth to generate your extended kernel as it's easier to have these extensions written in Forth itself rather than a Spin compiled form of Forth. This reminds me to make some new binaries for the Dropbox folder. Alternatively you can telnet (port 100001) into tachyonforth.com which is a Prop running TF. You can also access this via FTP or web browser. See my sig.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-05 12:24
    GCC via SimpleIDE is not too difficult to learn.

    I made a lot of unnecessary trouble for myself by starting with attempting to port an Arduino program. It is a very awkward way to get started.

    Just really focus on Simpletext and Simpletools libraries and it can be rather painless. But be aware that the use of floating-point features takes a big bite out of your hub ram space, even if your just are using it in print() functions.
Sign In or Register to comment.