Amiga.org
Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: nasty on December 31, 2005, 11:17:32 PM
-
Hey guys, we'll this is gonna be my last post of 2005 and i thought it should be something abit better than I'm having trouble with ......... (well you seen my posts :-D )So my question is what is the best program to learn coding on and do you know of any guides for learning to program?
-
My advice would be to learn something universal and portable like C.
There's plenty of "teach yourself" books and websites available, but you need an overdose of motovation and self discipline to get through most of them.
As with most things, it's a major learning curve to begin with and very frustrating, but once you understand the basics, you suddenly just click and everything starts to makes sense.
I took a part time beginners C course at Polytech, was the best thing I ever did. Made the learning process so much easier. That would be my #1 suggestion for learning a new language.
As for Amiga programming, I use SAS/C but there are other freeware(?) compilers like GCC and Dice, though I've not used them. Also there is Storm C from H&P which is supposed to be OK.
Last bit of advice, don't set your expectations too high. Many beginners have this misconception they'll be writing Quake 4 within a few months months of learning C. That isn't going to happen :-) Start simple and progress your way through simple text user interfaces, eventually moving onto ReAction/MUI GUIs and the likes.
Hope that helps. And happy new year!
-
This could be my last reply of 2005 :-)
I second the thoughts of Castellen. C (and C++) is the way to go these days for Amiga programing. It's another argument if it's the "best" or not, but it's definitly one of the most used languages right now in Amiga, linux, unix and even windows. Everyone will have suggestions on the best book to start with. I've found that you have to find the right one for the way you learn. What's great for me might be horrible for the next person. The "C bible" is called "The C programming language" by Dennis Ritchie. Most will tell you this is a must have and I agree. But it's not an easy book for the newbie. Personally I liked the book called "C by Dissection". You can read about these and others on Amazon.com. Then you can find the best prices on the same books at bookpool.com. Once you know C, the journey's not over yet. You'll then need to look up Amiga reference docs to figure out how to apply your new C language in the Amiga OS. Some take to C like fish in water, for me it was harder, and still others find it impossible. Good luck and studies if you decide to take it on.
Plaz
-
Agreed, Dennis Ritchie's book (K&R) is probably one of the best C references available, though probably not overly useful for the beginner.
One of the learning C books recommended by many is "Teach yourself C in 24 hours" by Sams Publishing.
It takes you through 24 x 1 hour lessons.
I tried it, but I always ended up not quite understanding things properly, hence the Polytech course I took where the tutor gave a good explanation to my many questions. Worked out well as I'm as thick as a whale omelette at the best of times :-)
Took me a few months to actually get the hang of it though as I'd programmed in BASIC and Motorola assembly before, C was a completely different approach on everything I'd ever known about programming.
There's also a Yahoo mailing list called amiga_bcg which an Amiga specific C programmers group. It's a good place to seek answers to C questions in general as well as Amiga specific programming.
-
I've come to the conclusion C is evil... The ROOT of all computer evil. Programs were small and tight when everyone had to code in assembler for space and speed purposes. Now we have our gigs of RAM and terabytes of drive space... Our machines are faster, but our programs aren't... They are bloated and slow.
Sure, assembly programs a not portable... But when you're coding for a specific platform for your own enjoyment, who cares?! Those who run slower machines will thank you.
-
I've come to the conclusion C is evil... The ROOT of all computer evil.
Hear, Hear! But I didn't want to compicate his day by adding "If you learn ASM first, every thing else is easier to learn, but it's not portable." :-)
I think C can be good when you learn to mix it with ASM. (though it will always be a bit bigger and slower). It definitly turns fully evil easily in the hands of a bad or malicious coder.
Can you imagine the look on the face of a VB programmer if you told them the had to learn ASM and the architecture of the hardware first? :lol:
Plaz
-
I've come to the conclusion C is evil... The ROOT of all computer evil. Programs were small and tight when everyone had to code in assembler for space and speed purposes. Now we have our gigs of RAM and terabytes of drive space... Our machines are faster, but our programs aren't... They are bloated and slow.
First, ask yourself what you intend to write, then choose a language.
The nice thing about C compared to ASM is that it teaches you not to think too much about the hardware and more about what you are doing. Programming languages are really supposed to do that. I think things really began to bloat out of control when OOP showed up, and it became "trendy." It has its uses, but most of the time, people use it when they shouldn't.
Bloat is caused by bad technique or using tools too complex to suit the job. Using a 50+MB package like Perl, or forcing an app to behave like, or actually use, stateless web tools comes to mind. Don't spend time with ASM unless you intend to make 4K demos. ;-)
Personally, I think C++ should be replaced with a new interpreted language but without all the Virtual Machine toolkit crap like your typical 100+ MB Java installation. C should be used only for low-level stuff. ASM should be outright banned for anything other than games or architecture toolkits (like endian conversion).
As for books, I'm afraid all I know about programming I picked up myself. I got into refactoring other people's projects, so I learned most lessons the hard way. Nothing teaches you what NOT to do than to pick up someone else's rotten code. :-)
If technique is your question, rather than style or syntax, I recommend "The Art of UNIX Programming" by Eric S. Raymond. An online version is here (http://www.faqs.org/docs/artu/). It's easy to follow for newbies.
Can you imagine the look on the face of a VB programmer if you told them the had to learn ASM and the architecture of the hardware first?
You know, all BASIC spinoffs look wretched to me, now. I started on AMOS and Blitz basic, and I find it remarkable that these languages had no sense of modular programming and basic function calls. AMOS was written in assembler, after all. I have no idea why having integrated BASIC was so damned important for most early 8-bit systems, and why they still teach kids how to program in BASIC in high school.
-
Actually I liked BASIC... I found it much easier to swallow C and PERL having been familiar with the structures used in BASIC. I think that was actually the logic in including it with all the old systems... To get people to think about programming.
[RANT]
Me myself personally, I don't believe anyone should be allowed to purchase a computer without learning DOS and BASIC inside and out. A computer operators license!
[/RANT]
Sorry, I've been having flashback-nightmares of my end-user tech support days lately. I was on the front lines when Win95 came out! PTSD anyone?
-
Dr_Righteous wrote:
Actually I liked BASIC... I found it much easier to swallow C and PERL having been familiar with the structures used in BASIC. I think that was actually the logic in including it with all the old systems... To get people to think about programming. [end quote]
Looking at all the languages available to start my 12 year old son learning on, I have been leaning toward AMOS Pro or Blitz Basic then moving on to SAS-C, GCC or Storm-C. I believe Blitz Basic is also available on the PC after he starts his programming on our many Amigas (since I already own all of the above languages for Amiga and GCC is free).
-
C is a good general purpose language but it isn't for beginners. I'd recommend learning to write scripts in Python first then move on to C.
Are you going to be using a PC first and then moving on to the Amiga? If so the PC version of Python is here (http://python.org/) and the classic Amiga version is here (http://www.monkeyhouse.eclipse.co.uk/amiga/python/). Finally the textbook to help you learn Python is online: How to Think Like a Computer Scientist: Programming with Python (http://greenteapress.com/thinkpython/) as either a web page or a .PDF file.
If you'd rather start out in C++ the textbook for that is How to Think Like a Computer Scientist: Programming with C++ (http://greenteapress.com/thinkcpp/). But be sure to get the C++ Standard Template Library before using this book as it needs it badly.
-
SamuraiCrow wrote:
C is a good general purpose language but it isn't for beginners. I'd recommend learning to write scripts in Python first then move on to C.
Are you going to be using a PC first and then moving on to the Amiga? If so the PC version of Python is here (http://python.org/) and the classic Amiga version is here (http://www.monkeyhouse.eclipse.co.uk/amiga/python/). Finally the textbook to help you learn Python is online: How to Think Like a Computer Scientist: Programming with Python (http://greenteapress.com/thinkpython/) as either a web page or a .PDF file.
If you'd rather start out in C++ the textbook for that is How to Think Like a Computer Scientist: Programming with C++ (http://greenteapress.com/thinkcpp/). But be sure to get the C++ Standard Template Library before using this book as it needs it badly.
We will be starting him on the Amiga with an easy language to learn the logic of programming, then move on to C, C++ on the Amiga and finally on to the PC for DOS, Windows and Linux programs. I have the programs, books and Amiga machines and the interest in Amiga, plus there is so many PD programs for the Amiga that have source code available to look at, it will help in the learning process. Not interested in it for financial gain, just trying to expand his twelve year old mind to see the immense possibilities available. :-)
-
nasty wrote:
Hey guys, we'll this is gonna be my last post of 2005 and i thought it should be something abit better than I'm having trouble with ......... (well you seen my posts :-D )So my question is what is the best program to learn coding on and do you know of any guides for learning to program?
Ive been asked this question a countless number of times over the years, and nobody ive ever heard ask this ever persued the subject. I'm not saying you are gonna do this, and i hope you do persue some programming, it's a lot of fun and it really expands the ammount of stuff you can do with your machine.
Honestly, it doesnt matter which language you start off with, as long as you dont give up when your program doesnt run the first 10 times you try.
Most of the time people give up because they trip up on language syntax. It's highly annoying for a newbie to remember to end every line with ';' and the {} stuff and all that. the '#' stuff for the preparser and the like.
Dont spend too much time learning language specifis, learn how to program instead. Learn several languages at once. Most languages are awfully similar, though each one stressed ceertain concepts, which once you learn, you can apply them towards any language...
-
C / C++? Pah! Get down and dirty, and get awsome speed with pure ASM code. :-D
-
Whatever you, do not start with assembler. I'd recommend C, it has most in common with other languages and gives most benefit overall. C has excellent education material, books, online tutorials etc available.
Later you probably want to look into other languages aswell, and eventually also assembler (maybe m68k, it's one of the easiest and most logical ones).
-
Thanks guys for all the 2 cents/pennys/rubys and anything else there is :lol:, its most useful
-
It depends.
If you don't want to invest huge amounts of time I'd go for Blitz Basic (it's freeware now IIRC so you've got nothing to lose in trying it). You can do some quite complicated things rather easily. It's fun to mess around with, and you can dip in and out whenever you want.
However Blitz Basic won't really satisfy you if you have bigger aspirations, while there have been some applications written using Blitz Basic (BlackIRC springs to mind) you're better off with C. There are other advantages such as being cross-platform.
If you do decide to go with C, I have 2 bits of advice:-
1. It's tough, you won't create anything interesting for ages. Stick with it. You won't get anywhere until you understand the core concepts thoroughly.
2. Don't rely on just one book, none of them cover everything, and there are various ways to skin a cat. The biggest mistake I made when learning C was that I only had one, book which it turned out missed a lot of important stuff. It always helps when you have differing explanations anyway.
-
Greetings,
Not to Hijack the thread...
I hate doing things the easy way, I learn best by trial and error and by example(poor or good). Can someone point me to some well documented C or C++ examples of Amiga code?
Thank you and Regards,
AmigaEd
-
I started with Basic (AmigaBASIC of course!) but when I started my job after school I picked up a copy of Practical C Programming (link (http://www.amazon.com/gp/product/1565923065/103-6561558-7707064?v=glance&n=283155)) and basically learned C in a few weeks -- I highly recommend this book to anyone looking to learn; it teaches C but also some good programming practices and debugging strategy, and does it all without being too boring :)
-
@AmigaEd
I've taken Structured Programming courses on C where we were taught that good programming techniques involve:
- Planning exactly what you're going to do before writing any code (using flow charts, design structure diagrams)
- Using a "top down" approach to programming so that you can see the big picture of what's going on
- Structuring code with good commenting, tidy layout, non-cryptic names for variables, etc
There's a bit more to it than that of course, which pretty much applies to any code, not just C.
If you want an example of some C code written for AmigaOS, here (http://amiga.serveftp.net/Temp/w3s_logwrite.C.txt) is a small program I wrote this morning.
It's hardly the most advanced or best written code on the planet, but it's simple, easy to read through, easy to maintain and works OK.
In fact by downloading from that link above, you'll be executing the compiled version of it, proving for yourself that it does in fact work :-)
-
An additional warning about using C, C++ and other similar langauges..... The libraries.
The good .... The libraries save you tons of time by making available prewritten modules that can do a lot of work for you. No need to "reinvent the wheel". Just call the appropriate function/method in the correct library and off your program chugs. Many times it may not even be necessary to know what's in the lib, only that you know what data to send it. (Super simplified analogy!)
The bad (IMHO) .... The libraries are typically written by a coding guru or group of gurus. Some libs are simple and do simple jobs. Others are very indepth, read like egyptian hyrogliphics and do "magical" things to data and hardware. The libs are important to know and use. Many times you have to use non-standard libs written by other developers so it may be necessary to read through them and their docs. As a newbie I found many of them hard or impossible to read for some time. It was a great frustration that I wasn't warned about when I got started and I think it could be one of the road blocks that crash many a newbie.
Each OS has it own libs that you need to know and access to make your code hum and keep it compliant accross platforms. A lib that does a graphic in linux, doesn't necessarily apply to Amiga, MOS, MUI or windows and vi-see-versa. You learned a lib that came from AmigaOS2.x, but you may have to relearn the lib for OS4, or even a totally different lib if the program is going to try and use MUI.
So just keep in mind these extra parts and you'll do ok. I really hit a frustrating wall when the libs showed up. I thought I was just going to write all my own code as I used to do in ASM and basic. Nope, those darn pesky libs are going to be part of your C/C++ world. I can only suggest that you get good with the programming syntax. Be a great reader. It's much like reading a novel you've never seen before. Learn your language well and no matter what book you read, you will always be able to understand the story.
@thread
Thanks for some other good tips and suggestions I think I'll use a few of them myself.
Plaz
-
Castellen,
I tried to download your code example from your link but I can seem to get it to download.
Anyway, Yes, I agree that the well thought out, planned, approach is best. But, I'm just looking to see some examples of code that will help me see how the Amiga code "ticks" and that will give me something to change, modify and try different things.
I'm not a C programmer, but I've done some coding in the past. Even wrote some ASM programs for the Amiga 20 years ago. I just need to start jogging my brain.
I have downloaded the AmiDevCpp development environment and it looks pretty nice, but seems that much of the docs are in German. I can read some of it, but not enough. I would like to get some code examples that will compile under AmiDevCpp. I can then run the programs using WinUAE or A1200, A600, A500, A2000, A1000, CDTV, AROS, Etc.
Thank You,
AmigaEd
-
Sorry, I typed the link name wrong.
Try this instead (http://amiga.serveftp.net/Temp/w3s_logwrite.C.txt).
Forgot to mention as well, if you're looking for a simple, free text editor with C (and HTML) syntax highlighting, give TuiTED (http://tuited.hd-rec.de/) a try. Needs a bit of configuration via tooltypes to get it nice, but it does a good job despite being a beta release.
I've just spent the last 2 months writing embedded C for the Motorola 68HC11 using it.
-
Castellen,
Thanks, got it downloaded and will look it over a bit later this evening? Any ideas where I can find some more examples that I can download?
Regards,
AmigaEd
-
Aminet contains plenty of programs which include source listings.
Unfortunately many of the sources aren't very well structured and have little if any commenting, so trying to read through and understand them is not as simple as it could be.
Of course there are some sources on Aminet which are very well written.
If you want, I could email some of the C sources I've written over the years. They range from fairly good to pretty crap :-)
Here's a tip for you:
If you can read through the source and understand what it's doing without too much hasstle, then chances are it's been well structured and layed out.
It also helps to view C source with an editor which does syntax highlighting, such as TuiTED or GoldEd AIX. Specific parts of the text being different colors help a lot.
-
Castellen,
I've sent you a PM....
I have GoldEd, somewhere I've got TuiTed squirled away, but the AmiDevCpp environment also has syntax highlighting.
I did start looking around Aminet but it's difficult to tell if its worth the time to download some of the files or not.
Regards,
AmigaEd