Welcome, Guest. Please login or register.

Author Topic: How to program: In one easy step... Learn?  (Read 11168 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Sidewinder

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 241
    • Show only replies by Sidewinder
    • http://www.liquido2.com
Re: How to program: In one easy step... Learn?
« Reply #14 on: February 16, 2003, 02:17:58 AM »
I would suggest that you take a look at StormC 4 from Haage & Partner.  Currently they are running a special when you can get StormC 4 for only 50 Euros (about $50).

HiSoft C++ is also a great package and in my opinion has a better IDE than StormC, but StormC has support for modern C++ development using the STL and other more advanced things that are not properly supported in HiSoft C++.  However, if you are only planning on programming in ANSI C then HiSoft has a more intuitive interface.

If you want a free package I would suggest looking into   Louise's GCC archive.
Sidewinder
 

Offline sexton

  • Newbie
  • *
  • Join Date: Sep 2002
  • Posts: 31
    • Show only replies by sexton
    • http://www.garba.org
Re: How to program: In one easy step... Learn?
« Reply #15 on: February 16, 2003, 02:35:09 AM »
@FuZion

Ignore these creazy guys suggesting you to start with C. It may demoralize you completly and maybe you won't ever come back to the fantastic world of computing programming. C doesn't take you to Nirvana all the times anyway.

Some years ago, I would have suggested you to start with BASIC, but as a modern language, I don't like it because there isn't known widespread dialect. Most BASICs are highly propietary; Amos, Visual Basic, Blitz Basic, etc.

Java may be even more daunting than C because you can't really do anything useful without mastering the OOP paradigm. I abandoned Java many times in the 90s and got back to plain C or Assembler. Nowdays I hardly imagine doing a large project without Objects ;)

Assembler is very easy compared to C because the processor contains a handful of instructions. The problem is that you have to know the OS and hardware arquitecture in order to "speak" to the outer world; i.e. reading the keyboard, saying "Hello World". Please note that RISC processors are a bit more difficult to program in Assembler, in a very optimized way at least.

Start with a scripting language. A scripting language maybe even faster than Java or some other "self contained languages". A good suggestion would be Perl or PHP, with those you will get familiar soon with the C/Java syntax and you'll be able to do interesting dynamic web pages that you can even host on the Amiga. REXX and Rebol may be interesting, they aren't very convention though.

Computer languages are sometimes like spoken languages; there isn't a superior or inferior language, but there are languages that happen to be more appropriate on certain contexts.

Buy a couple of books, download tutorials, ask for help, and program, as much as you can!
Amiga 500. KS 2.04 1+4MB FAST, 40GB SCSI HD
Commodore 64 Breadbox + 1541
Duron 600Mhz 512MB Radeon 9000 Pro
HardSID + EVENT PS8s + Mackie VLZ 1402
Pegasos OR AmigaONE *possibly* on the way
http://www.garba.org
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show only replies by Atheist
Re: How to program: In one easy step... Learn?
« Reply #16 on: February 16, 2003, 09:03:20 AM »
Quote

Sidewinder wrote:
I would suggest that you take a look at StormC 4 from Haage & Partner.  Currently they are running a special when you can get StormC 4 for only 50 Euros (about $50).


Man, what a great deal, but because of the Amithlon fiasco, I thought we were in boycott mode. I was even thinking of getting it, but I despise C.

Amiga! How long must we suffer?
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show only replies by Atheist
Re: How to program: In one easy step... Learn?
« Reply #17 on: February 16, 2003, 09:25:38 AM »
Quote

Sidewinder wrote:
If you are looking for a quick tutorial on starting Amiga sepcific programming in C you can stop by my tutorial and start reading.  C or C++ is really the only way to go on the Amiga right now if you want to get some serious work done.  Starting with a scripting language (as was already suggested) is also a good place to start.  It really depends on your style of learning.  If you want to jump into the deep end and learn to swim that way learn C.  If you're more comfortable in the kiddy pool at first then go the way of a scripting langauge.



Lets see; Lesson 1
------------------------
#include

int main(void)
{
    printf( "Hello World!\n" );
}
------------------------------

I always reccommend Amos Prfessional & Compiler because I have a problem with C.

int main(void)

Why is that statement necessary? I read your page, and there is no real reason for it. Instead of void, what if I put in 9? I mean you say if it's not there it won't work, but does nothing, and yet every company that writes a compiler, won't remove the necesity to place it in the program.

Then there's

#include

I don't see a reason for that, other than every company that makes a compiler, won't remove the neccesity for it. If you don't use it, you can't print on the screen, yet if you use the print statment, clearly  you want to print something, so logic clearly dictates that it HAS to be there, so, programming, being based on logic, should INCLUDE include AUTOMATICALLY, and yet again, no SW company will do the logical choice and automatically include, include, if you use the print statement.

Also, I find it annoying that lines have to be ended with  ;

Therefore, these annoying things, many others, prevent me from using it. I don't want to memorize, if I use "if...then", maybe I need another #include, or it won't work. It should be handled automatically. I don't like listing variables, their type should be part of their name (i.e. $ is string, % is binary, etc).

printf( "Hello World!\n" )

I totally don't see a necessity for ( ) and " ", when basic easily survives with just " ".

It isn't a logical language.

Amiga! Can't wait to continue with Amos on A1.
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Nick

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1189
    • Show only replies by Nick
Re: How to program: In one easy step... Learn?
« Reply #18 on: February 16, 2003, 10:42:41 AM »
Hehe, I can`t believe people are recommending C/C++ and JAVA as a first programming language. MADNESS! :lol:

I started on QBASIC (stop laughing!) then was forced onto PASCAL and COBOL I was then forced back onto PASCAL again. Visual BASIC was next (useful if you want to make small, simple apps). After that things got serious. C then C++ followed by the devil`s programming language, JAVA. *CRINGE* Most of that was at college, and most of it was horrible. I`ve used only Blitz BASIC and OPL on my PSION apart from all that, and you know what? The only language I still use is OPL. :-)
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show only replies by DaveP
Re: How to program: In one easy step... Learn?
« Reply #19 on: February 16, 2003, 10:43:49 AM »
Quote


I always reccommend Amos Prfessional & Compiler because I have a problem with C.

int main(void)

Why is that statement necessary? I read your page, and there is no real reason for it. Instead of void, what if I put in 9? I mean you say if it's not there it won't work, but does nothing, and yet every company that writes a compiler, won't remove the necesity to place it in the program.


It defines the entrypoint to your program. void means
no arguments are supplied. The real signature is

int main( int argc, char*argv[] )

where argc is the argument count and argv is an
array of the strings passed to the program on invocation.

Why have a "main"? Well it allows you to define it
where you want - and you can have C "programs" which are not executable - useful in building libraries.

Quote

there's

#include

I don't see a reason for that, other than every company that makes a compiler, won't remove the neccesity for it. If you don't use it, you can't print on the screen, yet if you use the print statment, clearly you want to print something, so logic clearly dictates that it HAS to be there, so, programming, being based on logic, should INCLUDE include AUTOMATICALLY, and yet again, no SW company will do the logical choice and automatically include, include, if you use the print statement.

Because there are different methods of printing. stdio just happens to be one place where printing to the screen is implemented. In fact it contains all console I/O functions that write to stdout, stderr and read in from stdin.

There is fprintf which is used for printing text to a file descriptor, sprintf which is used for printing text into a string.

C is a language with no built in functions you see. It has basic types and operators. This allows you to re-define printf somewhere else ( say make it print to a graphical window ).

Quote


Therefore, these annoying things, many others, prevent me from using it. I don't want to memorize, if I use "if...then", maybe I need another #include, or it won't work. It should be handled automatically. I don't like listing variables, their type should be part of their name (i.e. $ is string, % is binary, etc).

printf( "Hello World!\n" )

I totally don't see a necessity for ( ) and " ", when basic easily survives with just " ".

It isn't a logical language.

Au contraire, it is an extremely logical language. ( indicates start of parameters, ) indicates end of parameters so that you can make parameters span multiple lines.

Why should types be part of their name? What benefit does it give you?

; indicates end of statement. Again this is useful for
multi line stuff but also for single line stuff where
you might want to fit multiple statements into one
line ( for example the use of ; in if and while ).

Automatic includes would break the ability to redefine functions.

I would NEVER recommend AMOS pro and compiler
first because it has a bunch of sucky default requesters that allow everyone to spot an AMOS pro program a mile of ( that and everyone forgets to trap CNTRL-A ) and secondly the add on routines for supporting AGA do not work well into the environment and finally because it does not support RTG by itself.

Lastly, it teaches you sloppy programming habits.
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show only replies by DaveP
Re: How to program: In one easy step... Learn?
« Reply #20 on: February 16, 2003, 10:47:12 AM »
HiSoft is better because the IDE is more intuitive
and that is vital for beginners. It also doesnt crash
every five minutes like StormC 3 and 4.

Sure it doesnt support STL out of the box but
then most beginners dont want that.

IT doesnt have RAD Wizards ( excuse me while I suppress my urge to mess my pants with excitement )  but it does have an object library for rapid application development. It has a fine debugger.

Hate figure. :lol:
 

Offline Nick

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1189
    • Show only replies by Nick
Re: How to program: In one easy step... Learn?
« Reply #21 on: February 16, 2003, 10:49:36 AM »
@Atheist

I feel the same. I like things to be logical, and not to have double standards. I bet the compilers
do a few things automatically, but when it comes to the actual programming it gets lazy. I also
think, if its possible, then why not do it?


<-------------Severe logic failure in progress------------->
<---------Please unplug keyboard and press any key--------->
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: How to program: In one easy step... Learn?
« Reply #22 on: February 16, 2003, 08:25:53 PM »
@Atheist
you really need to study C, start to program in it, and learn the difference between a structured programming language & a proceedual one
i assure you, there is a good reason BASIC is not used in the real world, and why C & C++ is
you will find that all that #include, (void), & ;, crap is nessesary for structured & OO programming
 :-)
 

Offline Lando

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 1390
    • Show only replies by Lando
    • https://bartechtv.com
Re: How to program: In one easy step... Learn?
« Reply #23 on: February 17, 2003, 12:25:19 AM »
I recommend to learn 'C' right away.  You'd just be wasting time learning a scripting language as you'll probably want to learn 'C' at some point anyway.  

Having to "unlearn" the stuff you learned before and then having to relearn the 'C' way of doing things would probably be harder than if you'd just went straight to 'C' in the first place.

Don't listen to people saying its too hard - 'C' is really very simple and powerful language once you've grasped the basic concepts of the language.

Good luck!
 

Offline jahc

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 521
    • Show only replies by jahc
    • http://wookiechat.amigarevolution.com
Re: How to program: In one easy step... Learn?
« Reply #24 on: February 17, 2003, 12:39:16 AM »
Personally, I like the C++ language. Here are some free tutorials on C++ :

http://www.cprogramming.com/tutorial.html
http://www.cplusplus.com/doc/tutorial/

These two tutorials rock. They are really really good.

Once you've mastered "ANSI" C++ , then you can learn how to do Amiga specific stuff by getting the Rom Kernal Manuals from somewhere. They are included on the Amiga Developer CD, which should be available from Haage&Partner or any other good Amiga dealer. I got mine from Anything Amiga in Australia for about $45 Australian dollars (cant remember exactly.)

The Amiga Developer CD also has a free C/C++ compiler called StormC 3.0. It's very easy to use.

To anyone who wants to get into coding.. if you really want to program, follow my advice! Good luck! And if you get stuck with something, ask for help on this forum!!
 

Offline Sidewinder

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 241
    • Show only replies by Sidewinder
    • http://www.liquido2.com
Re: How to program: In one easy step... Learn?
« Reply #25 on: February 17, 2003, 12:58:13 AM »
@Atheist

Quote
It isn't a logical language.


 :roflmao:

As was already said, C is an EXTREAMLY logical language, and that's what makes it a pain in the ass sometimes.

 Your arguments about the problems with C are moot.  The simple fact remains that the grammar of C is one of the most elegant and powerful grammars around.  Its syntax is strange, I will grant you that, but its power and flexability is undeniable.  With a mere 32 keywords C is able tackle even the most difficult programming tasks.  AMOS and C represent the two fringes of the progrmaming language spectrum.  C is small and simple, no frills, no excess--anything you need you must make yourself or #include (which, by the way,  is the reason for the #include statment).  AMOS is at the other end of the spectrum and has hundreds of commands and a simple, yet not very flexable syntax.  AMOS has a more difficult time adapting to changes.

Lest you think that I am preaching the superiority of C over AMOS and other such languages, you may wish to note that liquido2.com  (which is my domain and where I host my C tutorial) is also the home of the AMOS Factory.   In addition I am in the process, even today, of attempting to port the AMOS grammer to the A1 and other systems.

My final statement is this:  AMOS and C are different approaches to programming, both have their pros and cons, and there is absolutely no reason why someone cannot learn C as a first programming language if they so choose.
Sidewinder
 

Offline Ivan

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 139
    • Show only replies by Ivan
    • http://www.mnsi.net/~ivan/index.html
Re: How to program: In one easy step... Learn?
« Reply #26 on: February 17, 2003, 05:37:05 AM »
FuZion, if i we're you, i would go with a very simple version of BASIC and then move on to C.

Something most people here (i'm assuming you all have learned a number of languages same as i have) seem to have forgotten is there is a hadfull of simple concepts that stretch across all languages. For example, variables, loops, if statements, conditional operators, mathmatical operators, etc. Even in the nitty gritty world of assembler you have operators like JSR, BRE and so on. BASIC lends itself well to the novice programmer because they aren't burdened with a complex and obscure syntax and allows them to 'pick up' the basic ideas first. You won't be writing the newest 3D library in BASIC (ive done 3D stuff though) because its interpereted and as a language very limited. But that's the idea, keep it simple. Arexx i discount because it's mainly used for interprocess communication (the arexx port in your favorite app) and not geared for real applications development. There is only 1 type of variable, it's a script, how about trying to find the offset for any library you want to include in your arexx app and you will soon learn what i mean. And Java is just as complicated as C. On the other hand BASIC usually offers access to a small set of common system library calls through custom functions. Opening windows in Amiga Basic compared to C is worlds apart. Only in C you will have full access to the window at the cost of complexity. And if your just learning how to write code you don't want to be bogged down with pointers and idcmp flags that are all part of the OS side and not the code side.

Once you've learned the basics you can migrate to and from other languages no matter how exotic the language might be. Trust me, if you start off with something complicated like C (even arexx imho) you will find yourself spending more time fighting to figure out how to open a window or make a library call rather than how to structure your code. Something that's at the heart of any piece of code no matter what language you use.

As for which version of BASIC to use, i can't really say. :) Only that AMOS is really a poor implementation (it has it's advantages too) and like someone already said up there, it has a zillion custom calls to replace librarys in C. Amiga Basic will only run on a 1.3 (maybe 2.0) system and it's sort of a hack job. Hey, M$ wrote it for Amiga OS. At least it was a simple enough implementation and not blown out of proportions like AMOS. The only other one i can think of right now is Blitz Basic. Try starting there.

Ivan
 

Offline Dietmar

  • Full Member
  • ***
  • Join Date: Nov 2002
  • Posts: 220
    • Show only replies by Dietmar
    • http://devplex.awardspace.biz
Re: How to program: In one easy step... Learn?
« Reply #27 on: February 17, 2003, 10:48:40 AM »
A propos C development:

--- Release Announcement ---

GoldED Studio C/C++ IDE Updated

The GoldED-based C/C++ IDE for gcc, vbcc, StormC3 and other compilers has been updated.

The latest addition to the Integrated C/C++ Development Environment is clickable output during 'make': Compiler outputs appears in a resizable container. If you click on a file name, the source code is loaded and the cursor is positioned in the erroneous line.

Screenshot:
http://golded.dietmar-eilert.de/images/screen_gcc.gif

Download:
http://hometown.aol.com/goldedfiles/myhomepage/files/envCPP31.lzx

As usual, an updated free version of GoldED can be downloaded, too. The free version is fully functional but limited to editing files not larger than 1000 lines. It includes most add-ons from the commercial distribution (only spell checking and gcc are missing to keep the file size within reasonable
limits).

Download:
http://golded.dietmar-eilert.de/projects/golded/trial.htm

--- end ---

Btw, GoldED includes a small BASIC interpreter, too. Just plain ANSI BASIC, no Amiga functions at all. Should be ok for learning BASIC. But, like others here, I strongly advise against BASIC as first programming language. It spoils your style. If you ever plan to develop professionally, you will have to learn C. Other high level languages or script languages do not prepare you for C. You will learn little to nothing if you start with BASIC and then move on to C. On the other hand, Assembler is good preparation for C, because you'll get a feel for the hardware that will be useful to you  later. Just don't do any large project with it. Spend some months (1-3) with assembler, develop a small program, then move on to C/C++.  However, whatever you do, you should by now know what kind of software you want to write. Developing software is fun as long as you see results and are motivated. If all you want to do is "learn a language",  you might as well stop now.  You'll find the experience too frustrating ;-)
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show only replies by Atheist
Re: How to program: In one easy step... Learn?
« Reply #28 on: February 19, 2003, 12:20:13 PM »
Quote

DaveP wrote:
It defines the entrypoint to your program. void means
no arguments are supplied. The real signature is

int main( int argc, char*argv[] )

where argc is the argument count and argv is an
array of the strings passed to the program on invocation.


So if I put "int argc"  as  "int 3"
It would accept up to 3  words or numbers, in addition to the name of the cammand, from the shell prompt? Or from being called from another program.

char*argv

This looks like you are multiplying the terms.
Or, are variable names supposed to be placed between the square brackets? I don't get it.


Quote

Because there are different methods of printing. stdio just happens to be one place where printing to the screen is implemented. In fact it contains all console I/O functions that write to stdout, stderr and read in from stdin.


When you say, it contains all console functions, the compiled program only gets the portion needed, right?

You see, what gets me is, every time you want to use a command, you have to find the include that matches it.

Quote
sprintf which is used for printing text into a string.


??? you mean like  A$=Inkey$

Quote

C is a language with no built in functions you see. It has basic types and operators. This allows you to re-define printf somewhere else ( say make it print to a graphical window ).


Amos    Screen 4


Quote

and secondly the add on routines for supporting AGA do not work well into the
environment


Well, Francois Lionet, never got around to doing an AGA version.

Quote

Lastly, it teaches you sloppy programming habits.


I can see this being a problem.

I don't know if I'll ever be able to understand what "building a library" means.

I know about half of the Amos commands, but never got a hang of Amal. The awful thing is Amos, even compiled, could never be as fast as C. Nor can you force the computer to do certain things with it. I have a program that 500k in size. 2/3 data statements. I know that I wouldn't have a clue where to start converting it. Especially since, I've looked at programs a couple of pages long, and even knowing, the if then, while, ;, commands, its unreadable. Maybe I don't have what it takes.

Well, at any rate, which C. People say C, C++, then there's ANSI C (and maybe ANSI C++). Is ANSI the name of a company, like Storm is?

I've always considered taking a chance at using it.
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: How to program: In one easy step... Learn?
« Reply #29 from previous page: February 19, 2003, 12:57:13 PM »
Quote

Atheist wrote:

So if I put "int argc"  as  "int 3"
It would accept up to 3  words or numbers, in addition to the name of the cammand, from the shell prompt? Or from being called from another program.



That, my good man would be a syntax error. When you define any function C (just as many other languages) the definition says only what types of variables are handed to the function, not what the allowed values are. It's up to you, when you write the guts of the function how it deals with unwanted values etc.

Quote


char*argv

This looks like you are multiplying the terms.
Or, are variable names supposed to be placed between the square brackets? I don't get it.


Unfortuantely thats C pointer syntax for you. What 'char* argv[]' actually says is 'argv is a pointer to an array of characters'.
Arrays and pointers in C are also pretty much interchangable. This means that you could also declare it as 'char** argv', which means 'argv is a pointer to pointers to characters'.
Don't worry about it too much yet though...

Here's a simple program (off the top of my head so iut may have bugs) you could try to compile...

/*
   A simple C program to show arguments passed
   to main()
*/

#include

int main(int argc, char* argv[])
{
   int i;
   puts("Here's what was passed to main()");
   for (i=0; i   {
      printf ("Argument %d was '%s\'n", i, argv);
   }
   puts ("All done!");
   return 0;
}

Assuming it works and you compiled it as testprog, try running it in a shell as follows

testprog bollocks whatever

Hopefully you'd get something like

Here's what was passed to main()
Argument 0 was 'testprog'
Argument 1 was 'bollocks'
Argument 2 was 'whatever'
All done!

as your output.

Quote

Well, at any rate, which C. People say C, C++, then there's ANSI C (and maybe ANSI C++). Is ANSI the name of a company, like Storm is?

I've always considered taking a chance at using it.


Well, ANSI is a standard (Amierican National Standards Institute). Pretty much all modern C compilers conform to this standard so don't worry. It defines a few ground rules that make sure a simple program (such as the one I did earlier) should work everywhere.
C++ is a little more of a mixed bag when it comes to standardisation.

Hope this was useful ;-)
int p; // A