PDA

View Full Version : Beginning to program



cwblanch
April 7th, 2013, 08:26 AM
Hi,
I'm interested in learning to program....but I have no idea where to start!
Do I have to install something to get started?
Which language is easy to start with?
I've gone through the how-to begin programming thread and I will continue to use that as a help, but I wan't a few personal opinions, and maybe some help with early road blocks people run into.

I realize this is a big project to be asking about, but any help is appreciated.

Thanks!

snowz
April 7th, 2013, 09:04 AM
Maybe you should first check out http://www.codecademy.com/. It's one of the best resources at moment in my opinion. Python and Ruby are pretty easy to start with, the concept is always the same, just the code is different.

ppjdee
April 7th, 2013, 09:23 AM
c++ is what im aiming to learn this summer. if i stop being lazy and finish my addmisions :D

r-senior
April 7th, 2013, 10:50 AM
I'm interested in learning to program....but I have no idea where to start!
This is a good place, but you may need to sift through conflicting opinions about which language to start with.

Do I have to install something to get started?
It depends on the language but you will get the help you need if you ask.

Which language is easy to start with?
As you have specifically mentioned "easy" and have not mentioned a need to learn a particular language, I would suggest that Python is a good place to start. It is simple and elegant but still sufficiently powerful to create useful applications. You should already have the Python interpreter installed and you can check as follows:

In a terminal

$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'Hello'
Hello
>>>

You type the parts in red, then ctrl-d to quit Python. (Hold down the control key and press 'd').

Then you can move on:

http://docs.python.org/2/tutorial/
http://www.diveintopython.net/

I've gone through the how-to begin programming thread and I will continue to use that as a help, but I wan't a few personal opinions, and maybe some help with early road blocks people run into.
Good start. You should also look at other languages as well as Python. C is a base for several other languages and, in my opinion, it is good for all programmers to know at least some C because of that. Some shell scripting (Bash) is also useful. Unless you have a need to learn C++, I would suggest that you leave that language until you have a bit of experience with others.

I realize this is a big project to be asking about, but any help is appreciated.
The most important thing is to start. Although I've suggested Python, the language doesn't matter that much. Ask questions when you get stuck. Look at threads in this forum to get a feel for languages and problems.

There are beginner's programming challenges to use as little projects:
http://ubuntuforums.org/showthread.php?t=1714324

Outside this forum there are also other problem sites.
http://projecteuler.net/
http://www.cprogramming.com/challenge.html

slickymaster
April 8th, 2013, 12:21 PM
This is a good place, but you may need to sift through conflicting opinions about which language to start with.

It depends on the language but you will get the help you need if you ask.

As you have specifically mentioned "easy" and have not mentioned a need to learn a particular language, I would suggest that Python is a good place to start. It is simple and elegant but still sufficiently powerful to create useful applications. You should already have the Python interpreter installed and you can check as follows:

In a terminal

$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'Hello'
Hello
>>>

You type the parts in red, then ctrl-d to quit Python. (Hold down the control key and press 'd').

Then you can move on:

http://docs.python.org/2/tutorial/
http://www.diveintopython.net/

Good start. You should also look at other languages as well as Python. C is a base for several other languages and, in my opinion, it is good for all programmers to know at least some C because of that. Some shell scripting (Bash) is also useful. Unless you have a need to learn C++, I would suggest that you leave that language until you have a bit of experience with others.

The most important thing is to start. Although I've suggested Python, the language doesn't matter that much. Ask questions when you get stuck. Look at threads in this forum to get a feel for languages and problems.

There are beginner's programming challenges to use as little projects:
http://ubuntuforums.org/showthread.php?t=1714324

Outside this forum there are also other problem sites.
http://projecteuler.net/
http://www.cprogramming.com/challenge.html

A big +1
After r-senior's post I don't think that anything else rests to be said.

Bodsda
April 8th, 2013, 02:03 PM
Maybe you should first check out http://www.codecademy.com/. It's one of the best resources at moment in my opinion. Python and Ruby are pretty easy to start with, the concept is always the same, just the code is different.

Except the python interpreter on their site is shocking and relies on people writing reliable test cases; which more often then not, they don't.


I would start with the sticky in this forum.
http://ubuntuforums.org/showthread.php?t=1766253

