News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Puresox

Non-Programmer that is looking to find info on different programming languages

Started by Puresox, 00:28, 07 March 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Puresox

I have a very basic understanding of programming , but would like to understand it better than what I do currently. Can anyone recommend any sites or books that explain the different languages that were about , looking to understand what and why different languages were developed and what benefits they had from each other . Basic, Forth, machine code, logo etc . Looking for something that is not too technical, basiclly  something the man in the pub could understand. thanks

rpalmer

Puresox,

The main issue you need to understand is what do you want to achieve? And then how you want to achieve it?
Each language has its good and bad points.

As for languages to use, the CPC has basic built in and the user manual provides a simple view to get most people programming.
Other languages are available, but again these are not native to the CPC (e.g forth, C, Fortran, Pascal, Modula-2, etc) and to learn them you need to just google them to some some simple tutorials to start you on your way.

rpalmer

Bryce

Most languages were developed with a certain task or certain level of ability in mind. After that it's a balancing act between speed and comfort. So these will be the main differences between languages. For example BASIC (Beginners All-purpose Symbolic Instruction Code) was developed as a general purpose language with "human understandable" syntax but not particularly fast. C was developed for general purpose too, but optimised for speed, which made it less comfortable to program. Others like Fortran (Formula Translation), COBOL (Common Business Orientated Language) or LISP (List Processor) were developed with a very specific task in mind. The name of the language (in the older ones at least) usually gives a good clue of their goal.
I'd suggest that you just make your own list languages you've heard of and then investigate each one individually to understand what the creators goals were. I doubt you'll find a book that covers them all.

Bryce.

AMSDOS

In regard to why a language was written, I can only suggest Wikipedia, some of the pages I was looking at document why it was created. For languages like BASIC for example it suggests it was written as a means for other people (who weren't scientists or mathematicians) to construct programs.
Languages like BCPL & C were originally created for creating systems software, though have gone on for other applications, the CPC version of BCPL for example demonstrates a range of applications Arnor created to demonstrate the flexibility in the language.


The trick to it all, is while Languages which we find on our Amstrad date back to languages created in the 60s/70s, they were done on large scale machines, so languages like C have been modified or scaled down, normally due to it being inefficient for an Amstrad to have & Languages like Pascal that I use, have incorporated things into them which are relevant to the system.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

talrek

Very interesting,
i mean some languages have their own purpose but should you use the same language to program an action game (using sprites) than an adventure game (text and graphics based only) ?

I mean, is there some language that allows you to use graphic or music software easier ?

Bryce

When it comes to action games, only 2 things are important. Speed and more speed, so obviously you will choose speed over ease of programming and your choice will be assembly and not BASIC. How easy isn't really important. You only have to write it once. However, when it comes to learning about computer music or graphics, BASIC would be a better choice for a beginner.

Bryce.

fano

Quote from: Puresox on 00:28, 07 March 16
I have a very basic understanding of programming , but would like to understand it better than what I do currently. Can anyone recommend any sites or books that explain the different languages that were about , looking to understand what and why different languages were developed and what benefits they had from each other . Basic, Forth, machine code, logo etc . Looking for something that is not too technical, basiclly  something the man in the pub could understand. thanks
Previous advices are good, i'd add a little thingie : theory of languages is good but reading and to trying to understand other people source code, that's a very good way to learn a lot  ;)
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

arnoldemu

Quote from: Puresox on 00:28, 07 March 16
I have a very basic understanding of programming , but would like to understand it better than what I do currently. Can anyone recommend any sites or books that explain the different languages that were about , looking to understand what and why different languages were developed and what benefits they had from each other . Basic, Forth, machine code, logo etc . Looking for something that is not too technical, basiclly  something the man in the pub could understand. thanks
If you're after basic programming and simple algorithms you could try scratch.

Scratch - Imagine, Program, Share

(no version for cpc)

It is tought in many primary schools and should give you a good understanding of events, loops that kind of thing the basic structure of most languages. Programming is just a list of instructions with some decision making.

Like making a cup of tea. The decisions here are to add milk or to add sugar.

1. Get a cup
2. Put a tea bag in it.
3. If person wanted sugar, put a teaspoon in.
4. Put water into kettle.
5. turn on kettle.
6. wait for it to boil
7. pour boiling water into cup.
8. get a spoon
9. stir tea
10. drink it.

