Author Topic: learning to program  (Read 9095 times)

0 Members and 1 Guest are viewing this topic.

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
learning to program
« on: August 13, 2007, 11:07:30 AM »
what is the best way to learn how to program.Is there a book or something i should start on...Thanks...

Offline elixier

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
  • http://www.techiesworld.org
    • http://www.techiesworld.org
Re: learning to program
« Reply #1 on: August 13, 2007, 12:05:05 PM »
I think no never go towards the bookish language take them only for help.
First of try to make your hardware fully correct and then go for coding the programming in what ever language you ko. but whenever you get time try to study some resource material on it.
http://www.techiesworld.org
  Techies Rules The World

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: learning to program
« Reply #2 on: August 13, 2007, 02:13:52 PM »
Well, I wanted to learn programming to build a full size robot. But I knew nothing about programming. And I did not understood anything I read on the net and in the books. The I have followed the advice of a pro: start with a simple language, do simple things first, then gradually go up a level. Then, when you will be able to change the language to a stronger one more easily and build your great project that you're dreaming!
So I have started with Basic and slowly changing it to C. And a little Java.
Check out the uBotino robot controller!

Offline jklv

  • Full Member
  • ***
  • Posts: 73
  • Helpful? 0
Re: learning to program
« Reply #3 on: August 13, 2007, 09:59:19 PM »
I can tell you by myself to start with JAVA, download jdk6 and a an IDE (a program to help you to program) like netbeans, I began learning to program 2 days ago (sunday 11, august 2007 x3) and I bealive I'm learning pretty well.

Here are some good info pages for JAVA wich I bookmarked for myself:

http://java.sun.com/docs/books/tutorial/index.html
The Java? Tutorials

http://www.apl.jhu.edu/~hall/java/
Java Programming Resources -- Java, Java, and more Java

Also if you still know nothing about programming you should try first by understanding common words like what algorythm means, what compiler means etc. So you don't get confused.
However this is my selfexperience and what I did when i knew absolutely nothing about programming, the closest to programming I knew was HTML code.
Hope that helps ;)

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #4 on: August 13, 2007, 10:59:22 PM »
an absolutely amazing IDE that I use is called "Eclipse" and its free and kicks *** when you have it

If you do download it, message me and ill give you the basics you need to know for starting projects and even give you some sample programs you can study and tweak as well as answer any Java question I can
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline awally88

  • Robot Overlord
  • ****
  • Posts: 212
  • Helpful? 0
Re: learning to program
« Reply #5 on: August 14, 2007, 08:57:06 AM »
Java is nice to start on, I found C confusing at the start and assembly stupidly baffling!  However if you want to program robots it is better to use C than Java

Java
Download Java SE v 1.6, check out the Java API, personally I'm not a fan of an IDE for Java but it can definitely help out when starting to program.
http://www.leepoint.net/notes-java/ <-- good for reference
http://java.sun.com/j2se/1.5.0/docs/api/  <-- Java God, it tells you everything about every function, dont start with it immediately though, it will scare you off the language!

Also just download a heap of code off the internet, use your FWSE to search for source code

I dont really have any links on hand for C/ assembly but a quick search will find them!

I can also help you out if you have any questions about Java in general

I hope this helps!
..aw4lly..

Offline Hal9000

  • Supreme Robot
  • *****
  • Posts: 338
  • Helpful? 0
Re: learning to program
« Reply #6 on: August 14, 2007, 02:41:06 PM »
I think everyone else is wrong, or at least right in some respects.

Put it like this, if you want to have a language which you can do both stuff on the PC AND for robots, C would be the one I would go for.

I would have appreciated learning C first myself.

There are some tutorials on www.sparkfun.com about the very basics of embedded programming.

I'd go for them if I were you. They sell the component packs too! Schweet!
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #7 on: August 16, 2007, 07:48:15 PM »
I liked what jklv said about java because it seems simple but others say i should start in c which sounds a little difficult for a noob like me... Can i start in java and switch to c later??also when i do start ill try that eclipse thing that dragon was talking about!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: learning to program
« Reply #8 on: August 18, 2007, 11:01:41 AM »
I started off with BASIC in the 80's . . . but never got more advanced till college where I took classes on C++

