Log in

View Full Version : Starting programming...


kenavt
20-05-2010, 20:15
Over the past couple of years, I have really been interested in getting started with programming, but I was usually too busy with some other extracurricular activities or school. Then, this year, I joined my school's FRC team, and I am really into robotics. This year, I was in charge of the layout and execution of the wiring on the robot. Next year, I want to help program.

With this goal in mind, I was wondering: what do you think would be the best way to get started into programming in general? I have had minor, minor experienced with C++* and a little bit more with LabVIEW** (which is what we use). However, I really want to take part of this summer to really get my fingers into programming, with the intent of being a help on the programming side to the team next year.

I don't really know where to start. I've looked through some of the official FRC documentation on LabVIEW, and that's about it. I'm sure you guys get asked this question a lot, so what should I do to start out?

*Wrote a program to randomly generate an integer using randl;, then user guesses the number and the program outputs how close you are (within 5, 10, 20, or outside 20).

**Wrote same program as above except using LEDs and indicators in LabVIEW, plus I hung out with our main programmer as much as possible so I picked up a couple of things.

davidthefat
20-05-2010, 20:26
I have a suggestion, go learn C++ from books, thats how I did it, and I ended up fine. May be they don't teach you how to program, but they teach you the basics. You just need to practice, practice programming text based games or something. Robots are different, I had trouble in the beginning with robots, since its different mindset, but just learn to program. Programming is how you think, not code on the computer screen. If you understand what I mean. The syntax is not the programming part, but the logic.

kenavt
20-05-2010, 20:36
I have a suggestion, go learn C++ from books, thats how I did it, and I ended up fine. May be they don't teach you how to program, but they teach you the basics. You just need to practice, practice programming text based games or something. Robots are different, I had trouble in the beginning with robots, since its different mindset, but just learn to program. Programming is how you think, not code on the computer screen. If you understand what I mean. The syntax is not the programming part, but the logic.

That's what I've heard a lot from our main programmer - it's about the logic behind it. My impression from using LabVIEW is that it is more about the logic then the syntax, while CLI languages you have to focus more on the syntax and the logic is more hidden. I've been looking at a couple of C++ books at my local library - that was what I thought I'd start out with first. Then, I'd like to mess around with a fun little cRIO control-system bot the team is building to really get the logic.

kgzak
20-05-2010, 20:38
Along with what davidthefat said, maybe your coach/mentor will give you a copy of LabView so you can play with that at home. Thinking like a programer might be the hardest part. I picked up on LabView, and other languages, very easily because I already thought like a programer, I just didn't know it. Have your programer show you some code and explain what it does and soon after you understand how that works try to decode some code without having the programer explain it. I worked with one of you programers at Kettering when we had issues with our watchdog, he knew a lot about LabView and he would be a good person to talk to. How did he pick up LabView?

kenavt
20-05-2010, 20:48
Along with what davidthefat said, maybe your coach/mentor will give you a copy of LabView so you can play with that at home. Thinking like a programer might be the hardest part. I picked up on LabView, and other languages, very easily because I already thought like a programer, I just didn't know it. Have your programer show you some code and explain what it does and soon after you understand how that works try to decode some code without having the programer explain it. I worked with one of you programers at Kettering when we had issues with our watchdog, he knew a lot about LabView and he would be a good person to talk to. How did he pick up LabView?

Luckily, I managed to grab a copy of LabVIEW for my laptop at home. You probably talked to another one of our programmers, who knew C++ and Java already if I remember correctly, so he just spent the '09 season messing around with LabVIEW and picking it up.

I'll definitely try trying to figure out code, probably from the examples included with LabVIEW (I can't have access to the competition code we used right away).

The real thing I want to do is learn more about "real" programming - CLI - than transition over to LabVIEW. I also have a question: Would it be better to learn C first, or C++? C is a good basic language, I hear, but C++ is more commonly used.

Chris27
20-05-2010, 20:52
I'd recommend against learning C++ as your first language. You should start with Java as you will encounter much fewer headaches and debugging code is a lot easier.

