No knowledge of any programming language

Started by
18 comments, last by el junk 11 years, 3 months ago
Java, lacking lambda expressions, feels nothing like C# to me. But then, I use a LOT of lambdas.

I don't think the availability of lambda expressions is a criteria for what first language to learn.

Categorically disagree. Object Oriented Programming is great for organizing data, but sucks as a means of implementing algorithms. Better to get the younguns started on Functional Programming now, while they don't have any preconceived notions, then later, when they are convinced whatever the second language they learn is the One True Way. I see no point in hiding programming concepts from beginners just because we all had them hidden from us when we were beginners.To do that, you're basically on a one or two year long cycle of lying to the kids, "this is the sum total of programming! Get very familiar with it. GOTCHA! Now *this* is the sum total of programming!"

Besides, everything has lambdas--and especially closures--now, so Java lacking them is a really poor oversight.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Advertisement

Note, I'm joking a little in this post and kinda having fun with it, so take what ever you think is valuable and leave the rest. biggrin.png

I'll assume you're running a Windows machine, just because I'm running Win7 and it will let me talk freely.

Now do what I say:

  • Decide to learn C and C++. Why? Because.
  • Install VirtualBox and Ubuntu on a VirtualBox virtual machine. Why? Multi-platform shenanigans Terminal love-affair. Easy access to tons of great tools. Ubuntu is a great Linux starting point. The virtual machine is self-contained, so feel free to break stuff.
  • Login to the Ubuntu machine. At your Ubuntu desktop, press CTRL+ALT+t to open a new terminal. (Note, the terminal opens up in your home directory.)
  • Install vim on Ubuntu. Why? Because this will be your text editor from now on.
  • $ sudo apt-get install vim (the $ symbolizes the terminal prompt. don't type $)
  • Install git on Ubuntu and Windows. Why? Because this will be your version control system from now on.
  • $ sudo apt-get install git
  • Install gcc, g++, and make on Ubuntu. Why? These are the guys that will take the code you write in c/c++ files and turn it into a file containing machine instructions (an executable).
  • $ sudo apt-get install gcc g++ make

Now, write a hello program:

  • $ mkdir -p code/hello
  • $ cd code/hello
  • $ vim hello.c (In vim, push 'i' to enter "insert mode" and start typing regularly. Push <esc> a bunch of times to return to "edit mode", the mode vim starts up in. In edit mode press ':wq' to write the file and quit.)

Make your hello.c text file look like the following, then save and exit.


#include <stdio.h>
#include <stdlib.h>

int main(void) {
    printf("hello\n");
    return EXIT_SUCCESS;
}

Now, compile+link and run your new program:

  • $ gcc -o ola hello.c
  • $ ./ola

Just for kicks, do it again:

  • $ gcc -o salut hello.c
  • $ ./salut
  • $ ls
  • (ls should list three files, your code and the two executables you just made. Lets delete the executables.)
  • $ rm ola salut
  • $ ls

Wonder what else you can do with commands like gcc or ls?

  • $ man ls
  • $ man vim
  • $ man git
  • $ man gcc
  • $ man make
  • Now start googling stuff.

Note, you can code like this in Windows, too. (After installing Visual Studio C++ and setting the appropriate environment variables.)

  • bash -> powershell
  • gcc/g++ -> cl.exe
  • make -> nmake
  • vim -> vim
  • git -> git
  • and see gnuwin32
I second the idea to start with Go. You don't need to download anything. Have a look at the step-by-step tutorial at http://tour.golang.org/#1
I think that little playground is a great way to get a basic idea of what computer programming actually is without making any commitment, or installing anything. Everything is right there. You can even have 2 tabs side by side to read and experiment at the same time.

When you are done with the tutorials and some experimentation, you'll know if you even enjoy programming or not. Then you can make a comitment to installing another IDE or language and moving on to better things.

c++ - the most difficult language, you will learn memory management, you will learn what pointer really is and so on

C#,Java - hides memory management, and you will never understand sentence "C# always uses reference not value"

So I would recomend you to pick C++, then go for C#. It is somehow backwards but you will never code safely in C# unless you are sharpened by C++.

I recommend you start with Python.

Why? Firstly, because you can open a Python session and start typing commands and get immediate feedback. It's interactive. You learn what works and what doesn't work right there, in the box. Fundamental concepts like storing information in variables and processing collections of data, encapsulating rules as procedures (aka functions), and higher concepts of file handling or error handling. All without having to first understand the idea of separate compilation or classpaths or interface/implementation.

Second, it's a well documented language with oodles of free help online. You don't have to shell out a month's McDonald's labour to buy the book to learn how to use the tool. There's a plethora of existing you can read to learn from.

Third, it's Good Enough for most programming tasks outside of running a nuclear reactor or automated rocket surgery. It will stand you well in the long run when your AAA title needs some scripting (like, say, the Sims or Civilization) or you have to generate HTML5 content.

After you're comfortable with Python, then move on to one of the other languages like Java, C++, or one of the proprietary flavour-of-the-week ones (VB, C#, Go) if their owning corporation is still promoting them by then. The fundamentals you will have already learned are easily translated.

Stephen M. Webb
Professional Free Software Developer

[quote name='JohnnyCode' timestamp='1357579567' post='5018641']
c++ - the most difficult language, you will learn memory management, you will learn what pointer really is and so on

C#,Java - hides memory management, and you will never understand sentence "C# always uses reference not value"
[/quote]

I disagree whole-heartedly (even as someone who learned C++ first): someone can learn the concepts of addressing, pointers, "by-reference" and other C-level concepts without having to use C++ as their introductory language. I see the "sink or swim" mentality in telling someone to start with C++, but that's really a poor teaching tool. I spent a lot of time at the outset learning what the source of (very random-seeming) crashes were when writing very entry-level assignments. Ex: Think about the fact that in managed languages, common beginner mistakes like array-oversteps and null dereferences shout at you right away, while in C++ the bug might not pop up at ALL (at least with the array instance) half the time.

Plenty of other ways to learn how to think like a programmer, and THEN come back and learn some lower level coding if desired.

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)