Then I picked up C on my own when I started making robots . . . C was real easy to learn after those C++ classes . . .

Personally, I find the best way to learn is a good teacher and lots of well commented source code to reverse engineer.

If you look at my $50 robot, you will notice the source code is designed to be reverse engineered. Change the code just a bit, load it up to your bot, and see how much faster (slower?) your robot rams into walls. :P

Offline sotu

  • Supreme Robot
  • *****
  • Posts: 350
  • Helpful? 0
  • ïBB - Eye Biped Bot
    • Easy Built Biped Bot
Re: learning to program
« Reply #9 on: August 19, 2007, 04:25:12 AM »
If you want to start out with C or C++ you may go to this site to start checking it out: http://www.cprogramming.com/
I just found it so haven't gone through all the pages but i will, couse i as many am really interested in learning how to write programming codes in C or C++. I also have a good C++ compiling software (free for download) which also works for C by the way, it fits all my needs. I cant seem to find the direct downloading site but i can try finding it!
How to build a biped bot:

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #10 on: August 21, 2007, 10:16:16 AM »
some say start with java some say start with c... i dont know what i should do...I just want something easy to learn that fufills basic programming needs... thanks...

Offline Fredrik Andersson

  • Robot Overlord
  • ****
  • Posts: 216
  • Helpful? 0
Re: learning to program
« Reply #11 on: August 21, 2007, 11:47:02 AM »
I don't know if im right, but i have allways seen C as one of the easier languages. Java is object oriented, and object oriented programmer is nothing you should grip directly. I haven't ever programmed in Java so i have actually no clue.

By the way, what's most difficult in programming isn't memorizing the syntax of the programming language. It's the parts like understand programming itself and how to create algorithms. Personally i haven't found that hard either. Porgramming isn't as hard as many people think. So, its more a matter of taste or needs than which language is easiest to start with.

How is it with microprocessors and programming languages? Which is most commanly supported? Java or C, or does it have any matter at all?
Current project: Pirrh - Portable Intelligent Round Rolling Hexapod

Offline Del

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: learning to program
« Reply #12 on: August 21, 2007, 12:13:02 PM »

Although not directly related to robot programming,
the following may be interesting to some:

http://www.welton.it/articles/language_popularity.html


Offline Gertlex

  • Supreme Robot
  • *****
  • Posts: 763
  • Helpful? 24
  • Nuclear Engineer · Roboticist
    • Index of Oddities
Re: learning to program
« Reply #13 on: August 21, 2007, 02:50:05 PM »
Java and C are both valid options.

If you go the Java route, I recommend BlueJ for a starting IDE (Integrated Developing Environment)... Eclispse is better, but also a much more confusing interface for a non-programmer.

You could also try Visual Basic .NET... It has the advantage of easy GUIs, extensive guides online, and the editor itself tells you, to a degree, what it expects you to type next.

You can find free books to read online for any of those langauges... If you stick to it, it's a good way to get a hold of the basics and learn how to think like a programmer.