davidthefat
20-05-2010, 20:54
Luckily, I managed to grab a copy of LabVIEW for my laptop at home. You probably talked to another one of our programmers, who knew C++ and Java already if I remember correctly, so he just spent the '09 season messing around with LabVIEW and picking it up.

I'll definitely try trying to figure out code, probably from the examples included with LabVIEW (I can't have access to the competition code we used right away).

The real thing I want to do is learn more about "real" programming - CLI - than transition over to LabVIEW. I also have a question: Would it be better to learn C first, or C++? C is a good basic language, I hear, but C++ is more commonly used.

Eh, C is more for Robots since more robots are programmed in C, but I will have to say the mind set is different. C is procedural and C++ is object oriented. I started with C++ like I previously mentioned, its just C with more (hence the ++) so if you learn C++, you basically learn C plus more, but not really, the mind set is different. But surprisingly, when I first started, I started programming procedurally more than object oriented. Eh IDK you might want to start with C++.



edit: LOL at what Chris said, thats why I have an F in my AP Computer Class, it was so easy that I just slacked off... BAD IDEA... well good thing there is a project thats 70% of my grade, and its about the autonomous robot challenge

apalrd
20-05-2010, 20:55
I learned VB a long time ago. Thats why I didn't do any software stuff for a few years afterwards.

Then I learned C++ basics, like functions, variables, and cout/cin.

Then I joined my middle school's FLL team my 8th grade year. I quickly learned Mindstorms and actually hit the maximum potential of the language (that is not hard to do in Mindstorms). It was fun, and prepared me to think like a programmer more then I did previously. Freshman year on the Killer Bees, I learned LabVIEW, and although my code actually looked like spaghetti and had many issues, and was poorly organized, it worked. I wrote the crab steering code on our 09 robot, and it was later integrated into the rest of the code written by Jim (and probably re-written, I don't actually know what the final code looked like).

This year I made a much larger effort to organize my code, I wrote some software in the off-season to simulate arms and crab steering, and was the software lead (well, the only programmer).

Being a fairly high-level programmer, I was more interested in the algorithms, logic, and design of the code then the implementation. I am still good at writing it, but spend some time before writing it on organization and partitioning modules. I actually never used C for anything useful until 2009 OCCRA, on the VEX processor in Microchip C. And I learned a lot more then I want to know about pointers on that little VEX processor.