VB

<blockquote class="ipsBlockquote" data-author="JohnnyCode" data-cid="5018641"><p>c++ - the most difficult language, you will learn memory management, you will learn what pointer really is and so on<br />C#,Java - hides memory management, and you will never understand sentence "C# always uses reference not value"<br /> <br />

So I would recomend you to pick C++, then go for C#. It is somehow backwards but you will never code safely in C# unless you are sharpened by C++.</p></blockquote><br />C++ isn't really the most difficult language, there are those that are far worse (Allthough they're not as popular)<br /><br /><br /><br />

I'd personally recommend against C++ since the internet is so full of crap C++ tutorials and even crappier C++ programmers that it is almost impossible for a beginner to avoid picking up bad habits (Which leads to even more crappy C++ programmers, many of whom think its a good idea to write even more crappy C++ tutorial to further pollute the net with).<br /><br />

I wrote my first complete 3D game in C++ with OpenGL when i was 16, (having used C++ for 3 years and BASIC/Pascal/x86 for 2 years before that and having made a bunch of 2D games with it before), i did pretty much everything wrong that you can imagine. Excessive allocation, deallaction, violating the rule of three, character pointers to text data, and the list goes on, The game worked, i managed to hack my way around the worst memory leaks and i thought i was the programming god, I was wrong and it took me a forced (by school) trip through Java-land to break my worst habits(I don't recommend Java either since C# is better in pretty much every area). (I've used C++ for over 15 years(Edit: during that time i've also used many other languages and worked with things other than programming so i definitely don't have 15 years worth of effective C++ experience) now and wouldn't even consider writing a tutorial since i know i'm not competent enough, when i was 16 i almost did though (The internet should thank me for not doing it smile.png)<br /><br />

More strict languages are better for learning purposes since they make the sane paths more obvious and the insane paths impossible or harder to reach.<br /><br />

If the OP has a competent(who is actually competent, not one who just thinks he is competent as is usually the case) tutor to guide him then i'd agree that C++ is as good a first language as any. This however is the internet, it would be quite irresponsible to make such assumptions, (If we were to recommend C++ to the OP then he'll probably end up learning from the new bostons video tutorials on youtube, or worse)

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

I have stated that c++ is the hardest. Instead of telling OP what to do, I am telling some facts about languages. If OP needs fundamental understanding of what computer is doing, then memory safe languages are ok. But if he will suffer c++ at least half a year, and then move on C# or Java, or actualy any other, he will rule it all. That is the way I recommend him if he wants to be profesional programmer. And to learn programming is not just the language, it is mainly coding and learning thins as

- data structures (binary trees, red-black trees, linked lists...)

- alghorithms (recursion, ordering....)

- program lifetime (objects persitance, routine feeding)

- isolation (libraries, class definitions, abstraction)

- practice (OS, compilers, assembly, CPU architecture instructions, devices)

So, in the end, he must learn all this, he can be done with a language in a month, but becoming a programmer actualy never happens. You progress for ever. And if he wants to have perspective, he should let c++ rape him. That's my opinion.

I'm a little surprised by this thread.

OP, honestly, just as long as you have fun with what you decide, I think you made the right choice. I still think c/c++ in a VM sounds like a lot of fun, though.

However, there are tons of roads you could go down and I don't think they'll damage you in some irreparable way. Just my opinion, of course. For more examples, you could do c# and play with unity. You could get scheme and work along with the MIT book. You could start with python, do some web stuff or work with some game libs.

Also keep in mind that if you go to college for this stuff, they'll typically have you do things similar to the above. Get a Unix account and start playing with your environment and c. The scheme thing was Berkeley's first course in cs. I'd be surprised if there were no game programs out there taking advantage of unity. If OP is worried about what people are advising, go look at some uni cs web pages. They educate people for a living and have been doing it for years.

(edit: fix tablet post)

This topic is closed to new replies.

Advertisement