EDIT: My biggest recommendation is going to be that you learn the fundamentals of programming... if loops, for, do..while, variable types... then look at example code and figure out what stuff is doing, and how.  Then choose a language and move on to learning about things like functions/methods (sort of the same thing, varies between languages), objects & classes, GUIs, error handling, threads, and whatnot. (that's the order I learned stuff in, I think)  Once you have a basis in these basics, you should be able to learn and find what you need for whatever applications you pursue.
« Last Edit: August 21, 2007, 03:46:02 PM by Gertlex »
I

Offline awally88

  • Robot Overlord
  • ****
  • Posts: 212
  • Helpful? 0
Re: learning to program
« Reply #14 on: August 22, 2007, 07:59:15 AM »
To sum up what everyone has said. Just learn C.


I like java but really for general purpose programming, getting a job, availability of source code, what all the cool kids do, just learn c.

Borland make a good compiler for it, your FWSE will be your best friend here. Good luck

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #15 on: August 22, 2007, 10:59:37 AM »
I just started learning C++ starting with CProgramming.com today and am already up to lesson 9. I do have quite a bit of prior programming experience so I guess that helps in understanding the lessons more (I was able to skip the loops, switch case, and if lessons because they are 100% identical to the way Java uses them).

For an IDE im just using Dev C++(Direct Download Link) because its VERY easy to use, has the compiler right in it,  has some basic syntax highlighting, and its completely free!

From a C++ noob to a C++ noob. I think this is the route you should go.


If you want you can also check out this IDE which has a lot more syntax highlighting and is technically free (says 30 day evaluation but apparently doesnt actually deactivate after 30 days, my friend is on day 1380 of the 30 day evaluation haha) It has syntax highlighting for multiple languages as well other than just C/C++. From the site:
Quote
EditPlus supports powerful and customizable syntax highlighting for HTML, CSS, PHP, ASP, Perl, C/C++, Java, JavaScript and VBScript by default. Also, you can create your own syntax file to support other programming languages.
Thats pretty sweet IMO... but your going to need a compiler which is why im using Dev C++...
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline Nyx

  • Robot Overlord
  • ****
  • Posts: 204
  • Helpful? 0
Re: learning to program
« Reply #16 on: August 22, 2007, 12:29:44 PM »
If you master C++, understanding any other procedural language like C and Java is going to be no problem. It is also the best language to know in terms of job opportunities, etc... I would also say that if you can program well in C++, you can program well in C, while the opposite is simply not true.

As for starting with "simple" languages, I would personally say it's mostly a waste of your time... Doing simple C++ programs is easy, and you can build on from there... Instead of getting used to features like garbage collection, automatic type conversion, etc... Which you will not have once you move to C or C++.

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #17 on: August 22, 2007, 08:25:45 PM »
so even though i am a total noob i can learn c++??? I have never done anything related to this so i am a total noob....I think i  will try c ++ because if i learn that i will no c and if i cant catch on i can always try another option. ;D Also i am going to check out that 1 thing dragon was talking about with lessons... Step by step is always very helpful for me... so i am hoping that the lessons are step by step. Ok thanks for all of the help!!!

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #18 on: August 22, 2007, 08:29:44 PM »
well i have not tried c++ yet i think i am going to try it tommorow... but b4 i do I was wandering if it would be too hard for a total noob... Im just looking for another opinion on c++. thanks.

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #19 on: August 22, 2007, 09:26:53 PM »
Based on the tutorials I told you(which Sotu has origingally posted a few posts up), I dont think you should have a problem with it at all. just make sure that after each lesson, you apply what youve learned so far. do the lessons code that it tells you to do (and read everything that explains each lines purpose and application) and just write some random little program that uses what youve learned so that way you get a better understanding of it.

If you have ANNNNYYY questions about it, DO NOT hesitate to ask me. You can always message me on MSN with any questions or send me an email. (My regular email is the same as my MSN email) which can be found on my SoR profile.
« Last Edit: August 22, 2007, 09:27:35 PM by HDL_CinC_Dragon »
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: learning to program
« Reply #20 on: August 22, 2007, 09:51:39 PM »
I'm going to chime in with my experience. I started with Java. Then I went to C++ which was (IMO) way more fun than Java, even though Java has a huge library. Next I went to C because it is the closest thing to the hardware and is still mostly portable. That and every OS I have ever used to develop real applications that depended on serious OS interaction (threads, serial, sockets, i2c, PWM, GPIO, A2D) was written in C, so using wrappers is inefficient in terms of execution speed (no doubt coding time is longer...). At my work right now we advocate Object Oriented design in C and the team I'm on is very strict about what may be allowed in MISRA C (safety critical C, really a subset of ANSI C) but would break with the Object Oriented paradigm.

My advice... Start with C++ and stick with it for a while, then do some C just to make sure you under stand low level interaction. After that you will have a better idea of where YOU want to go instead of just listening to every one else...

...and if you are really ambitious about learning how to program, grab some older hardware (1Ghz, 256mb ram, 10GB hard drive, CDROM) and use Linux to develop on. It may take time but the depth of knowledge you will gain from it will put you far ahead of the people who only use an IDE that does everything for them.

But start small...
Code: [Select]
#include <stdio.h>

/* Hello World Program*/
int main (void)
{
   char greeting[] = "Hello World!";

   printf ("Program Says: %s\n", greeting);

   return (1);
}
« Last Edit: August 22, 2007, 09:53:10 PM by JesseWelling »

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #21 on: August 23, 2007, 08:29:39 AM »
thanks for all of the help... i think i am going to use cprograming.com and dev c++ as my ide. the thing Jesse sounded interseting about the old hardware ... but i think that might be a little advanced.... Also dragon you said that i should make a little program after each lesson... I will know how to after each lesson right???Also how long will it take before i can write up a program like the 50 dollar robots or something useful?  thanks for all of the help!

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #22 on: August 23, 2007, 01:24:18 PM »
Wellllll that really depends on how well you take to the language. And by that I mean how fast you learn it, not by how fast you go through the tutorials ;)