It depends on if you prefer higher level or lower level programming. If you already think like a programmer and focus on the logic, not the implementation, then LabVIEW is probably for you. If you prefer writing syntax and debugging lines of code, then C++ is probably best (better start with C-like code that dosen't use pointers or classes first, then work up to classes/namespaces and pointers).

davidthefat
20-05-2010, 20:58
(better start with C-like code that dosen't use pointers or classes first, then work up to classes/namespaces and pointers).

Dang it, I need to read up on namespaces more, I think I am missing out on some cool stuff.... ::rtm::

Greg McKaskle
20-05-2010, 20:59
Perhaps a year ago, someone mentioned the Project Euler site. This is similar to how I learned to program. Pick a language and take a crack at a few problems. Once you have your bearings, may I suggest trying one of the other languages, and perhaps even the third. Given a problem to apply your programming to, try out different tools -- video tutorials, written tutorials, examples, reference books, etc.

If math isn't your thing, obviously there are other good ways to learn how to program, but coming to grips with what is commonly referred to as scientific programming, or numerical programming is, I think, similar to much of what you'll see on the robot. Of course the robot will introduce you to many other concepts as well, but if you are good at the numerical stuff, I think you'll find the rest easy to pick up.

Greg McKaskle

Chris27
20-05-2010, 21:00
I started with C++ like I previously mentioned, its just C with more (hence the ++) so if you learn C++, you basically learn C plus more, but not really, the mind set is different.

Emphasis should be put on "not really." C++ is not just C with classes. They are completely different beasts.

kenavt
20-05-2010, 21:03
I learned VB a long time ago. Thats why I didn't do any software stuff for a few years afterwards.

Then I learned C++ basics, like functions, variables, and cout/cin.

Then I joined my middle school's FLL team my 8th grade year. I quickly learned Mindstorms and actually hit the maximum potential of the language (that is not hard to do in Mindstorms). It was fun, and prepared me to think like a programmer more then I did previously. Freshman year on the Killer Bees, I learned LabVIEW, and although my code actually looked like spaghetti and had many issues, and was poorly organized, it worked. I wrote the crab steering code on our 09 robot, and it was later integrated into the rest of the code written by Jim (and probably re-written, I don't actually know what the final code looked like).

This year I made a much larger effort to organize my code, I wrote some software in the off-season to simulate arms and crab steering, and was the software lead (well, the only programmer).

Being a fairly high-level programmer, I was more interested in the algorithms, logic, and design of the code then the implementation. I am still good at writing it, but spend some time before writing it on organization and partitioning modules. I actually never used C for anything useful until 2009 OCCRA, on the VEX processor in Microchip C. And I learned a lot more then I want to know about pointers on that little VEX processor.

It depends on if you prefer higher level or lower level programming. If you already think like a programmer and focus on the logic, not the implementation, then LabVIEW is probably for you. If you prefer writing syntax and debugging lines of code, then C++ is probably best (better start with C-like code that dosen't use pointers or classes first, then work up to classes/namespaces and pointers).

To be honest, I don't really know what is high level vs. low level programming. And, what I'd like to do, is be able to do CLI languages like C++ or Java in my free time, and then be able to switch over to LabVIEW for robotics. I think I'm going to just go with learning C++ out of a book while experimenting with LabVIEW at the robotics team meetings, and then move on to different languages.

I'd recommend against learning C++ as your first language. You should start with Java as you will encounter much fewer headaches and debugging code is a lot easier.

The thing is that I already know some C++ - std::cin and cout and if-then statements, and I feel I already have a grasp of the language. Then, maybe I'll move onto C and Java.

Chris27
20-05-2010, 21:06
The thing is that I already know some C++ - std::cin and cout and if-then statements, and I feel I already have a grasp of the language. Then, maybe I'll move onto C and Java.

Which is easily less than 1% of what there is to know about C++. Besides most of what you know now will transfer over to Java as C,C++, and Java share similar syntax. I'm just telling you from experience that C++ can quickly become a world of hurt.

davidthefat
20-05-2010, 21:08
Which is easily less than 1% of what there is to know about C++. Besides most of what you know now will transfer over to Java as C,C++, and Java share similar syntax. I'm just telling you from experience that C++ can quickly become a world of hurt.

To be honest with you, I never really understood the "::" until like a year ago:eek:

kgzak
20-05-2010, 21:20
Last year is when I started programing. I had never done any programing before that and our entire robot was programed by me last year. I learned Visual Basic at school and LabView at robotics that was as much knowledge I knew about programing. I would take all my robotics work home with me. That is how I learned. I think I learned as being a last resort but in the end found out I enjoyed it. So, I don't think it matter what language you learn first as long as you learn the basics of programing. I would suggest learning more about C++ if you feel you have a little knowledge about that. It may lead you into LabView.

kenavt
20-05-2010, 21:20
Perhaps a year ago, someone mentioned the Project Euler site. This is similar to how I learned to program. Pick a language and take a crack at a few problems. Once you have your bearings, may I suggest trying one of the other languages, and perhaps even the third. Given a problem to apply your programming to, try out different tools -- video tutorials, written tutorials, examples, reference books, etc.

If math isn't your thing, obviously there are other good ways to learn how to program, but coming to grips with what is commonly referred to as scientific programming, or numerical programming is, I think, similar to much of what you'll see on the robot. Of course the robot will introduce you to many other concepts as well, but if you are good at the numerical stuff, I think you'll find the rest easy to pick up.

Greg McKaskle

This sounds like a great site. Thanks a lot! It seems like a lot of the programming on the robot is numerical-related, I can see that could help me a lot.

Which is easily less than 1% of what there is to know about C++. Besides most of what you know now will transfer over to Java as C,C++, and Java share similar syntax. I'm just telling you from experience that C++ can quickly become a world of hurt.

I don't understand what you mean by that.

davidthefat
20-05-2010, 21:22
Last year is when I started programing. I had never done any programing before that and our entire robot was programed by me last year. I learned Visual Basic at school and LabView at robotics that was as much knowledge I knew about programing. I would take all my robotics work home with me. That is how I learned. I think I learned as being a last resort but in the end found out I enjoyed it. So, I don't think it matter what language you learn first as long as you learn the basics of programing. I would suggest learning more about C++ if you feel you have a little knowledge about that. It may lead you into LabView.

Here is what I don't get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me... Its like getting a Lambo then trading it for a Civic in my view... If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

Chris27
20-05-2010, 21:24
I don't understand what you mean by that.

I'm saying you won't have a head start in learning C++ over Java given that you know how to use if statements.

kgzak
20-05-2010, 21:32
Here is what I don't get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me... Its like getting a Lambo then trading it for a Civic in my view... If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

If that is what the team uses then I would learn it. Would you rather have a group of guys that can program in LabView or have one guy that can program in C++. I also don't see why C++ is any more powerful than LabView. I have written code more advanced than what one of our mentors did in C++ with LabView. I will say LabView is a little...silly? but I do the like how easy it is to debug and get live feedback. My question is why not learn both?

kenavt
20-05-2010, 21:32
I'm saying you won't have a head start in learning C++ over Java given that you know how to use if statements.

OK, well, thanks. However, I find that C++ is more widely used and would be more worthwhile. However, a "world of hurt" sounds like a good problem to solve!

Last year is when I started programing. I had never done any programing before that and our entire robot was programed by me last year. I learned Visual Basic at school and LabView at robotics that was as much knowledge I knew about programing. I would take all my robotics work home with me. That is how I learned. I think I learned as being a last resort but in the end found out I enjoyed it. So, I don't think it matter what language you learn first as long as you learn the basics of programing. I would suggest learning more about C++ if you feel you have a little knowledge about that. It may lead you into LabView.

Yep, that's what I'm thinking.

Chris Hibner
20-05-2010, 22:21
Whatever language you decide to learn first, I hope you enjoy the adventure. Learning programming will change your view of the world.

There is a fairly significant difference between object oriented programming and structured procedural programming. I would recommend learning each style fairly early on so you don't get too set in your ways before learning the other style (your head might explode otherwise). Object oriented and structured procedural each have their own place in the world and I don't see either of them dying in the near future.

Good luck.

Greg McKaskle
20-05-2010, 22:37
Here is what I don't get, ...
Even though I helped write LV, I don't feel the need to defend it. Results speak for themselves.

Do carpenters sit around arguing about things such as ...
"I hate nails -- primitive noisy hammering -- I will never use anything but screws in my construction. "
"All that twisting, how inefficient. A few taps and I'm done."
"Hrumph! Both of you. Neither of them works well with stone, and everyone knows..."

Perhaps they do, but for some reason it seems to be more prevalent with people who call themselves programmers. Languages come and go. Of the dozen or so languages I learned in and before college, only one of them still gets a bit of occasional use. Meanwhile, the concepts, the analytical problem solving skills, and perhaps most importantly, the ability to communicate with others about problems and solutions are the things that are still quite useful.

The best way to start programming is to start and never stop.

Greg McKaskle

Alan Anderson
20-05-2010, 22:37
Here is what I don't get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me... Its like getting a Lambo then trading it for a Civic in my view... If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

I think -- I hope -- that you're confusing LabVIEW with EasyC.

If you're comparing programming languages to vehicles, with C++ as a high-speed sports car, LabVIEW might be more like a helicopter. It's an entirely different kind of programming from a procedural language like C++ or Java, but it's just as powerful.

Actually, I'm inclined to liken C to a 1940's-era Jeep, designed to be small and nimble and capable of going off-road...but completely devoid of niceties like airbags and anti-lock brakes. :-P

davidthefat
20-05-2010, 22:41
Actually, I'm inclined to liken C to a 1950's-era Jeep, designed to be small and nimble and capable of going off-road...but completely devoid of niceties like airbags and anti-lock brakes. :-P

:ahh: Like the ones used by the marines in WW2, I like that analogy;)

Radical Pi
21-05-2010, 00:20
If you're just getting started with C(++), I'd reccommend learning C first. I personally think it is much simpler than C++ in terms of language constructs (not as much when you get into actual implementation) and I personally think it's better in getting you to "think like a programmer" as other people have said in this thread. Last week I was helping a friend learn Objective-C and because of the way the APIs are written (this was for iPhone) you can't really do anything without jumping directly into the object system in the language. The parts he was really having trouble with were the ones that OO languages make more complex (pointers, typecasting, objects (as opposed to structs), etc.), and would have been much easier for me to explain in plain C.

On the topic of LabVIEW, again I feel like it is a "programmer mindset" thing. With the closest thing to LV experience being NXT-G (which for those of you who haven't used it is MUCH more procedural than real LV), I was able to pick up the classmate and mess with the dashboard within 2 days, the majority of that time being the rewrite of the robot side dashboard sender (C++). Again, Having that prior experience programming really helps in switching out languages.

Oh and no matter what language you are learning, books and tutorials can only go so far. Real understanding of the language comes from looking at examples and analyzing every single line (or block) of code in it, knowing exactly how it works and what is happening in that line. That's where the "programmer's mindset" comes from. Not knowing to type in this line here, but knowing why typing this line here does what it does.

Ian Curtis
21-05-2010, 01:38
While finding prime numbers isn't particularly useful for driving robots, it is coding experience! As Greg mentioned, Project Euler (http://projecteuler.net/) gets you writing code to solve problems, and rewards your effort with little check marks. :D

Once you've solved them once, it's fun to go back and solve them in other ways too (MATLAB, Excel, Python, C, using an Arduino, etc.)!

mwtidd
21-05-2010, 10:30
OK, well, thanks. However, I find that C++ is more widely used and would be more worthwhile. However, a "world of hurt" sounds like a good problem to solve!.

"world of hurt" is a miserable problem to solve. Maybe its just because low level programming is not my particular skill set, but my C (C++) class took me about 50-60 hours a week alone. I passed the class by the grace of god and ironically with a C. Why may you ask, because of the "world of hurt". Debugging in both C and C++ is very time intensive.

Also remember that as you are in a FIRST thread you will see a particular bias. FIRST has an attraction to engineers, which computer science and programming stems far away from just engineering in the FIRST sense. Many developers working with hardware like to get as close to it as they can, hence why you see a lean towards C++ in this community.

Also this year is the first year FIRST officially supported java, last year the first for c++, before that it was C, and before that it was basic. your statement about it being more widely used is definitely true for FIRST right now, but not necessarily true as a general comment. Also I think that c++ is more widely used simply because it was the only alternative to labview last year. Many teams don't want to make the transition to java, as they have already invested in c++.

I am not going to tell you what language you should start with, I am just saying that realize that many of the comments you see here will be biased, including my own :)

Andrew Schreiber
21-05-2010, 10:57
Canada, 2337 will be running some training for programmers over the summer. I've just been busy with work and haven't worked it out with Clinton. As far as what you can do to get a jump on it. If you want to learn C++ there are a handful of books out there (check your local library). For Labview there are a series of tutorials available online. For Java, I'm not sure what resources exist but I have a handful of Java books I could loan you if you can't find anything. As far as I am concerned I will use whatever language the students want to use. At any rate, you can't go wrong with whatever language you pick. The thought process behind programming is the hard part. Run through Project Euler, finding primes has nothing to do with robots but it will teach you the syntax, it will teach you how to think through a problem too.

Good luck, have fun!


Here is what I don't get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me... Its like getting a Lambo then trading it for a Civic in my view... If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

You clearly know nothing about owning a vehicle. A person gets a Lambo to be flashy and fast. A person gets a Civic to be practical. I know during Michigan winters I would trade a Lambo for a Civic in a heartbeat. I would be spending more to repair the Lambo after it slid sideways into a pole anyway. It is all about using the right tool for the job. For some jobs it is C++, for others LV.

For example, I know C pretty well. I then proceeded to learn Labview, Python, Lisp, Haskell, Java, and C#. Why? Because I want to have a nice big tool chest for when I run into a problem. While I am thinking about it, David, prove to me that any one of these languages is more or less powerful than the rest. Then I will take your claims that C++ is better than LV seriously.

edit: LOL at what Chris said, thats why I have an F in my AP Computer Class, it was so easy that I just slacked off... BAD IDEA... well good thing there is a project thats 70% of my grade, and its about the autonomous robot challenge

You keep mentioning your failing in a bunch of threads almost as if you are proud that you had the stupid thought that you could slack off and not care. I'm not sure I really want someone who is proud of failing a class giving my students advice.

JamesBrown
21-05-2010, 11:09
Here is what I don't get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me... Its like getting a Lambo then trading it for a Civic in my view... If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

When I see posts like this it is always painfully obvious that the poster has not used LabView, and has certainly not actually tried creating the same program in LabView and C++ or Java and seen which one takes longer.

I learned C and C++ long before I started looking into LabView. I was pretty much forced into learning LabView (up until this point I thought that graphical programming was for people who couldn't handle learning real languages) when the "LabView Guy" in our lab graduated. I inherited his projects and started learning LV, after a couple of weeks I was capable of trouble shooting his software, by the end of the summer I was fairly proficient using LV. I can write code in a fraction the time it would take me in your choice of text based languages. I don't have to worry about a lot of things like parsing serial data because the tools are there for you. My favorite thing about LabView is that after the code is working with a few clicks I can create a pretty good looking GUI with graphs and charts that clearly show what is going on (try explaining to marketers and sales people that numbers in a terminal window are proof everything works.

In my current job I don't get to use LabView very often (4 bit micro controllers that cost <$.02 don't really run LabView code). I spend my day writing in C and Assembly (and all sorts of proprietary interpretations of C). I have all the control in the world over my micro controllers, however I would not equate the experience of going from LabView Back to C to going from a Civic back to a Sports Car. C (or C++) may be fast and efficient but it is not a Lamborghini, it is more like a stripped down race car, built for performance, it may perform better but it is uncomfortable to drive, labview on the other hand would be your Luxury performance car, it might not be as efficient as a sports car but it is much faster than 99% of drivers will ever need it to be, and all of the luxuries and conveniences greatly out weigh the marginal performance increases.


For example, I know C pretty well. I then proceeded to learn Labview, Python, Lisp, Haskell, Java, and C#. Why? Because I want to have a nice big tool chest for when I run into a problem.

I am still waiting for the day I find a problem that requires me to use Haskell, I had to learn it for a class and am yet to find a situation to apply that knowledge (ProLog falls into this category too).

rsisk
21-05-2010, 11:20
Learning a particular programming language is no where near as important as learning the basics of programming.

For example, learn some of the basic programming structures like:

Sequential code
Subroutine
GoTo or Jump
If-then-else
Case
Do While-Do Until


Learn how to define a problem through reiterative decomposition, a fancy way of saying: break down a problem into smaller components until you can solve it

Learn good programming practices like code reuse, code refactoring, encapsulation. There is a lot of good practices in the object oriented realm to help you write good reusable code.

Know your problem domain. If you are writing code for robots, you need to know different things than if you are writing code for an accounting system. I have yet to use the concept of debits and credits when writing for our robot, and never once needed to filter the noise out of a potentiometer for a AR Aging report ;>

So focus more on the fundamentals of programming, after that, picking a language is usually driven by the environment you are working in, or what you have available at the time. But if you know the fundamentals, it doesn't really matter much which language you end up in.

kenavt
21-05-2010, 22:34
Canada, 2337 will be running some training for programmers over the summer. I've just been busy with work and haven't worked it out with Clinton. As far as what you can do to get a jump on it. If you want to learn C++ there are a handful of books out there (check your local library). For Labview there are a series of tutorials available online. For Java, I'm not sure what resources exist but I have a handful of Java books I could loan you if you can't find anything. As far as I am concerned I will use whatever language the students want to use. At any rate, you can't go wrong with whatever language you pick. The thought process behind programming is the hard part. Run through Project Euler, finding primes has nothing to do with robots but it will teach you the syntax, it will teach you how to think through a problem too.

Good luck, have fun!
Thanks, Schreiber, I can’t wait for that. I wouldn’t mind borrowing a Java book (perhaps later on in the summer) if you don’t mind.
Learning a particular programming language is no where near as important as learning the basics of programming.

For example, learn some of the basic programming structures like:
Sequential code
Subroutine
GoTo or Jump
If-then-else
Case
Do While-Do Until

Learn how to define a problem through reiterative decomposition, a fancy way of saying: break down a problem into smaller components until you can solve it

Learn good programming practices like code reuse, code refactoring, encapsulation. There is a lot of good practices in the object oriented realm to help you write good reusable code.

Know your problem domain. If you are writing code for robots, you need to know different things than if you are writing code for an accounting system. I have yet to use the concept of debits and credits when writing for our robot, and never once needed to filter the noise out of a potentiometer for a AR Aging report ;>

So focus more on the fundamentals of programming, after that, picking a language is usually driven by the environment you are working in, or what you have available at the time. But if you know the fundamentals, it doesn't really matter much which language you end up in.
Oh and no matter what language you are learning, books and tutorials can only go so far. Real understanding of the language comes from looking at examples and analyzing every single line (or block) of code in it, knowing exactly how it works and what is happening in that line. That's where the "programmer's mindset" comes from. Not knowing to type in this line here, but knowing why typing this line here does what it does.

Thank you very much! That seems to be how to really become a programmer, especially from what I’m hearing from everyone. Thanks a lot, guys!
Just a quick question: What is the difference between high-level and low-level languages? Thanks!

Radical Pi
21-05-2010, 23:01
Thank you very much! That seems to be how to really become a programmer, especially from what I’m hearing from everyone. Thanks a lot, guys!
Just a quick question: What is the difference between high-level and low-level languages? Thanks!

In general, a high-level language abstracts you from the hardware and how it actually works. LabVIEW is a big one, Java too, C++ is somewhat up to this level. low-level languages are ones that expose all of the power of the machine to you, but a side effect of that is making the programming much, much harder (assembly for example)

Andrew Schreiber
22-05-2010, 03:10
I am still waiting for the day I find a problem that requires me to use Haskell, I had to learn it for a class and am yet to find a situation to apply that knowledge (ProLog falls into this category too).

I know the feeling, Haskell feels powerful but I have never found a good problem for it. Prolog might be able to guess at alliance selection orders if you could nail down the right rules. (I have some work done in Lisp on this but it was the end of term and I was exhausted) Actual thought from earlier today, "What do you mean I have to define the data structure? It is just a freaking tuple!"

Tom Bottiglieri
22-05-2010, 04:01
For example, learn some of the basic programming structures like:

GoTo or Jump


Don't use that.

rsisk
22-05-2010, 12:05
Don't use that.

I agree you shouldn't have a need for a GoTo, but it is a fundamental programming structure and you should know it.

Most of the times a jump is needed is already dealt with by the compiler, such as in Try/Catch blocks, subroutine returns, jump tables, etc. In these cases, the compiler will generate a jump instruction in the low level language to perform a high level function.

Using a GoTo in your code tends to indicate poor coding and sloppiness. If you find you need one, review your code and try to find a better way to code it.

Alan Anderson
22-05-2010, 15:00
I agree you shouldn't have a need for a GoTo, but it is a fundamental programming structure and you should know it.

I disagree. It is not a programming structure at all. If you want to learn how to program, it should not even be mentioned.

The distinction I wish to make is between programming and coding. Programming involves analysis of the problem and design of a solution, including the algorithms and data structures used in the design. Coding merely implements a solution on a specific target. There can be valid reasons for including unconditional jump instructions in an particular implementation, but I do not think they are ever warranted in a program's design.

Ether
22-05-2010, 21:28
There can be valid reasons for including unconditional jump instructions in an particular implementation

Steve McConnell gives an excellent example on Page 352 of his classic book Code Complete


~