Best programming languages for beginners

Discussion in 'Mac Programming' started by moonman239, Jun 16, 2014.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    After learning about more programming languages, I would now like to add my picks.

    One of my picks is Ruby. It's pretty easy to use. For example, if I want to build a Ruby script that prints "Hello World" to the console three times, I would write:
    Code:
    3.times do { puts "Hello World" }
    . If I wanted Ruby to print each value of an array to the console, I would write:
    Code:
    array.each { |elementOfArray| puts elementOfArray }
    . Click here to download the Ruby virtual machine.

    My next pick is Io, because it was built by someone who didn't really understand programming languages. For a programmer who is familiar with object-oriented programming, the syntax is very easy to learn. I imagine it isn't too hard for a beginner to learn. Click here to visit Io's Website.

    My third pick is Swift. This language will be released with Xcode 6 in the fall. This language has been touted as the one that will bring in more app store apps. Unlike the other two languages, Swift code is not run in a virtual machine. In fact, it uses the same compiler and runtime as Objective-C code, so you can use libraries that were built in Objective-C.
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Have you tried Python yet?

    Ruby is cute with all its useless features that they like to tout (such as the one you demonstrated), but I much prefer Python.

    The equivalent code in Python is:

    Code:
    for _ in range(3): print("Hello World")
    And unlike Ruby which has a variety of syntaxes for related things, here's how to print each element in an array:

    Code:
    for element in array: print(element)
    Of course, you could just do:

    Code:
    print(array)
     
  3. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #3
    I went with Ruby as well. Python's functional style just seems a bit clunky, and don't even get me started with that whitespace grouping. RubyMotion was what tipped the scales for me, though - it builds fully compiled applications for iOS and OS X (and Android later this year), and since the object model is similar to Objective-C, most of the sample code pretty much drops right in (after removing all those specifiers, brackets, and semicolons, of course).

    Ruby has the for anItem in someCollection loop, but you don't see it used that much - the preference is to use the more idiomatic block syntax with each. I believe that each is ultimately used in both cases, but there is a difference in the scope of variables created within the statements.
    Code:
    (1..3).each { puts 'Hello World' }
     
  4. JohnsonK macrumors regular

    Joined:
    Mar 6, 2014
    #4
    Don't be so passionate about python. What's the point? ;)

    It's got many features one could call useless as well
     
  5. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    The point is the codebase your team works on is in a good language? Arguing about the merits of Python is how it came to be that my team at IBM is using Jython and not TCL(? I can't remember what the alternative was - some weird acronym) as our scripting language.

    Such as? Python is such a minimal language, I can't imagine any part of it being useless. The : at the end of the line before the start of a new block somehow helps readability, or so I've heard (from a PEP).
     
  6. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #6
    This is going nowhere.

    Pick a language someone you know is good at so you can ask them. It's not going to matter. If it's COBOL, maybe that's not great. But generally pick something and start, and get help. The chances that you learn exactly one language is low. Just start. Objective-C, Ruby, Python, C#, Java, JavaScript, C++, C, perl, PHP... Whatever. Get a friend and a book and go. Expect the rest of this thread to be bickering re: people's pet languages.

    Good luck.

    -Lee
     
  7. thekev macrumors 604

    thekev

    Joined:
    Aug 5, 2010
    #7
    It seems like the ideal language would depend on your learning materials. If you have a book or something that is easy to follow and clear in its explanations + low on error count, it would be easiest to start with whatever language is used by that book. Also I doubt the python whitespace thing would cause a lot of trouble.
     
  8. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #8
    Well, languages are as much of a style issue as anything else, so that kinda comes with the territory.


    I don't know about COBOL, but most modern languages have similar features, and a good number of them borrow ideas from other languages (Swift has a lot of stuff that looks like it is right out of Python or Ruby, for example). Look for something that has a decent community, and give it a try. If it doesn't work out, just try something else until you find one that feels comfortable - watch out for the Kool-Aid, though.
     
  9. hiddenmarkov macrumors 6502a

    Joined:
    Mar 12, 2014
    Location:
    Japan
    #9
    This some good advice. Why I am partial to how most acadamic environments teach broadly at first...or did if changed (been out of brick and mortar school for a while now).

    Basic to intermediate C, then java then perl for an area of interest for me. Even had some assembly language once. For when C is just not granular enough lol (I kid ofc...even assembly has its merits as a programmer should have somewhat of an idea of what is going on behind the curtain at some point). If only to appreciate just how nice it is to type plain ole

    var = var +1

    Assembly as those who covered it know....even 1 + 1 is jsut a few more lines of code.


    You pick what you wanted from this or got your basics down and found a new path. My path now on to learning python. Control structures and such carry over if-else, while, etc. Just need to learn the magic words so to speak to make them work.

    Now the whole : at the end of some structures....jsut not getting that jsut yet 100%. It be my common lets make the interpreter not happy fat finger...or lack of fat finger maybe more appropriate lol. At this point I know to look for it...just need to get the muscle memory programming between my fingers and head at some point to not do it in the first place lol.
     
  10. Akarin macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #10
    I'll just pull your leg here but which Python do you mean? 2.7 or 3? ;-)
     
  11. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #11
    I mean 3.4. It's easy to find small issues in the language just by looking at what changed before 3.0.

    IE, 2.1 lacked boolean literals, which, regrettably, is the version of the language that IBM ships with the current version of WebSphere. I've been talking to that team trying to get them to have 2.5 or newer included instead...
     
  12. theluggage macrumors 68030

    Joined:
    Jul 29, 2011
    #12
    Why is 'Hello World' seen as the measure of a programming language? All features are 'useless' if you present them as trivial examples and miss the big picture.

    'for...in' is a language construct that iterates over a block of code. 'each' is a plain old method of the collection object that accepts a function (in these examples its an anonymous or 'lambda' function) and calls it for each element of the collection. Quite different mechanisms, although the difference is irrelevant if you're just printing out 'Hello' three times. AFAIK there is little fundamental difference between Ruby, Python, Javascript, Swift... in this respect.

    Looks more relevant when you look at how it is consistent with the 'family' of array methods, which you can easily expand on, modify or replicate in your own objects:

    E.g. Javascript:
    Code:
    var a = [1,2,3,4,5,6,7,8,9];
    a.forEach ( function(n) { console.log('Hello '+n ) } );
    console.log (  a.some( function(n) { return n < 5; } )  );
    console.log (  a.every( function(n) { return n < 5; } )  );
    console.log (  a.filter( function(n) { return n < 5; } )  );
    
    ...and all of 10 minutes of research into Ruby* gave me the direct equivalent:
    Code:
    a= [1,2,3,4,5,6,7,8,9]
    a.each { |n| print "Hello ",n,"\n" }
    puts a.any? { |n| n < 5 }
    puts a.all? { |n| n < 5 }
    print a.select { |n| n < 5 }
    
    ...both of which output:

    Code:
    Hello 1
    Hello 2
    Hello 3
    Hello 4
    Hello 5
    Hello 6
    Hello 7
    Hello 8
    Hello 9
    true
    false
    [ 1, 2, 3, 4 ]
    
    (Ruby certainly wins the conciseness contest)

    *OK - and another 10 minutes to work out how to print 'Hello' and 'n' on the same line :)
     
  13. hiddenmarkov macrumors 6502a

    Joined:
    Mar 12, 2014
    Location:
    Japan
    #13
    You do have a point.

    I'd be looking at C. Not loved by some. Also will say sometimes its hard to love C as well so can't blame them. But....it be many of its "useless" or annoying features that still has it still earning its keep these days.

    Somethings C does better because of its micromanaging as it were. You can see this in intense calculation areas for example. Interpreters for interpreted languages are getting better but sometimes for max performance you really have to spell it out what you want done to the computer as it were.

    Sure the coding time can be longer since not the easiest to work with. Question here is a longer time to develop outweighed by time saved on a complex calculation that will be run many times over on larger data sets.

    Not saying making C THE starter langauge ofc. I learned it first but not saying this is THE way. I will say though you get a better appreciation for higher level languages after you do it the "hard way" in C. But we all learn differently based on how we see things.
     
  14. AstronomyiPhone, Jun 18, 2014
    Last edited: Jun 18, 2014

    AstronomyiPhone macrumors regular

    AstronomyiPhone

    Joined:
    Jun 9, 2013
    Location:
    Maryland
    #14
    I'm going to have to go with JavaScript here.

    Reasoning:

    • Easy syntax
    • Web-based (you really need web programming skills these days)
    • Going off of that, it's actually useful: there are so many things you can use JS for
    • It's fast: no waiting for compilers; you make a change, refresh the page, and that change is immediately reflected
    • It doesn't throw OOP at you if you don't want it (*cough* Java), but it's there when you want it/need it
    • It makes it simple to understand the concepts behind programming without actually having to deal with shoving the syntax in your brain first
    • It's similar to many other programming languages, so it makes it easier to learn/understand those when you get there; that's where other scripting languages like Ruby and Python fall off the list because they have simple syntax, but that becomes an issue when you look at other programming languages that are markedly different

    My second choice would be Swift (if you're even thinking about going into iOS development) because it's the future. Apple is replacing Obj-C with Swift, and it's good: I've been messing around with it, and it's modern, lightweight, fast, and simple. You don't have to deal with any weird syntax or functional quirks, and, like Apple products, it just works.

    The best way to learn JS that I've found is Codecademy (work through the whole thing) and Learn X in Y Minutes is good if you ever need a refresher.

    For your examples:
    Code:
    for(var i = 0; i < 3; i++){
        console.log("Hello, world!");
    }
    
    and

    Code:
    for(var j = 0; j < array.length; j++){
        console.log(array[j]);
    }
    
    //or
    
    for(var x in array){
        console.log(x);
    }
    


    ----------

    I'd have to agree here. No one can really tell you what language to start with, though we can make recommendations. It's like asking us what phone to buy: every buyer is different, and while we can suggest one for you and lay out the differences, we can't make the decision for you. However, rest assured in the fact that you will learn another one. This is not going to be the only phone you ever buy, so to speak. The best piece of advice I can give you is to just get started and don't give up: it may get tough, but the ones who pull through are the ones who are really passionate about programming and believe in what we do. Even if you can't find someone to help you, Google will always be your friend. If you're confused about anything, look it up: you're guaranteed to find something.
     
  15. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011
    #15
    C / Objective C

    Since this is a Mac development Forum your question indicates that you want to program the Mac. If you learn a lot of the suggested languages, you won't be ready to program the Mac easily and you will have to learn a second language. Once you understand C it will be easy to learn Objective C. Objective C is a superset of C. C++ is mostly a superset of C and Java is like C++, so when you do have to learn a second language you will be half way there.
     
  16. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #16
    I'm not quite sure what you're trying to say... You can absolutely make programs easily on the Mac using all of the suggested languages. It's not like iOS where the only language you can use is Obj-C.
     
  17. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #17
    You can also use Ruby (via RubyMotion) for iOS applications.
     
  18. hiddenmarkov macrumors 6502a

    Joined:
    Mar 12, 2014
    Location:
    Japan
    #18
    This would depend on your definition of mac programming to be honest. And what you want program.

    I am starting to develop on mac os as its my main computer now. My interests are in data analysis and science related realms. Quick googling is not showing libraries and such falling out of the sky in these realms for obj-c (C yes..but then I am not developing in obj most of the time then).

    Vice say the numerous ones for python, java, perl, etc.

    So in my universal language coding I care first and foremost that it runs on mac os properly. To the point I may hard code mac os items in the code. Not looking to run code on rh or ubuntu...I am not divering time to making it work on them.


    Am I mastering ojc-c (soon swift)? No. Am I writing code that may only work on mac os? Yes. Sounds like mac programming to me.
     
  19. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #19
    I started in BASIC on Commodore VC20 and went to 6502-assembler on C64. Was often hard but workable. Wrote on paper and loaded the hex then with a little loader written in BASIC ;)

    Today I would recommend Python to do the first steps. 3 reasons: easy language that enforces good indentation style, big useful library included, good books available.

    After that you should learn C, pure simple C. You will need it often as a glue language for nearly every language available.

    When you mastered that you have the groundwork to go to Obj-C and/or Swift. Jumping at these directly is hard as you are missing many concepts at the beginning and you get flooded with features.
     
  20. pppfff macrumors newbie

    Joined:
    Dec 23, 2010
    Location:
    Freiburg / Germany
    #20
    Hi Dranix,
    my first programming language was APL which was running on an IBM 360 mainframe.
    If you want to create 6 random numbers out of 49 then the code was 6?49.
    Very easy and powerful, but difficult to read if you have many pages of code.
    That was back in 1973.
    My first real time programming was with Assembler on a Z80 and I have implemented a Revox A70 band machine control system.
    Meanwhile I have learned many languages and I see no end in learning.
    Your advice sounds like learning Latin as a basic language which is surely true.
    I guess it depends if you need computer programming languages to earn money or to keep you busy in your spare time.
    Have a nice Sunday
    Peter
     
  21. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #21
    Well experience showed that understanding the concepts is more important then each single language. My first higher language after a lot of assembler on C64 and Amiga was Oberon-2. There I learned OOP concepts and am still often amused by the lack of understanding them in many fresh Java/C++ coders, today :)
     
  22. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #22
    Neither Ruby nor Python were written by trained educators (people who understand the problems people have trying to learn anything, not just computer stuff). Certainly not Objective C or C.

    Basic, Logo and Scheme were designed for educational purposes targeted at non-technical beginners, but none of them were successfully updated to modern programming concepts and current popular use.

    However, there seem to be many more books by educators, for kids and beginners, on Python than for most other contemporary languages, such as Ruby. I would not recommend Java, but there is a ton of education material on it that successfully gets school kids to pass the CS AP exam. So the existing explanatory material must make up for the language not being a good one for beginners.

    Swift is currently a terrible language for beginners. Unfinished, with a buggy implementation, plus a $99 enrollment fee to try out a beta. Wait 6 to 12 months for it. A lot of books may get written on it.
     
  23. hiddenmarkov macrumors 6502a

    Joined:
    Mar 12, 2014
    Location:
    Japan
    #23


    I personally have some doubts about what will be the first batch of books on the market in the fall so will say more towards the 12 months preferred for me.

    Not saying there way not be some good books. Just me being a bit jaded has the concern some of the first crop of books may be influenced by the rush to be the few books on amazon at release in the fall for easier sales.

    I won't say all authors will go for the fast buck to be like say the only 5 books a week after release. It jsut unless from a team like say nerd ranch...I am leery of accuracy of code testing in the book if x-code/swift at time of gold disking is very much a different animal than when draft was written. I've done a few beta's in a few areas, I have seen gold disk be more unlike beta than gold disk be almost like beta.

    Not a nerd ranch fan boy per se...its just I know they have the personnel (and will probably spring for the OT to bring them in to help the authors) to thoroughly test on gold disk release (when determined) to verify and change book as needed more accurately. Over a 1-2 person operation at any rate.

    I know with IT/programming books you can expect an errata download from their site for even the most thoroughly edited book. I just prefer that errata file not be measured in the 10's of mb's a week later lol. With apple's (excessive, imo) control over this release...I jsut see some of those first books errata's being nice file download size over time speed tests . I hope I am wrong about this tbh...it be nice. Time will tell that though.
     
  24. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #24
    What do you mean by excessive Control? Xcode 6 is like any Xcode beta before.

    Considering the rush of total coding noobs at the Swift sub forum at Apple - The control isn't hard enought. It's a fight with a buggy and incomplete compiler, but all this noobs get on my nerve…
     
  25. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #25
    One of the Nerd Ranch people has already tweeted something about spending the rest of the summer writing a book on Swift. At least one other author of one of the good iOS books as well. My worry is about potential changes to the language just as the books go into print.

    ----------

    Assembly language is the Latin of programming. They even used to teach it as a first programming language a few decades ago, even to high school students and non-tech majors in college.

    And now, some IT "professionals" consider it too hard to learn or use...
     

Share This Page