Making a program is all about instructions, the order they are done in, and the result you want.

There are decisions and actions.

For example if somebody wanted 3 spoons of sugar.

3a. Have we added all the sugar? yes, go to 4, no, go to 3b.
3b. add a teaspoon of sugar
3c. go to step 3a.

3a-3c is a simple "for" loop in basic.
10 for i=1 to 3: print"add sugar":next


After scratch choose an interpreted language first, one that gives you quick feedback about syntax errors (i.e. you didn't use the correct words to describe your instructions) and that will allow you to break into the program easily if something goes wrong and one which will not crash the computer if you did something wrong.

They are normally easier to program and you don't need to do separate steps to prepare them such as compiling and linking.

BASIC is a good choice here. The line numbers sometimes help to make the instructions (e.g. I numbered the instructions, basic has line numbers where you could do the same).

Another fairly good language is pascal - I did a bit of that in secondary school. It is meant to be structured and is meant to help you to program better.

C is used a lot, but you need to understand pointers to use it fully, so best avoided until you can program in other languages.

Avoid asm until last. It's really low level. Instead of "turn on kettle" in basic, in asm you would need to be more precise and describe every small action: e.g. find wall socket, put the plug in all the way, turn on switch, etc).
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Puresox

Some great answers , thanks for the superb explanation Arnoldemu , it may seem very obvious , but it does help clear the fog and prevents me over thinking the process and getting overwhelmed by the whole subject. I think I may well delve into some simple type-in's and try and break down what processes are being done by what parts of the program , and I have the Amstrad Manual which I expect I can get a good understanding of the most useful commands within .
To be honest , I am not looking to go full force into becoming a programmer , but I do fancy the idea of understanding the way things work , As long as it intrigues me The more I will take in. I do appreciate the responses, and I know it would be just as easy for me to Google it . The thing is with googling is that there is a plethora of info and it just can overwhelm the senses trying to sort through the useful and the trash . It is good to hear recommendations or even just pick the knowledge up from people who know . cheers

SRS

Maybe this could help you ? Programmer 101: Teach Yourself How to Code

I started with BASIC, type-ins from manual first, then magazines ... worked finde for me.

andycadley

For what it's worth, there are entire CS courses dedicated to language design, the different classes of programming language (Imperative, Functional, Declarative) and their sub-genres (Procedural, Object-Oriented, Domain Specific etc) and the how's, whys and general history of language development. And while it's interesting from an academic perspective, it doesn't necessarily teach you anything particularly useful unless you're planning on designing your own (at which point, learning from the mistakes of others is a good idea!)

Jumping in at the deep end and playing around with languages like BASIC or Scratch can give you a much better feel for how it works, though if you ever want to get serious about it I'd highly recommend going down the route of learning a more formally structured language like Pascal because sloppier languages like BASIC, C and Python have a nasty way of encouraging code habits that are hard to break out of but lead to difficult to maintain code.

AMSDOS

I would agree BASIC can create havoc and it's not everyone's language. Some books on the topic of BASIC (either Amstrad based or generic) would use some procedure so people can understand what's happening in an program, the manual is a good source at showing what a particular command does, though for the functions which return mathematical results, it still baffles me! ??? Teach Yourself BASIC A Tutorial Guide Part 1 & 2, which are on the Wiki, maybe the next step after consulting the Amstrad BASIC or Locomotive BASIC Tutorial by Sean McManus (though Seans Guide slants more towards his examples from magazines), if BASIC was something you wanted to look into.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Puresox


andycadley

Quote from: Puresox on 19:18, 08 March 16
Does Math , feature highly within coding?
Yes and no. :P

It really depends on what you want to do and also what you consider "math". Basic numeracy is probably going to be important regardless. If you want to write complex 3D graphics or do audio/video processing, having strong trigonometry and matrix multiplication skills are essential. Working mostly with databases?, then you'll need good Set Theory and Relational Algebra. More low level code and a strong grasp of Boolean Algebra is going to help.

If you're just writing pretty web pages with not much going on though, then it's marginal at best.

arnoldemu

Quote from: Puresox on 22:49, 07 March 16
Some great answers , thanks for the superb explanation Arnoldemu , it may seem very obvious , but it does help clear the fog and prevents me over thinking the process and getting overwhelmed by the whole subject.
You're welcome :)

Quote from: Puresox on 22:49, 07 March 16
I think I may well delve into some simple type-in's and try and break down what processes are being done by what parts of the program , and I have the Amstrad Manual which I expect I can get a good understanding of the most useful commands within .
Good plan. This can often be a quick way to learn. REM out bits of the program, see which bits stop working or break, and add your own bits in. Adding prints can help you to see the flow of the instructions and to see the values of the variables.

e.g.

PRINT"here1"

PRINT"here2"


variables often have a type such as numeric (integer = whole numbers) or float/real (numbers with fractional parts), strings (which is like a word or sentence, it's a a collection of letters, numbers, punctuation, symbols etc). A variable has a name and a value. The name is just an easy way to use them. e.g.

tea%=13.

This defines a integer/whole number (the % is BASIC's way of saying it is this type). In this case 13. The name is "tea". If you had another:

sugar%=11

then this is another variable called sugar, it's independent of variable tea and has it's own value.

haveacup="Please have a cup of tea"


Quote from: Puresox on 22:49, 07 March 16
To be honest , I am not looking to go full force into becoming a programmer , but I do fancy the idea of understanding the way things work , As long as it intrigues me The more I will take in. I do appreciate the responses, and I know it would be just as easy for me to Google it . The thing is with googling is that there is a plethora of info and it just can overwhelm the senses trying to sort through the useful and the trash . It is good to hear recommendations or even just pick the knowledge up from people who know . cheers
Googling doesn't aloften mean learning. Sometimes reading a book works, sometimes not. With googling the answer is there and easy just to take it without understanding why it works. Sometimes the answer is not there, it's incorrect or there is a better answer. Often doing, breaking and fixing is the way to get the best understanding.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

FloppySoftware

What language is better to learn programming?

It depends. In my case, I learned Mallard Basic in first place, then 8080 & Z80 assembler, C, Logo and Forth, all CP/M related.

On the PC side, I learned 8086 assembker, Java, SQL...

I think a good Basic implementation is fine for a start.

Just a small advice: start coding in line  1000 or even 10000 if you want a nice indentation. Avoid things like this:

90 FOR A%=1 TO 10
100     PRINT "Hello!"
110 NEXT


This is better for good readability:


1000 FOR A%=1 TO 10
1010     PRINT "Hello!"
1020 NEXT

floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Bryce

Quote from: Puresox on 19:18, 08 March 16
Does Math , feature highly within coding?

Yes, but computer maths is very different from normal maths, because computers can't directly do complex calculations, you kind of have to teach it to do maths in its most basic steps.
Regarding languages in general. You'll find that many languages are very similar, they will use different commands, but offer similar functions, just the syntax will be slightly different. It's more important to learn the structures that languages use, such as loops, sub-routines or conditional branching, rather than the exact details of a particular language. If you grasp the structures, the rest will be more or less obvious in any language.

Bryce.

arnoldemu

Quote from: Puresox on 19:18, 08 March 16
Does Math , feature highly within coding?
Yes.

The level of maths really depends on what you want to do and what language you are using.

For example, BASIC has divide, multiply add, subtract, logical operations that kind of thing. BASIC can support real/float numbers and also large integer numbers.

z80 asm has no divide or multiply, you have to do that yourself. It has add, subtract and logical operations and only really handles 8-bit and 16-bit range numbers. It doesn't have any float/real number operations.

So go with something like basic first that has a lot of maths operations built in it makes it easier to write equations, you don't need to worry about number ranges, it's a bit more easy to work with.

@Bryce is correct, if the equation is complex you have to break it down for the computer to do and do each step, you can't type in complex equations direct into basic. It doesn't understand them.

If your doing 2d games then you need to know a bit of maths. A Cpc 2d game, you can probably do it with gcse level maths. 3d a lot more maths knowledge is needed (a level), physics even more (degree level).

Understanding real/float, integer/whole numbers and multiply, divide, add, subtract, fractions, solving simple equations and understanding less, greater and equal are the kinds of things you'll be fine with for 2d.

For 3d, you need to know matrices, coordinates, vectors, euler rotations that kind of thing.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS


Quote from: Puresox on 19:18, 08 March 16
Does Math , feature highly within coding?


The others have provided good answers, which has allowed me to understand why I was simplifying complex calculations in a classroom many years ago, though occasionally something which has a mathematical problem to it can be solvable without using any Math.


This example I've taken out of a book called "Programming is Fun" which is a guide to using BASIC for secondary school students, presents this problem:



        #
      # # #
    # # # # #
  # # # # # # #
# # # # # # # # #
  # # # # # # #
    # # # # #
      # # #
        #



Which could simply be a bunch of PRINT statements, uses zero maths, but it is a problem where the book wants this problem solved by using Nested Loops and a Conditional IF - THEN statement. The embarrassing thing about it was I needed to ask a forum how to go about it.  I did get some different answers back too, and I think at the time, some people said that they couldn't get it working based on a Nested Loop & an IF - THEN, it needed something else to go with it.   


For me a problem like that could also be solved with an array, which has helped me more with my programming. Looking at the code though it may seem that maths is extensive with arrays, but it's simply an area which hold values.


This program below from my silly programming thread, sets up a simple array, I've used a Nested Loop (a WHILE loop around another WHILE loop), so when the program starts I've setup my inks (Line 10), Line 20 goes to the subroutine at 3000, which places the data into the array, when RETURN is reached, it comes back to the main program, Line 30 sets up graphical position for x & y. The "p" variable is a positioning.  The WHILE in line 40 asks if p is not equal to 65 to continue, at that point p = 1, so it continues. The second WHILE statement in Line 50 is a bit more complicated, what's happened is I've forced a bit of maths based on x = 100. So the 132 is useless if I wanted to have x = some other value. I've obtained the value of 132 based on the size of the array. Because I'm in MODE 0 the next pixel position is 4 pixels along & I have 8 pixels to draw, so 4x8 = 32, because x = 100 though, that becomes 132. For that line to work anywhere regardless of what x equals, you could say "WHILE x<>x+32", so when x = 132, the condition is met and exits at line 70, line 80 simply tells x to equal 100, and then the y position changes, each line is 2 pixels down, the program at line 90 is the end of the second WHILE p<>65, at the point p is not equal to 65, so it goes back and Loops all over again and continues to do so until p equals 65, at that point it will go to line 100 which has a WHILE to check if RETURN has been pressed and Exits. Hope that makes sense.



10 MODE 0:BORDER 0:INK 1,26:INK 0,0:INK 2,2:INK 3,11:INK 4,25
20 GOSUB 3000
30 x=100:y=100:p=1
40 WHILE p<>65
50 WHILE x<>132
60 PLOT x,y,o(p):p=p+1:x=x+4
70 WEND
80 x=100:y=y-2
90 WEND
100 WHILE INKEY$<>CHR$(13):WEND:MODE 2:END
3000 DIM o(64):FOR n=1 TO 64:READ o(n):NEXT n:RETURN
3010 DATA 1,0,0,0,0,0,0,1
3020 DATA 2,1,1,1,1,1,1,2
3030 DATA 2,3,3,4,4,4,3,2
3040 DATA 2,3,3,4,3,3,3,2
3050 DATA 2,3,4,4,4,3,3,2
3060 DATA 2,3,3,4,3,3,3,2
3070 DATA 2,3,4,4,4,4,3,2
3080 DATA 0,2,2,2,2,2,2,0
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Puresox

Plenty of solid answers to get my teeth into , thanks  for the time put into replies, Really well put tbh , I will be referring to these a lot . I am sure we're not going to be seeing me offer any new games in the next few months , but I will be leisurely trying to fathom things, and building an understanding over the months and years . There may be a point where it just suddenly hooks . And the understanding can be put into practice , who knows .

Puresox

Another little question, I have recently picked up an MSX1 Toshiba , cos I am interested in the little machine (As I am CPC also) Just was flicking through one of the manuals and it is describing  the different keyboard modes that would print various graphical characters, instead of letters- Now my question is , I have seen this feature on C64 and think Speccy and other computers , but not aware of the Amstrad . Apart from doing the CHR$243 or whatever it was . Are they different things. And why does the Amstrad have this feature. Is it a useful feature?

sigh

Quote from: Puresox on 20:10, 10 March 16
Another little question, I have recently picked up an MSX1 Toshiba , cos I am interested in the little machine (As I am CPC also) Just was flicking through one of the manuals and it is describing  the different keyboard modes that would print various graphical characters, instead of letters- Now my question is , I have seen this feature on C64 and think Speccy and other computers , but not aware of the Amstrad . Apart from doing the CHR$243 or whatever it was . Are they different things. And why does the Amstrad have this feature. Is it a useful feature?

YOU BOUGHT AN MSX!!!  :o

Finally! Someone who bit the bullet. I want to get one of these machines too, but will be going for the MSX2.

Munchausen

About the maths question, I would say that a good programmer needs a strong understanding of algorithms, and this is fairly mathematical. When you look to solve a problem you need to break it up into blocks, and for many of those blocks you will then want to ask the question "is there already a documented way to do this well" (where the definition of "well" is dependent upon your particular requirements). You then do some research to find a decent algorithm, then implement it. Often algorithms are described mathematically. The theory of programming languages is also completely mathematical.

On the other hand, often you will be looking at a new problem, and will have to come up with a new solution. And sometimes the above doesn't apply, depending on the task, e.g. basic GUI or web programming, where you are solving a simple problem in a language with lots of readily available datatypes that are reasonably efficient across a range of problems, and where efficiency isn't a big issue.

You probably also need to have some idea about complexity theory, so that you can estimate roughly how computationally expensive different implementation options are.

Those are arguably quite advanced skills though: to learn a programming language and get started, you don't need to know any of the above. I started out with basic on the CPC at age 7 using the 6128 manual, and didn't have a clue about anything, and just getting your hands dirty is probably the best way to get started.

AMSDOS

Quote from: Puresox on 20:10, 10 March 16
Another little question, I have recently picked up an MSX1 Toshiba , cos I am interested in the little machine (As I am CPC also) Just was flicking through one of the manuals and it is describing  the different keyboard modes that would print various graphical characters, instead of letters- Now my question is , I have seen this feature on C64 and think Speccy and other computers , but not aware of the Amstrad . Apart from doing the CHR$243 or whatever it was . Are they different things. And why does the Amstrad have this feature. Is it a useful feature?


If you mean Control Codes, then yes they are very useful because you can have a PRINT statement simply run off multiple tasks from one statement, some of the Control Codes don't have a BASIC command to go with it, such as turning on/off Transparent Mode or the Graphics Write Mode (BASIC 1.1 lets you do it as an optional parameter with MOVE, DRAW, PLOT for example), and some Control Codes have a BASIC command such as MODE, INK, PEN, SYMBOL or WINDOW. So when a Control Code is used in a PRINT statement, you could simply have a MODE command, followed by INK to setup your Inks, a command for PEN, but if you wanted to write some Characters you could do that too & then do another Control Code PEN to another Colour and write another Letter, which would save having to do a PRINT, followed by PEN then another PRINT and so on.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Bryce

Quote from: Puresox on 20:10, 10 March 16
Another little question, I have recently picked up an MSX1 Toshiba , cos I am interested in the little machine (As I am CPC also) Just was flicking through one of the manuals and it is describing  the different keyboard modes that would print various graphical characters, instead of letters- Now my question is , I have seen this feature on C64 and think Speccy and other computers , but not aware of the Amstrad . Apart from doing the CHR$243 or whatever it was . Are they different things. And why does the Amstrad have this feature. Is it a useful feature?

The system used to store characters in a computer is called ASCII. In a CPC it can have up to 256 characters (known as extended ascii). The alphabet (Capitals and small letters) plus the usual +/-/= commas, brackets and decimal points don't use up the full 256, so the rest have been either assigned to graphical characters or commands. Print CHR$(7) for example makes the computer beep, Print CHR$(239) will draw a little rocket.
There's a table of the full character set here: http://cpctech.cpc-live.com/docs/cpckybd.pdf

It's also possible to define your own characters. Check out the commands "Symbol" and "Symbol After" in the CPC manual.

Bryce.

Powered by SMFPacks Menu Editor Mod