Quantcast

Jump to content


Photo

General tips for a beginner programmer


  • Please log in to reply
13 replies to this topic

#1 jonnykun

jonnykun
  • 403 posts


Users Awards

Posted 26 January 2010 - 12:18 PM

i've started taking a course on programming java, and i feel so overwhelmed at the many different things java, or programming in general, can do. can any of you relate/provide some tips as to how i can maximize my learning in this language? or just any tips in programming that you could share with me.

#2 Andy

Andy
  • 226 posts

Posted 26 January 2010 - 03:30 PM

kk, Try this. Abandon java. Unless you are developing for a mobile phone, and I'm not talking about the iPhone or an Android handset, do not bother with Java. While it's use for developing web applications used to be common, now java applications on the web have become somewhat annoying, unless of course it is a game or something.

For a beginner, java will appear very complex and is also very verbose.

For example, compare these two peices of code. Both do the exact same thing.

Java
class HelloWorldApp
{
    public static void main(String[] args)
    {
        System.out.println("Hello World!");
    }
}
C++
#include <iostream>
using namespace std;
int main()
{
    cout << "Hello World!";
    return 0;
}

Both use 6 lines of code, but C++ by far requires the least amount of characters. While many people say C is difficult to learn, I have found that it by far has the smallest learning curve. Combined that with the fact that C++ is far more powerful...

However, no matter which programming language you choose, remember these important points:
  • Consistency. While you are learning your coding style may change over time. But once you finally find a style you are comfortable with, stick with it.
  • Neatness. This goes with your coding style. Make sure you make good use of indentation and don't put too much code on one line
  • Well named variables. NEVER EVER name your variable nondescript things such as 'a' and 'b', because it will make your code harder to read by yourself and others.
  • Commenting. Always comment your code, even if you have no intention of sharing it. It will make your life much much easier. By using well named variables, you can reduce the amount of comments you write to a degree...
  • Don't expect to program the next Microsoft Office. That will come later ;)

Edited by Andy, 26 January 2010 - 03:31 PM.


#3 Scot

Scot
  • ≡^ᴥ^≡

  • 3935 posts


Users Awards

Posted 26 January 2010 - 05:07 PM

I learned java before C++ so I make more sense out of the first snippet. C++ is so much more archaic.

#4 Melchoire

Melchoire
  • 5284 posts


Users Awards

Posted 26 January 2010 - 05:24 PM

With me, there was a moment where everything just "clicked" together and started making sense all at once. Before that I just read a bunch of books and practiced =p

#5 jonnykun

jonnykun
  • 403 posts


Users Awards

Posted 27 January 2010 - 01:57 PM

thanks for the tips, i'm glad to know that lothers share my feeling that earning programming isn't easy. it's like learning a whole new language. just gotta keep practicing and it'll come together. thanks guys

#6 93dcthugs93

93dcthugs93
  • 72 posts

Posted 27 January 2010 - 02:31 PM

thanks for the tips, i'm glad to know that lothers share my feeling that earning programming isn't easy. it's like learning a whole new language. just gotta keep practicing and it'll come together. thanks guys



Ill give you a hand just add me on MSN or my aim is therealdcthugs93 MSN is [email protected]

#7 Andy

Andy
  • 226 posts

Posted 27 January 2010 - 09:49 PM

In the end the only way to learn programming is to write programs, start off with easier stuff and move upwards from there. When you feel confident, try writing a program for yourself. And you will learn heaps by doing so. Remember that the internet has a reference for just about every single function for every single language so don't forget to google something you don't understand.

#8 artificial

artificial
  • 186 posts


Users Awards

Posted 28 January 2010 - 03:55 AM

I started mucking about with programming around eight years ago now, and while at the moment I'm no expert, programming is how I bring in the dosh, so I know something. From what I've seen, there are two types of amateur programmers. The jack-of-all-trades, who learn a little about a lot, and those who stick with one language for years and really nail it. I really suggest you abandon the former approach, and go with the latter.