It may take you a fair amount of time before you get really really good at the language. Im not that great yet either. But like almost anything, its takes a lot of time and practice to get good at everything. Just get through those tutorials and learn how the language works and some of the syntax and such. Then once your familiar with the language, all you need to know is the syntax that the micro controllers use and how they use them and youll be good to go. Plus you will know a practical language :) Just never give up on it though.
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: learning to program
« Reply #23 on: August 25, 2007, 10:55:42 PM »
http://www.linuxguruz.org/ebooks/eckel/TICPP-2nd-ed-Vol-one.zip

Thinking is C++ (volume 1) is a good place to start....

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #24 on: August 25, 2007, 11:02:22 PM »
I downloaded that a while ago and read it last week. I didnt like its approach to teaching the language so I deleted it.
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #25 on: August 30, 2007, 08:15:51 AM »
ummm dev c++ wont slow up my laptop will it... It asked me what i wanted with dev c++ so i just went with alll of the checked boxes just to be sure...

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #26 on: August 30, 2007, 08:29:52 AM »
Ok..... I just read the first part of the intro thing to cprograming.com c++ tutorial and it looks pretty confusing... I am not giving up though ;D. It just told me to copy and paste his program and compile it or something... @ least i can do that :D!

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #27 on: August 30, 2007, 08:40:00 AM »
Ok..... I just read the first part of the intro thing to cprograming.com c++ tutorial and it looks pretty confusing... I am not giving up though ;D. It just told me to copy and paste his program and compile it or something... @ least i can do that :D!
        Ok meybe i cant even do that idk how to make a file and put his code in it... 

The final brace closes off the function. You should try compiling this program and running it. You can cut and paste the code into a file, save it as a .cpp (or whatever extension your compiler requires) file. If you are using a command-line compiler, such as Borland C++ 5.5, you should read the compiler instructions for information on how to compile. Otherwise compiling and running should be as simple as clicking a button with your mouse.

Idk how to do that im using dev c ++ as my compiler... please help me... Meybe i should try something a little easier... idk tell me what you think.

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: learning to program
« Reply #28 on: August 30, 2007, 02:36:33 PM »
To have it display the line numbers
1) Go to the "Tools" menu
2) Click on "Editor Options"
3) Go to the "Display" tab
4) Check the box labeled "Line Numbers"
5) Click "OK"

To create a file
1) Go to the "File" menu
2) Expand "New"
3) Click on "Source File"

To create/run a project
1) Write or Paste your code in the white space
2) Go to the "Execute" menu
3) Click on "Compile"
4) Close the compile dialogue box when complete
5) Go to the "Execute" menu again
6) Click on "Run"
Or, instead of doing 2 through 6, you can do this:
1) Press F9 to compile AND run with one command
OR
1) Click the "Compile and Run" button on the tool bar :)
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: learning to program
« Reply #29 on: August 31, 2007, 08:02:10 AM »
thnks... do you think i should still try and learn c++? It looks kind of confusing but... i guess i just will do what it tells me and not try to figure out why and  try and manage to finish some of it.

 


Get Your Ad Here

data_list