Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

What to study alongside C?

  • 31-03-2014 1:12am
    #1
    Registered Users Posts: 2,912 ✭✭✭


    Hi all,
    I'm a beginner in C programming currently working through K&R alongside some online tutorials covering C and introductory lectures on computer science to learn about machine level concepts, binary numbers, memory, etc. and C kind of forces you to get into these things at any rate.

    I have two main goals (but can't define a timeframe for it). I would like to be able to develop mobile apps - I initially started C to get a good background in programming with the view to progress to Objective C once I have decent command of C.
    The second is to be able to develop a dynamic website with high level functionality.
    Only I am not sure what language I should be learning to build website development skills as opposed to mobile development apps.

    I have researched a bit on php, python and rails, and am leaning towards rails at the mo but really don't know which to take on. I would really appreciate your help as I don't want to get bogged down in the wrong thing!


«1

Comments

  • Registered Users Posts: 2,012 ✭✭✭Colonel Panic


    Python is a good fit for dynamic webpages, also easy to extend with C or use from C and great for writing quick and dirty utility programs.

    Rails isn't a language, it's a framework for Ruby and I don't especially recommend it. If you want to go with Ruby, use a micro framework like Sinatra when starting out. Easy to get things up and running without hiding everything that's going on. Similarly, there's stuff like Bottle or Tornado for Python.

    There's also node.js, a server side Javascript framework and angular.js which is a Javascript client side MVC framework. These are in next-big-thing territory. Angular in particular is NOT beginner friendly, but I would keep an eye on them nonetheless.

    Steer clear of PHP, it's a commonly used language but not one that'll turn you into a good programmer and easily picked up afterwards if required.


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    If you're doing C, a good complement is something really high-level. I like python myself and it's pretty good from the job point of view. PHP is also good from the jobs point of view, but in terms of languages, it's been compared to a large ball of duct tape, broken glass and nails. Accurately.

    Erlang's fun, and the concepts in it are pretty outstanding but its syntax is horrible (Elixir is supposed to be a fix for that - I've not played with enough to know yet) and it's a bit esoteric for the jobs market from what little I've seen. Haskell has a pretty good following in this whole functional programming space, as does Scala, but I've not seen many jobs using them (but more than for Erlang).

    Ruby's got a pretty solid following in the startup world, but I've not seen much in the large $CORPORATION scene using it, but then again I've not seen everything :)
    Java's good for jobs but it's a very long-winded language and personally I'm not hugely fond of it.
    C++... is a bit like C, if you hit your head off the wall often enough. Not on my recommended list.

    Personally, I'd say give Python and Ruby a try, do something small and simple in them, see which one clicked with you more and go with that.


  • Registered Users Posts: 2,912 ✭✭✭pog it


    Great, thanks to you both for your replies! I'll work away on python and ruby so and see which sits best with me. I am wrecked in terms of looking for resources after C so I'm just going to go to the obvious spots like treehouse and codeschool, etc. to experiment with these new langs.
    I enjoy C but have to admit that it is pretty tough. I accept it gets easier the more you know and understand though.

    Can I ask if along with html, css and javascript, combined with ruby or python, I'd have enough skills to pull together a very nice website?


  • Technology & Internet Moderators Posts: 28,791 Mod ✭✭✭✭oscarBravo


    pog it wrote: »
    Can I ask if along with html, css and javascript, combined with ruby or python, I'd have enough skills to pull together a very nice website?

    You should. Rails (for Ruby) or Flask or Django (for Python) will provide a comprehensive framework for a full-featured website back end.


  • Registered Users Posts: 2,912 ✭✭✭pog it


    Just starting Ruby here and the syntax is looking almost annoyingly simple so far.
    I'm not complaining as I am sure it's going to get rougher! But where is the challenge with this scripting language? There is a massive difference between learning this and C.. of course C is a programming language.
    Is the challenge in combining it with the framework such as rails?

    Edit: Using 'Learn Ruby the hard way' now as well as codeacademy for syntax basics.


  • Advertisement
  • Registered Users Posts: 2,012 ✭✭✭Colonel Panic


    It's not that Ruby or Python aren't a challenge, it's just really quick to get things up and running with them.


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    The challenge with Ruby and Python is supposed to be the job you're working on, rather than getting the tools to do what you want them to :D

    Languages like C have specific areas for which they're the best tools to use, but they do require you to do more work than some other languages. Horses for courses - which is why you don't see much use of C for really large application-type projects or web startups or the like (and conversely, why C is so ubiquitous for systems programming).


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I'm going to break from the pack here and say don't bother learning a 2nd or 3rd language at this point. Or if you want to start using a higher level language, which is probably a good idea given your end goals, then switch to just learning that on it's own rather than continuing with C.

    IMHO it is far more productive to focus on learning one language, and then using your time to progress into more advanced topics (more advanced algorithms/data structures, databases, web services, graphics etc), rather than learning the basics across multiple languages.

    Once you get good at development in one language, and have a good understanding of the more advanced and higher level areas, switching languages is pretty easy.


  • Registered Users Posts: 2,912 ✭✭✭pog it


    stevenmu wrote: »
    I'm going to break from the pack here and say don't bother learning a 2nd or 3rd language at this point. Or if you want to start using a higher level language, which is probably a good idea given your end goals, then switch to just learning that on it's own rather than continuing with C.

    IMHO it is far more productive to focus on learning one language, and then using your time to progress into more advanced topics (more advanced algorithms/data structures, databases, web services, graphics etc), rather than learning the basics across multiple languages.

    Once you get good at development in one language, and have a good understanding of the more advanced and higher level areas, switching languages is pretty easy.

    I've left C aside for now and focussing on Ruby which is wonderful for a change.

    Thanks all for the tips.


  • Registered Users Posts: 2,012 ✭✭✭Colonel Panic


    Just keep in mind that pretty much everything is built on top of the foundations of code written in C, including Ruby!


  • Advertisement
  • Registered Users Posts: 1,922 ✭✭✭fergalr


    pog it wrote: »
    I've left C aside for now and focussing on Ruby which is wonderful for a change.

    Thanks all for the tips.


    One word of warning - in my opinion, ruby is semantically a little unclean.
    This mightn't make it a great beginner language.

    Its productive, but might be confusing.
    If you find yourself getting confused, something like C - or Java - or, if you want to go high level, Python, might be better.

    Example illustrative ruby code:
    2.weeks.from_now
    
    require 'date'
    t = DateTime.now
    puts t 
    
    # Add 14 days
    puts t + 14 
    
    # Add 2 months
    puts t >> 2 
    

    (What does any of that even mean?)


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    Just keep in mind that pretty much everything is built on top of the foundations of code written in C, including Ruby!
    Yes, but that doesn't mean you need to know C to use those things. My car's made of metal, but I didn't have to take a welding course to learn to drive it...


  • Registered Users Posts: 2,012 ✭✭✭Colonel Panic


    Except that's not what I said, but hey, I love hyperbole as much as the next man!


  • Registered Users Posts: 2,912 ✭✭✭pog it


    fergalr wrote: »

    Example illustrative ruby code:
    2.weeks.from_now
    
    require 'date'
    t = DateTime.now
    puts t 
    
    # Add 14 days
    puts t + 14 
    
    # Add 2 months
    puts t >> 2 
    

    (What does any of that even mean?)

    Would it not be easy to find that out?
    Have you ever spent time with Ruby Fergair?

    The problem for me is that even though learning C is doable it seems like harder work than I need to put myself through as I am not aiming to become a programmer. I wouldn't ever be able to compete with the naturals at it anyway.

    I don't like the idea that Python is white space sensitive and so serious about indentation. At least with C you can choose your own levels of indentation so it feels freer. It's a small thing maybe relatively though and I may well change over to Python again but so far Ruby seems plain enough.


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    The indentation is something that you very quickly forget about with Python to be honest. Most editors will handle it for you anyway.


  • Technology & Internet Moderators Posts: 28,791 Mod ✭✭✭✭oscarBravo


    Sparks wrote: »
    The indentation is something that you very quickly forget about with Python to be honest. Most editors will handle it for you anyway.

    I'm also curious as to why you'd want to indent in a way other than that required by the Python syntax.


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    oscarBravo wrote: »
    I'm also curious as to why you'd want to indent in a way other than that required by the Python syntax.
    Indentation? Dude, that's like one of the three holy wars, alongside emacs-versus-vi and kde-versus-gnome...


  • Technology & Internet Moderators Posts: 28,791 Mod ✭✭✭✭oscarBravo


    Sparks wrote: »
    Indentation? Dude, that's like one of the three holy wars, alongside emacs-versus-vi and kde-versus-gnome...
    Yeah, I know all about spaces versus tabs and where to stick your curly brackets, but we're talking about whether or not code that forms a logical sub-block should be indented, and I can't understand why you wouldn't.


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    Ah, but you're omitting the do-you-indent-the-case-line-in-switch and other such discussions on what is part of what logical block...


  • Technology & Internet Moderators Posts: 28,791 Mod ✭✭✭✭oscarBravo


    Sparks wrote: »
    Ah, but you're omitting the do-you-indent-the-case-line-in-switch and other such discussions on what is part of what logical block...

    Sure, but those are syntactical edge cases in C that don't have equivalents that I can think of in Python.

    Basically, I hear "I don't like Python because it forces me to indent" a lot. That says to me that there are people who want to write code that looks like
    if (a > b) {
    c = a;
    } else {
    c = b;
    }
    
    and I can't understand why you'd want to do that. If someone can give me an example of how they'd like to write Python code and how it won't let them do it, I'd appreciate it.


  • Advertisement
  • Registered Users Posts: 1,922 ✭✭✭fergalr


    pog it wrote: »
    Would it not be easy to find that out?

    Its easy from just looking at the code to figure out what it does.

    But that's not my point. My point is that it's not semantically clean.

    "2.weeks.from_now"

    The 'dot' operator, like usual, is to invoke a method on an object.

    Apparently, the '2' object knows something about 'weeks'.


    I don't know how that works underneath the hood. If anyone with more ruby experience wants to explain it, I'm all ears.

    But the semantics going on there are horrible.

    pog it wrote: »
    Have you ever spent time with Ruby Fergair?

    A little time, not much.

    Its pretty easy to pick up if you know other similar languages, and I've spent substantial time with, e.g. C,C++,Java,Perl,Python (and others) which are pretty similar. I'm also ok at coding in a functional style, or in lisp-likes, so I see those influences too - I kind of know what I'm getting into.


    But anyway, I'm not sure that's too relevant.

    I mean, if the principle being applied is that I can't criticise it if I haven't spent much time with it - well, I haven't spent much time with brain****, and I know I don't want to spend more with it.


    Anyway, where I'm coming from here:

    I find that when someone is learning the program, the most important thing is not how hard the syntax is - its how 'consistent' the abstractions the person has to learn are. What kills a learners momentum is when something isn't working the way they expect, and they just can't figure out why. Because the abstraction that they learned is leaking.
    And I'd just be concerned that ruby (or more correctly, ruby as currently written, and in libraries etc.) would do that more than python.
    pog it wrote: »
    The problem for me is that even though learning C is doable it seems like harder work than I need to put myself through as I am not aiming to become a programmer.

    Sure, I totally understand that.

    Learning C is a long and painful path to learning to program - although it will make you a good programmer.
    pog it wrote: »
    I wouldn't ever be able to compete with the naturals at it anyway.

    That's probably nonsense. I mean that in a nice way :)

    I looked back at your previous thread, which is almost a year ago now, as I remembered your name.

    Don't write yourself off. Like, seriously. If you are still interested in this stuff, you are probably properly interested. You could probably become the best programmer on the development forum if you wanted, it'd just take a long time. Its mostly about keeping at it, and being interested.
    Telling computers the right thing to do is hard for all of us, we're not naturally that logical. That's why landers crash into mars and why everything is broken.

    Anyway, blah blah, not to be about platitudes and stuff, but don't say you 'arent a natural' or some such, you're probably operating from false assumptions (in my opinion) and underestimating where you can go. (If you just dont *want* to go beyond a certain point, thats fine too; up to you; but dont think you can't - you probably can.)
    pog it wrote: »
    I don't like the idea that Python is white space sensitive and so serious about indentation. At least with C you can choose your own levels of indentation so it feels freer. It's a small thing maybe relatively though and I may well change over to Python again but so far Ruby seems plain enough.

    The white space sensitivity is annoying.

    It does mean that everyone's code is properly formatted, in a consistent style, which is nice. But it is annoying.

    But it also keeps code clean, and sometimes makes it easier to look at and read and absorb. Positive and negative.

    Anyway, that's a comment about syntax. Immature programmers tend to focus on syntax too much. (Not that it isnt important; but its not as important as people initially think, within limits.) Really semantics is more important than syntax!


    Anyway, Ruby is a fine language; you'd be fine with it; I just would suggest Python more to a beginner.


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    Sparks wrote: »
    Ah, but you're omitting the do-you-indent-the-case-line-in-switch and other such discussions on what is part of what logical block...
    oscarBravo wrote: »
    Yeah, I know all about spaces versus tabs and where to stick your curly brackets, but we're talking about whether or not code that forms a logical sub-block should be indented, and I can't understand why you wouldn't.

    Ssssh, you guys, stop talking about syntax, try to set a good example here!


  • Registered Users Posts: 5,246 ✭✭✭conor.hogan.2


    fergalr wrote: »

    Example illustrative ruby code:
    2.weeks.from_now
    
    require 'date'
    t = DateTime.now
    puts t 
    
    # Add 14 days
    puts t + 14 
    
    # Add 2 months
    puts t >> 2 
    

    (What does any of that even mean?)

    Example Rails code, I can show you some mental looking Django/JEE/etc as it is an abstraction...
    As for the ">>" well that is just syntactic sugar, you could define your own method in date call add if you wanted.


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    Example Rails code, I can show you some mental looking Django/JEE/etc as it is an abstraction...

    Are you saying the code I gave wasn't representative?
    I thought it was?

    Yes, its Rails code. But Rails is a big part of the reason people use Ruby, no? Like, its deep in there in the Ruby ecosystem.

    People telling me about the good parts of Ruby have pointed to code like I gave above.

    Yes, there's horrific parts of Java Enterprise code, with class hierarchies 10 levels deep where none are needed. That's a black mark against java, imo.

    I don't think Python generally tends to suffer as badly from this?
    There's elements of personal preference here, sure.
    As for the ">>" well that is just syntactic sugar, you could define your own method in date call add if you wanted.

    Yeah, that's true; I just don't think its very good syntactic sugar.

    Anyway, ruby is still a good language; I'm not saying it isn't; just that I think python is cleaner.


  • Registered Users Posts: 5,246 ✭✭✭conor.hogan.2


    Well cleaner is highly subjective. It is fairly representative yes but Rails has its own sugar and style on top of ruby and you can always go against the shorthand or ruby style and spell it out if you think it is cleaner or more obvious that way.
    Matz is more influenced by Perl and not a BDFL influencing one right way to do things (both have advantages).

    It is a toss up for a beginner between the two of them either way.


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    Well cleaner is highly subjective.

    Its hard to describe, pin down, be certain of, sure; but that doesn't mean there's no better or worse.

    "2.days.ago" is, all other things being equal, semantically not very clean.

    (I mean, theres a '2' object, which you can access anywhere, that somehow knows about days? and ago-ness? Or maybe the '2' has some days? And these days have ago-ness? Does '2' know about calendars? etc.

    This is clearly a hack. Probably a worthwhile hack for shipping web code quickly, but that makes it less good as a language for beginners.)

    It is fairly representative yes but Rails has its own sugar and style on top of ruby and you can always go against the shorthand or ruby style and spell it out if you think it is cleaner or more obvious that way.

    Sure, you can choose not to use it.

    If we allow that point, then pretty much all standard libraries and eco-systems are suddenly immune from criticism.

    But if its representative, then that kind of makes my point: beginners are going to have to read it and try and figure out how it works. They are either going to accept that its magic (which is confusing and shakes confidence) or go down a rabbit hole. Neither is great for a beginner.
    Matz is more influenced by Perl and not a BDFL influencing one right way to do things (both have advantages).

    I think, as far as [languages for beginner programmers] are concerned, "there should be only one obvious way to do it" hands down beats "there's more than one way to do it".


    (As an aside, Perl is pretty nasty sometimes as a result of the 'more than one way').
    It is a toss up for a beginner between the two of them either way.

    They are both good, but I disagree with you there.


  • Registered Users Posts: 1,931 ✭✭✭PrzemoF


    >> is a bit shift, using it for anything else is blasphemy and naming it syntactic sugar won't change the reality ;)


  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    PrzemoF wrote: »
    >> is a bit shift, using it for anything else is blasphemy and naming it syntactic sugar won't change the reality ;)

    And what C++ did with it is more supporting argument than refutation!


  • Registered Users Posts: 2,012 ✭✭✭Colonel Panic


    I cringe when I see those operators overloaded for streams in the C++ standard library. Inappropriate operator overloading? That's a paddlin'.

    You should see some of the abominations I've seen. Even if I sanitised the class and method names, they would still be identifiable!


  • Advertisement
  • Registered Users Posts: 40,055 ✭✭✭✭Sparks


    The stream operators are only the smallest, tiniest, least inconvenient piece of C++'s evil.
    Try reading the FQA sometime...


Advertisement