Slashdot Mirror


Ask Slashdot: How To Get Started With Programming? [2017 Edition]

Reader joshtops writes: I know this is a question that must have been asked -- and answered -- on Slashdot several times, but I am hoping to listen from the community again (fresh perspective, if you will). I'm in my 20s, and have a day job that doesn't require any programming skills. But I want to learn it nonetheless. I have done some research but people have varied opinions. Essentially my question is: What is perhaps the best way to learn programming for my use case? I am looking for best possible resources -- perhaps tutorials on the internet, the right books and the order in which I should read/watch them. Some people have advised me to start with C language, but I was wondering if I could kickstart things with other languages such as perhaps Apple's Swift as well?

6 of 312 comments (clear)

  1. How to do anything in 2017 by Anonymous Coward · · Score: 3, Informative

    Get a PC computer. Install Ubuntu. Connect to Internet. Google free tutorial. Start programming.

    1. Re:How to do anything in 2017 by lgw · · Score: 5, Informative

      Get a PC computer. Install Ubuntu. Connect to Internet. Google free tutorial. Start programming.

      AC is not wrong.

      First, learn simple scripting. Use Python - it teaches better habits than a lot of alternatives. When you're comfortable with the basics of ordering your thoughts in a formal language, there are 3 real challenges, and I'd take them in this order.
      1. Pointers
      2. Recursion
      3. Threading

      C is great after you're comfortable with the basics. Pickup the K&R C book and have some fun with it. Implement all the basic data structures using C. Learn to use a nice GUI debugger, and step through your code, then step through the object. Learn what's really happening under the covers. Keep going until there's no mystery about pointers and the stack, registers, and so on.

      For recursion, learn Scheme. Yeah, you could use Python too, and maybe there are some good intro texts now (what does MIT use these days instead of SICP?), but Scheme forces you to do everything with recursion. Keep going until it's totally natural. Write a Scheme interpreter in Scheme (it's easier that you think, and a lot of fun).

      There's no easy path to learning threading, I fear, but if you made it past the above two, you'll manage this.

      Once all that is done, then learn Java. Java sucks, but it's where most the jobs are. Everything in Java should seem quite easy once you have the fundamentals.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    2. Re:How to do anything in 2017 by Anonymous Coward · · Score: 4, Informative

      I've seen that stated the other way around.

      If you're trying to make your learning investment pay off quickly I'd go: (1) JavaScript, (2) Java, (3) C/C++
      These can break you into web development, mobile development, infrastructure development, legacy and high-performance code.

      If you're looking more at ease of learning I'd go: (1) C# on Visual Studio, (2) Java on Eclipse, (3) C/C++ on Visual Studio
      These can get a cool app running quickly without much stress and also sets you up for Unity game development if you have C#. You'll generally have more fun this way around.

      The problem with C/C++ is memory allocation, pointers, types and type aliasing - they're a bit tricky to pin down without knowing about memory and memory layouts and v-tables and such.

      C# and Swift are excellent languages to try ideas without committing to any painful pointer arithmetic and memory management. Sure, what you write won't run quite as fast as you can get in C/C++ but it's more than adequate for anything barring the highest of the high-performance scientific computing. I'd recommend C# on Microsoft Visual Studio Community Edition 2015 which also gives you exposure to a world-class development environment and tools, and that's something that can go straight on a resume if you get used to using it. Visual Studio also allows you to get around in a debugger and see what's actually happening when you start coding something bigger than a few thousand lines. You're going to get some rolling-eyes and people suggesting "real men use Vim" on Linux but that's something you should save until later or if you already have well developed Linux hacking skills. Most people code on Vim or Emacs because they secretly hate themselves.

      Java is also fairly easy to work with and doesn't have the memory management junk to deal with, but it has a longer legacy and it's more verbose in places. It's just as capable as C# and Swift but with the advantage of being deployed just about everywhere (e.g. browsers, Android, even some embedded systems). Learning Java is excellent bang-for-buck if you want to develop marketable skills quickly and it gets used just about everywhere. My main complaint with it is just that it's so damn big - it's got a massive surface area and there's a lot to learn. You can try using Eclipse to develop for Java but I personally find it a bit encumbered and bloated. It's powerful though and also a good thing to put on a resume.

      I'd learn C/C++ once you have a decent grasp of how to get code up and running in one of the above. It's the most marketable skill if you want to work in the guts of things and there isn't a program in existence that doesn't contain at least some C code. From here you can also study high-performance code for scientific work and HPC. C/C++ is also the gateway to GPU compute and a whole manner of weird and wonderful tricks that can pay back big time if applied correctly. Be prepared to sink a lot of time into this - it won't pay back $$$s as quickly as Java would but you'll get a much deeper understanding of what's going on inside your CPU.

      Python is also a superb language to have under your belt. It rarely gets used in production code but it's heavily used in tools and testing and it's a great language to build something quick-and-dirty as you need it. It's also interpreted so you can try REPL style coding and just type lines to see what they do without going through agonizing compile-test processes.

      Don't bother at all with machine code or assembly language until you're feeling confident with C++ and you have some time to kill. It's fun to look at if you really, REALLY want to know what the CPU is doing and you can get a good grasp for the compilers and execution model by studying disassembly. This is a huge time-sink though and rarely ever relevant unless you're looking at incredibly tricky compiler bugs or the highest performance hand-tuned code.

      More importantly, pick something that's fun to implement and will give you some satisfaction as you go. Writing some

  2. maybe try Exercism? by tnordloh · · Score: 3, Informative

    exercism.io is a good starting point. The site has a lot of languages to choose from, and it presents you with a bunch of exercises you can complete for each language. Once you complete an exercise and submit it, you can visit the site, and see your code there. You can also see how others solved the same problem, and comment on their solutions, as well as read comments from other people.

    --
    Always remember the chickens that have gone before
  3. Re:Coffee by unrtst · · Score: 4, Informative

    I suspect you're referring to Larry Wall's three great virtues of a programmer: Laziness, Impatience and Hubris
    http://threevirtues.com/

  4. Re:Like everything else start with the basics by ShakaUVM · · Score: 2, Informative

    I like Java, C++, C#, and Python, and think they all work great as introductory languages. C++ gets shit on a bit because there's a lot of bad memories from the 80s and 90s when you had to do a lot of things by hand, but modern C++ is a joy to code in. In fact, if it was up to me I'd say that colleges should teach C++ as their intro language for three reasons:

    1) It's as powerful and expressive as Java and Python (with some notable exceptions like split() which you need to invoke Boost for). Smart pointers (instead of raw pointers), vectors (instead of C style arrays) and range-based for loops (to never have out of bounds errors) allows for very fast and safe programming.

    2) It is a lot easier to go from C++ to Java/Python than vice versa. Java programmers tend to have a vague grasp on how memory actually works.

    3) C is only one step away from assembly. C++ is two steps away (due to name mangling). Java and Python are three or more steps away. Assembly programming, while rare enough these days, is still the gateway to really understanding computer architecture and writing code that works with your architecture instead of against it. Success in assembly should be the goal for a lower-division computer science program.

    I also agree with you that most languages take their cues from C++/Java in that they either follow the conventions or deliberately break them. So learning C++ or Java is a really good choice for new programmers for that reason as well.