And the beginner programming challenges.
http://ubuntuforums.org/showthread.php?t=1714324

Also, another +1 for r-senior's (http://ubuntuforums.org/member.php?u=288993) post

Bodsda

imagecko
April 10th, 2013, 02:40 PM
I would suggest that if you want to make webbapps, you should start with HTML and CSS, and after that PHP.
You can start read at http://http://www.codecademy.com/

If you want to make more desktop apps, you should start with Python.
A good start for that is: http://learnpythonthehardway.org/

|{urse
April 10th, 2013, 02:59 PM
Id agree, start with web coding. Also the best advice anyone can give a new coder is to stick to the latest and greatest standard of whatever language you're going to tackle, for example, If you want to learn HTML/CSS/ETC go with HTML 5.. you'll pick up all the old stuff along the way if/as it becomes necessary. Oh, and stay far far away from w3schools.com.

When you get to where you feel comfortable tackling a compiled (or interpreted) programming language, make sure the sites info and snippets you are learning from aren't outdated or deprecated, one small bit of unsupported code and it's sometimes hours of debugging.

-and- Type examples out manually when experimenting, cut and paste is fine once you know exactly what you are cutting and pasting and exactly what it does. Otherwise you learn nothing!

Good Luck! Hope you deliver something cool in a few years!

cwblanch
April 14th, 2013, 03:23 AM
I would suggest that if you want to make webbapps, you should start with HTML and CSS, and after that PHP.
You can start read at http://http://www.codecademy.com/

If you want to make more desktop apps, you should start with Python.
A good start for that is: http://learnpythonthehardway.org/

I've started with python on learnpythonthehardway and I'm really enjoying it. I thought doing programming like this would get boring after a while, but theres a lot to learn!


This is a good place, but you may need to sift through conflicting opinions about which language to start with.

It depends on the language but you will get the help you need if you ask.

As you have specifically mentioned "easy" and have not mentioned a need to learn a particular language, I would suggest that Python is a good place to start. It is simple and elegant but still sufficiently powerful to create useful applications. You should already have the Python interpreter installed and you can check as follows:

In a terminal

$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'Hello'
Hello
>>>

You type the parts in red, then ctrl-d to quit Python. (Hold down the control key and press 'd').

Then you can move on:

http://docs.python.org/2/tutorial/
http://www.diveintopython.net/

Good start. You should also look at other languages as well as Python. C is a base for several other languages and, in my opinion, it is good for all programmers to know at least some C because of that. Some shell scripting (Bash) is also useful. Unless you have a need to learn C++, I would suggest that you leave that language until you have a bit of experience with others.

The most important thing is to start. Although I've suggested Python, the language doesn't matter that much. Ask questions when you get stuck. Look at threads in this forum to get a feel for languages and problems.

There are beginner's programming challenges to use as little projects:
http://ubuntuforums.org/showthread.php?t=1714324

Outside this forum there are also other problem sites.
http://projecteuler.net/
http://www.cprogramming.com/challenge.html

Thank you very much r-senior! I really appreciate your help and I've already come back to your post several time for information.

And thank you to everyone else for your input! I'm really enjoying what I'm doing so far.

cwblanch
May 18th, 2013, 04:46 AM
This is a good place, but you may need to sift through conflicting opinions about which language to start with.

It depends on the language but you will get the help you need if you ask.

As you have specifically mentioned "easy" and have not mentioned a need to learn a particular language, I would suggest that Python is a good place to start. It is simple and elegant but still sufficiently powerful to create useful applications. You should already have the Python interpreter installed and you can check as follows:

In a terminal

$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'Hello'
Hello
>>>

You type the parts in red, then ctrl-d to quit Python. (Hold down the control key and press 'd').

Then you can move on:

http://docs.python.org/2/tutorial/
http://www.diveintopython.net/

Good start. You should also look at other languages as well as Python. C is a base for several other languages and, in my opinion, it is good for all programmers to know at least some C because of that. Some shell scripting (Bash) is also useful. Unless you have a need to learn C++, I would suggest that you leave that language until you have a bit of experience with others.

The most important thing is to start. Although I've suggested Python, the language doesn't matter that much. Ask questions when you get stuck. Look at threads in this forum to get a feel for languages and problems.

There are beginner's programming challenges to use as little projects:
http://ubuntuforums.org/showthread.php?t=1714324

Outside this forum there are also other problem sites.
http://projecteuler.net/
http://www.cprogramming.com/challenge.html

Hey r-senior,
thank you again for your help with the programming languages. I'm still working on Python, I went through a bit of a slump because it started feeling pointless, but I've started it up again.
But what about Java? Is there a website or anything that helps you learn Java? I haven't found anything myself, but then again I'm not sure what to look for as far as a simple learning website.
I'm asking because I've become a bit interested in learning to develop for Android. I've always wanted to make apps and stuff like that, but I don't have any experience! I have to get the experience myself.

Also, I almost made a whole new post for this, but decided to just come back to the thread I already made about programming, so I hope this gets to you, or anyone that can help me out.

Thanks!!

r-senior
May 18th, 2013, 07:47 AM
But what about Java? Is there a website or anything that helps you learn Java?
The Java tutorials are very good. They perhaps emphasis Netbeans a bit too much, but not a bad start.

http://docs.oracle.com/javase/tutorial/

See the Getting Started link near the bottom. You'd need to switch to an Android tutorial when you have the basics of Java: syntax, classes, interfaces, perhaps a bit of Swing programming. Again, ask for guidance on how deep you should go into the tutorials if you aren't sure.

King Dude
May 18th, 2013, 08:42 AM
First, decide upon a language. Pick an easy language, such as Python for instance. And once you have decided upon a language, find a compiler. Once you have a compiler and are ready to learn, find some decent tutorials online.
https://www.khanacademy.org/cs/tutorials/programming-basics

The good thing about learning Python is that it's easy, just like BASIC, but still practical in the real world, unlike BASIC. And after you learn this language, you could move onto something like C++, and then later down the road be able to extend C++ code with Python code.

EDIT: Java is a good language too, but I personally don't prefer it. Might be a little too complex for a beginning programmer.

r-senior
May 18th, 2013, 10:12 AM
OP is already learning Python. Given OP's interest in developing Android applications, Java is the obvious language to learn.

Java is not a complex language. It has lots of libraries, frameworks and tools but the core language is quite small. It was designed with simplicity in mind -- hidden pointers, no unsigned variables, no multiple inheritance, etc. It has become fashionable to malign Java but the criticism is usually that it's only for incompetent programmers or that it uses too much boilerplate code, not that it is too complex.

coldraven
May 18th, 2013, 01:25 PM
FullCircle magazine did a series on learning Python. http://fullcirclemagazine.org/

Then they made a compendium of all the articles.You can download all the back issues.
Here is a link to one of the special issues, do a search for the rest of them:
http://fullcirclemagazine.org/2013/02/23/python-special-edition-volume-06/

P.S. They are free! (pdf format)

cwblanch
May 19th, 2013, 05:33 AM
The Java tutorials are very good. They perhaps emphasis Netbeans a bit too much, but not a bad start.

http://docs.oracle.com/javase/tutorial/

See the Getting Started link near the bottom. You'd need to switch to an Android tutorial when you have the basics of Java: syntax, classes, interfaces, perhaps a bit of Swing programming. Again, ask for guidance on how deep you should go into the tutorials if you aren't sure.

So I download the JDK, read through the tutorials and such. Simple enough, thank you for all your help!

Whats Swing programming though? I've looked at the page explaining it, but I don't think I fully understand it. It's just a GUI for...Java? Or just for creating GUIs in Java?

I've already tried for Android tutorials, which is how I figured out I would need a little Java experience :lolflag:


FullCircle magazine did a series on learning Python. http://fullcirclemagazine.org/

Then they made a compendium of all the articles.You can download all the back issues.
Here is a link to one of the special issues, do a search for the rest of them:
http://fullcirclemagazine.org/2013/02/23/python-special-edition-volume-06/

P.S. They are free! (pdf format)

That's amazing! I didn't realize any magazine would put of back issues for download.
Thank you!

ehsanoo
May 19th, 2013, 08:03 AM
I think you'd better start coding in C.

Yes, coding in languages like python is easier, but you have to go for C/C++ after a while spending time to learning those. Since C++ is C with more features, i recommend learning C first.

You will be proud of yourself using C!
Coding in C helps you "understand" programming. other powerful languages, like Java and PHP, are just similar to C in syntax -- the way you write the code, or the grammer of a language.

Luckily, Ubuntu comes with a great C compiler, GCC, you can simply write your code into a file and compile it through Terminal.

r-senior
May 19th, 2013, 08:34 AM
Whats Swing programming though? I've looked at the page explaining it, but I don't think I fully understand it. It's just a GUI for...Java? Or just for creating GUIs in Java?
It's the standard GUI toolkit for Java. Cross-platform, quite nicely designed but can be ugly, especially on Linux desktops. It used to be really slow but on modern machines, it's OK. I know of some big financial institutions that use it with Java Web Start (http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136112.html) for hot deployment of applications across a large number of desks but it's not a rewarding toolkit for casual and open-source developers.

The benefit of having some experience with Swing is that some of the design is carried across into Android. But you could just learn those by jumping direct to Android once you have the Java fundamentals, it's not essential to learn Swing.

cwblanch
May 19th, 2013, 07:37 PM
It's the standard GUI toolkit for Java. Cross-platform, quite nicely designed but can be ugly, especially on Linux desktops. It used to be really slow but on modern machines, it's OK. I know of some big financial institutions that use it with Java Web Start (http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136112.html) for hot deployment of applications across a large number of desks but it's not a rewarding toolkit for casual and open-source developers.

The benefit of having some experience with Swing is that some of the design is carried across into Android. But you could just learn those by jumping direct to Android once you have the Java fundamentals, it's not essential to learn Swing.

Hmm...well I want to get the most out of it that I can so I'll take a shot at Swing. Thats a while in the future though, I'm still learning how to dicipline myself for self-teaching. I also have to get down Python and Java.

Whats the NetBeans IDE though? You mentioned it in another post, but I skipped over it because I saw what I needed in the tutorial page. It said in this page, down at the bottom, you write once and then you can run it on all platforms.

Sorry about all the questions, I seem to have jumped into a fairly complicated field.

r-senior
May 19th, 2013, 08:38 PM
Netbeans is just a development tool for Java. It can do other languages too. It's pretty good. The other main one is Eclipse.

It's a good idea to do a couple of small programs with just a text editor and terminal but most Java programmers use IDEs.

The write once run anywhere thing is a feature of Java. Java programs are cross platform without needing recompilation. Read up about bytecode and JVM.

slickymaster
May 19th, 2013, 08:42 PM
...But what about Java? Is there a website or anything that helps you learn Java? I haven't found anything myself, but then again I'm not sure what to look for as far as a simple learning website...
JavaPassion (http://www.jpassion.com/portal/)
Collected Java Practices (http://www.javapractices.com/home/HomeAction.do)
Java Notes: Table of Contents (http://www.leepoint.net/notes-java/index.html)
Java Programming Resources
(http://www.apl.jhu.edu/~hall/java/)Learn basics of java, tutorial for beginners, examples online (http://www.java2all.com/)
Data Structures and Algorithms with Object-Oriented Design Patterns in Java (http://www.brpreiss.com/books/opus5/html/book.html)
Java Programming Forums (http://www.javaprogrammingforums.com/login.php?do=logout&logouthash=1357120549-972b1b3e7d2575bf4b4239524e46b8c23780f7ff)


...Whats the NetBeans IDE though? You mentioned it in another post, but I skipped over it because I saw what I needed in the tutorial page. It said in this page, down at the bottom, you write once and then you can run it on all platforms....
The fact that you write once and you can run it on all platforms is a characteristic of Java language, not of the Netbeans IDE itself. Because Java is compiled into byte-code which is interpreted by the Java Virtual Machine, that allows for code compiled on any operating system like Linux to be executed on any other operating system like Windows or Mac. Any machine that can run a Java Virtual Machine can run Java.

On Netbeans IDE, you might be interested in seeing this (http://wiki.netbeans.org/BookNBPlatformCookbook#10_Best_Practices). I've been working with Netbeans since 2005 and I think it is the best IDE for working with Java, providing the best out-of-the-box experience for Java EE development, deployment, and debugging and already started providing support for several Java EE 7 features.

shawnhcorey
May 19th, 2013, 09:34 PM
The write once run anywhere thing is a feature of Java. Java programs are cross platform without needing recompilation. Read up about bytecode and JVM.

A lot of scripting languages, Perl, Python, Ruby, will run on any machine. And since they are scripting languages, there is no need to compile them. And yes, they do run at speeds comparable to Java.

ehrt74
May 20th, 2013, 09:54 AM
Programming for me consists of a number of things which can be regarded seperately:

1/ learning to structure my thoughts clearly and algorithmically,

2/ translating this structure to the programming language used and

3/ understanding what this means in hardware.

For me, 3/ is very important. It gives me the feeling of having solid ground beneath my feet. For this reason my favourite language for a long time was sparc assembly, which consists of instructions like "move the number 4 to register 2 and add it to the number in register 3, storing the result in register 6". You get to control what the hardware is 'actually doing'.

This is quite different from high level languages. Take this bit of Java code:


public static void main(String[] args) {
System.out.println("1" + 2 + 3);
}

Whatever else you may think about this, there is a lot of stuff going on behind the scenes and lots of rules which you have to know.

This meant to me that, when I began programming, high-level languages were hard. The experience gained about how to write large applications was implemented in the rules of the language. In Java, for example, everything has to be a class. This leads to a number of questions. What is a class? Why is a class a good idea? What problems can be solved easily using classes? What is the computer 'actually doing'? etc. etc. These questions are best answered with experience, in my opinion.

If I could give some advice to my younger self, I'd say:

1/ learn enough assembly so that you can write very very simple programs. This will teach me what allocation is, what memory management is, how functions are called, what support for functions is provided in hardware.

2/ move to C to see how a program written in one language (C) can be translated into another language (assembly/machine code). What problem is addressed by C containing things like a for-loop with this odd syntax?

3/ try a number of higher-level languages and find one you like (python/ruby/php/smalltalk/...). Here you'll be able to do more much faster than in C, so you'll spend more time thinking about how to structure code and how to think about larger problems.

Please note, these ideas are tempered to the way I think. It's possible that you think differently and another path will lead to Rome faster.

cwblanch
May 21st, 2013, 03:20 AM
I'm actually having an issue even making the JDK work. Since so many people are posting, helping out, I figured it would be easier to have just a generic reply then quote several people.

The command 'javac' isn't being found as a valid command no matter what I do. I've referred to this (http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html) help page and nothing is working. To be honest I'm not sure if I've gotten the JDK right in Ubuntu, I can't seem to install it, I just unpack the tar.gz and cd to my .java file and put the path to javac before I try to compile the .java.
I've even tried this in Windows and a new virtualbox installation of Xubuntu to see if a fresh install had anything to do with it.
I also followed the instructions for Windows and updating the PATH variable via the control panel, and it's still not working
I'm really very confused as to why nothing is working.

ehrt74
May 21st, 2013, 08:29 AM
No, no, no. Don't download the sdk from oracle.

Instead open a terminal and type:


sudo apt-get install openjdk-7-jdk

This will install the jdk and automatically update it, when updates become available.

slickymaster
May 21st, 2013, 11:04 AM
If you want to use Oracle Java instead of OpenJDK, you can add a PPA repository to install and keep it updated. This package provides Oracle Java JDK 7, which includes Java JDK, JRE and the Java browser plugin.
At a terminal window just run the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

r-senior
May 25th, 2013, 09:23 AM
A lot of scripting languages, Perl, Python, Ruby, will run on any machine. And since they are scripting languages, there is no need to compile them. And yes, they do run at speeds comparable to Java.
I didn't mean to imply that write once run anywhere was a feature unique to Java but I can see that my post was ambiguous in that respect. If you look at the context I was trying to explain that it is a feature of Java rather than NetBeans. You are quite correct that scripting languages will run on any machine (that has the interpreter installed).

The speeds though are not comparable. Depending what you run, a processor intensive Java program takes about 1.2-1.5 times as long as an equivalent C program, whereas something like Python will be at least an order of magnitude slower. I have a little test suite somewhere. For a lot of applications this is not an issue and these scripting languages are great languages.


No, no, no. Don't download the sdk from oracle.
+1

I routinely develop applications using the Open JDK for running on the Oracle SDK and I don't mean toy apps, I mean things like EJB and Spring enterprise apps running on Glassfish and Tomcat. The Open JDK is pretty good these days. There are some corner cases where the Oracle JDK is needed, but these are increasingly rare and we should support the open source version.