Not only will sticking with one language pay dividends in turns acquired knowledge (you will be able to develop relatively advanced applications, great skill to have on a resume, plus you'll be able to freelance and earn some money), but it will make learning other programming languages that much easier. For beginners, the hardest thing I've witnesses to become accustomed to is the syntax and the programming process that you have to go to (i.e. outlining your problem, and deciding how you're going to tackle it). If you picked an OOP language to start, it really will make moving on to another language about 100x easier. For example, all OOP language syntax is extremely similar. So if you learned c++, it would be easy to progress to, say Java, PHP, Actionscript, Python, etc.

A programming language is similar to an actual language, in that mastering it comes down to practice, repetition and understanding. There's no use using code that you've copy & pasted from the internet without proper understanding on what it does. So, if there's something you're unsure on, take the time to carefully read through it and ask questions.

Good luck.

#9 Andy

Andy
  • 226 posts

Posted 28 January 2010 - 04:22 AM

Oh and another thing, don't try and reinvent the wheel. Alot of amateur programmers make their own libraries for things which have already been done thousands of times! And to be honest, turns out to be a complete waste of time. I fall to this trap all the time!

Edited by Andy, 28 January 2010 - 02:43 PM.


#10 pyke

pyke
  • 13686 posts


Users Awards

Posted 28 January 2010 - 08:32 AM

Keep reading and constantly practice to keep your mind sharp for coding.

#11 Dan

Dan
  • Resident Know-It-All

  • 6382 posts


Users Awards

Posted 16 February 2010 - 05:50 AM

kk, Try this. Abandon java. Unless you are developing for a mobile phone, and I'm not talking about the iPhone or an Android handset, do not bother with Java. While it's use for developing web applications used to be common, now java applications on the web have become somewhat annoying, unless of course it is a game or something.

Java has its uses outside of android and web-based game development.

For a beginner, java will appear very complex and is also very verbose.

For a beginner, most things will appear very complex - and verbosity is perspective

For example, compare these two peices of code. Both do the exact same thing.

Java

class HelloWorldApp
{
    public static void main(String[] args)
    {
        System.out.println("Hello World!");
    }
}
C++
#include <iostream>
using namespace std;
int main()
{
    cout << "Hello World!";
    return 0;
}

Both use 6 lines of code, but C++ by far requires the least amount of characters. While many people say C is difficult to learn, I have found that it by far has the smallest learning curve. Combined that with the fact that C++ is far more powerful...

Every language has its own learning curve, but learning cannot be measured or compared between people - it's all very personable.

However, no matter which programming language you choose, remember these important points:

  • Consistency. While you are learning your coding style may change over time. But once you finally find a style you are comfortable with, stick with it.
  • Neatness. This goes with your coding style. Make sure you make good use of indentation and don't put too much code on one line

Agreed

  • Well named variables. NEVER EVER name your variable nondescript things such as 'a' and 'b', because it will make your code harder to read by yourself and others.

To an extent. Single character variable names are acceptable when being disposed after a short period of time - ie a for loop, foreach, etc

  • Commenting. Always comment your code, even if you have no intention of sharing it. It will make your life much much easier. By using well named variables, you can reduce the amount of comments you write to a degree...

Good code is self-documenting - to an extent. This doesn't mean you shouldn't have any need to comment your code, it means you should write code good enough to need a minimalistic amount of comments.

  • Don't expect to program the next Microsoft Office. That will come later ;)

Don't program office. Contribute to OpenOffice.org :)


I started mucking about with programming around eight years ago now, and while at the moment I'm no expert, programming is how I bring in the dosh, so I know something. From what I've seen, there are two types of amateur programmers. The jack-of-all-trades, who learn a little about a lot, and those who stick with one language for years and really nail it. I really suggest you abandon the former approach, and go with the latter.

Not only will sticking with one language pay dividends in turns acquired knowledge (you will be able to develop relatively advanced applications, great skill to have on a resume, plus you'll be able to freelance and earn some money), but it will make learning other programming languages that much easier. For beginners, the hardest thing I've witnesses to become accustomed to is the syntax and the programming process that you have to go to (i.e. outlining your problem, and deciding how you're going to tackle it). If you picked an OOP language to start, it really will make moving on to another language about 100x easier. For example, all OOP language syntax is extremely similar. So if you learned c++, it would be easy to progress to, say Java, PHP, Actionscript, Python, etc.


Agreed. Inheritance / Polymorphism / Encapsulation / Abstraction are all very generic - OOP is simply a set of guidelines that languages abide by, that make it easier for you to use, reuse and manage objects in your code easily. Think of it as a giant design pattern.

A programming language is similar to an actual language, in that mastering it comes down to practice, repetition and understanding. There's no use using code that you've copy & pasted from the internet without proper understanding on what it does. So, if there's something you're unsure on, take the time to carefully read through it and ask questions.

Good luck.


Couldn't have said it better myself.




#12 DarkVision

DarkVision
  • 73 posts

Posted 01 March 2010 - 02:19 PM

Runescape private servers are written in java.


Helped me to learn bits.... Forgot it all now tho :|

#13 moosejuice

moosejuice
  • 381 posts

Posted 30 March 2010 - 12:03 PM

i would just advise you to never skip over an example because it looks simple. always do the easy ones when you are starting out. also, dont just copy and paste code. learn what it does and rewrite it to make it better. thats a good way to get going

#14 kiddX

kiddX
  • 606 posts

Posted 30 March 2010 - 12:58 PM

I don't think you should quit Java for verbosity. Definitely not if you're switching to C++. Maybe Python.
I went from C++ to Java due to what my job requirements were and for a beginner you really won't notice that much difference between the two.

But yeah online resources help a lot.

http://java.sun.com/reference/api/ was my number 1 resource for all things java.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users