Language advice



  • Wish to learn C or C++ but don't really know where to start.

    I have been working with C#,VB.net (and earlier) and some php.

    Does anyone have some ideas which would be better to get into and what books/sites or other resources should i make sure i have for myself. Since I kicked out ms I would prefer some non-M$ resources ;-)



  • Compared to C#, the C [i]language[/i] is incredibly simple.  When it comes to [i]programming[/i] in C, it's a whole 'nother story.  There are actually only a few basic concepts that you need to know to understand the vast majority of C code.  Those concepts, however, can be tough to grasp (mostly the memory management).


    I would avoid C++ as it is another semi-OO language (it still has basic types like C# and Java) and it is [i]incredibly[/i] complex when compared to C.  It's a really vast language.  It doesn't help that C is still valid in C++, and people tend to just write C in C++ with little consideration in regards to how the new features of C++ could make their code better.

    Now, if you want to learn some real object-oriented programming you are going to need to go for a language like Ruby where everything is an object.  (This has been a public service anouncement from That One Guy Who Always Has to Recommend Ruby)



  • the problem with ruby is that it is an interpreted language and anyone to use the programs you write will need to download and instal the interpreter.

    Thanx for the other advice though.

     



  • I would actually sugest learning both C and C++

    When anybody tells you that one is strictly better than the other, they are telling you their preferences.  They are similar syntactically, but other than that they are both quite different.  I feel any good developer should have deep knowledge of a few languages.  C and C++ both are still prevelant in the world. "Legacy code" abound. So they are both marketable languages still.

    I personally prefer C++ over C for the most part, but I've been enjoying Java a lot more recently (Since 1.5 was released)

    That's just personal opinion though, take from it what you want :-)

     



  • Because C++ is built on the foundation of C, it's probably best to start with C if only to get used to the style and strictures of it.  

    Dealing with pointers/arrays/strings tends to have a steep learning curve and you're best off just trying to get all of that straight before digging into OO stuff.  C puts you a lot closer to the metal, and if you're used to being up on top of .NET, there'll be a lot to learn about how things work without the CLR to catch you. :)

    -cw



  • I assume you are going to be using *nix since you don't seem to like microsoft.  My advice is consult the man pages ALL THE TIME.  in *nix just type "man fork" or whatever function you are looking for, or if you want better format just google it.  When writing in C I use the man pages constantly.  Mostly so that you don't end up coding something specific for your compiler or platform (lots of things work on Windows that aren't suppose to).  



  • C++ is THE language to know. I've been doing Java for a while, since it's not only what the current CS classes are based on, but it's also used in research projects i'm involved in. I love the language and there are lots of good uses for it, but C++ is something that I wouldn't mind having more experience with.

     If you look around, pretty much all the software you're using today is written in C++. You'll find commercial software products written in it wherever you go, so a solid knowledge will go very far. Anything from web browsers to games to desktop software is in the pile.

    http://www.research.att.com/~bs/applications.html

    There's really not much new when going from C++ to C. Memory management is different, and there are no classes and the features that come with that. I wouldn't worry about trying to learn C first. Learn the C++ language and then get a good grip on the template libraries. http://boost.org/doc/html/who_s_using_boost_.html
     



  • It seems that c++ is the road to go for most people so I will try my hand at that.

     Thanks to all for the insightfull coments and advice.

     I am sure that i will be back here at times with questions on how to get things done, like someone said here, I do not have any CLR anymore to do most of the hard work for me :)

     B.t.w. I did not switch to *nix because I do not like microsoft, i am just enamoured by *nix systems and it gives me a complete new (well for me anyway) environment to work in and play with.

     



  • @coentje said:

    It seems that c++ is the road to go for most people so I will try my hand at that.

     Thanks to all for the insightfull coments and advice.

     I am sure that i will be back here at times with questions on how to get things done, like someone said here, I do not have any CLR anymore to do most of the hard work for me :)

     B.t.w. I did not switch to *nix because I do not like microsoft, i am just enamoured by *nix systems and it gives me a complete new (well for me anyway) environment to work in and play with.

     

    If you're going to a *NIX system, then C++ is not going to be quite as popular as you think. Java outweighs C++ projects 4 to 1 on Sourceforge, and even Python is more popular than C++. C++'s general popularity can be contributed to three factors: the commercial failure of Smalltalk, the proprietary nature of Objective-C, and the success of Microsoft Visual C++ on Windows.

    There's basically one reason to learn C++: Windows games.



  • [quote user="djork"]

    If you're going to a *NIX system, then C++ is not going to be quite as popular as you think. Java outweighs C++ projects 4 to 1 on Sourceforge, and even Python is more popular than C++. C++'s general popularity can be contributed to three factors: the commercial failure of Smalltalk, the proprietary nature of Objective-C, and the success of Microsoft Visual C++ on Windows.

    There's basically one reason to learn C++: Windows games.[/quote]

    I fiddled with java quite a bit some years ago but i never felt like i was working with a real language, just like with php or javascript, it just seems too much like your playing around in something that is fun but not usable in the real world. I know that it is being used a lot and with great success but to me it keeps on feeling amateurish (probably more my fault than theirs, lol) Once i made the switch from VB to C# it finally starrted falling into place a little, c# just feels more natural to work in, more logical, so to me the natural way to progress and improve myself further seems either c or c++ If the general consensus would be that that is not a smart way to progress then still i think i will go in that direction :)

    It might be a good idea too to just look into Ruby and give you another convert ;) i am just not that fond of interpreted languages. If the only reason to learn c++ is windows games there is no reason for me at all to even try it becaus, though i like playing games, i have no interest in making them.



  • you think C# is great and java is a toy language?   How is that possible?



  • [quote user="djork"]There's basically one reason to learn C++: Windows games.[/quote]

    Err... ?   I wrote C++ for over a decade and never even touched games.  It's influence is waning to be sure, but there'll be new development in it for a while yet, and legacy work until the end of time.
      

    [quote user="tster"]you think C# is great and java is a toy language?   How is that possible?[/quote]

    I kind of felt the same way.   I was brought in by a company to review and remediate some Java systems which, besides being miserably written by a bunch of cowboys who didn't know their ass from an algorithm, just felt clunky and slow and arbitrary...mostly because the devs seemed to go out of their way to play with cool language features rather than just doing the job. 

    I've come up against Java in two other places since, and in all three cases I've been unimpressed by both the quality of the code and the resulting systems. I was perfectly ready to get on the bandwagon, but I just ended up feeling "meh" about it.

    On the other hand, I really like C#.  I find that it exists very close to the level of my design, and complex ideas can be represented quite simply.  Once they added generics, I was a full convert.

    Might just be a quirk of how I came to be introduced to Java & C#, but I think you'll find lots of people who feel that way.  (And, of course, a lot of people who feel the exact opposite.)

    -cw



  • I basically see C# as an imitator of Java, and now Java 1.5 has introduced all of the features C# had over Java.  So the playing field is basically level.  What Java [i]does[/i] have going for it, outside of language features, are things like portability (not just Windows!), the Ant build system, a HUGE community, more Open Source support, and a much wider variety of packages and frameworks available.  Also it's free, as in beer, and soon to be as in speech.  You don't have to buy Windows to develop Java applications.  Before someone chimes in: yes, I know about Mono.  No, it doesn't really work.



  • @coentje said:

    Once i made the switch from VB to C# it finally starrted falling into place a little, c# just feels more natural to work in, more logical, so to me the natural way to progress and improve myself further seems either c or c++ If the general consensus would be that that is not a smart way to progress then still i think i will go in that direction :)

    C++ has as much in common with C# as it does with Java. Really.

    @coentje said:

    It might be a good idea too to just look into Ruby and give you another convert ;) i am just not that fond of interpreted languages.

    I think it's good to distinguish between interpreted and compiled, as you have, but it's also good to know where interpreted vs. compiled languages are appropriate. Interpreted languages are often completely acceptable for many tasks. I also think that it's very important to distinguish between static and dynamic languages too.

    It's hard to describe exactly what is possible with dynamic languages. You should experience it first-hand. I don't think that Ruby is the perfect language for every project or anything silly like that, it's just a great language and worth learning if only for what you can learn about things like functional programming, dynamic typing, metaprogramming, closures, generators, and other advanced concepts that you won't really find implemented well in mainstream languages.

    I'm not looking for "converts," I'm just looking for people to broaden their perspecitves and knowledge.

    And for good measure read this: http://www.treelight.com/software/ruby/RubyRocks.html



  • [quote user="tster"]you think C# is great and java is a toy language?   How is that possible?
    [/quote]

     

    I am not saying java 'is' a toy it just feels like one to me. Java certainly has its place in the development world, my place in it is just not with java.



  • [quote user="djork"][quote user="coentje"]

    Once i made the switch from VB to C# it finally starrted falling into place a little, c# just feels more natural to work in, more logical, so to me the natural way to progress and improve myself further seems either c or c++ If the general consensus would be that that is not a smart way to progress then still i think i will go in that direction :)

    [/quote]

    C++ has as much in common with C# as it does with Java. Really.

    [quote user="coentje"]

    It might be a good idea too to just look into Ruby and give you another convert ;) i am just not that fond of interpreted languages.

    [/quote]

    I think it's good to distinguish between interpreted and compiled, as you have, but it's also good to know where interpreted vs. compiled languages are appropriate. Interpreted languages are often completely acceptable for many tasks. I also think that it's very important to distinguish between static and dynamic languages too.

    It's hard to describe exactly what is possible with dynamic languages. You should experience it first-hand. I don't think that Ruby is the perfect language for every project or anything silly like that, it's just a great language and worth learning if only for what you can learn about things like functional programming, dynamic typing, metaprogramming, closures, generators, and other advanced concepts that you won't really find implemented well in mainstream languages.

    I'm not looking for "converts," I'm just looking for people to broaden their perspecitves and knowledge.

    And for good measure read this: http://www.treelight.com/software/ruby/RubyRocks.html

    [/quote]

     

    I agree with you on the fact that every tool has its use when used in the proper way and the proper place. Even VB has its good qualities (hell, even Oracle has, lol) There is no one language or system to fit all needs so you have to make them work together where needed.

    Interpreted language are very good to use if you need to have an app that is usable on any conceivable platform and compiled ones are better for platform specific apps. From what i heard and read ruby is amazing when it comes to rad, I have no idea what it does when it comes to apps that need performance and scalability though.

    I do not want to get into a cock-fight about which language is better (like some are trying to say) i just want to see which language is better for me. For me all language are equal except some are better in specific tasks then others.
     



  • [quote user="coentje"]

    [quote user="tster"]you think C# is great and java is a toy language?   How is that possible?
    [/quote]

     

    I
    am not saying java 'is' a toy it just feels like one to me. Java
    certainly has its place in the development world, my place in it is
    just not with java.

    [/quote]

     I think his point
    was that C# is basically a carbon copy of Java. The syntax, the
    underlying concepts, it's all the same with minor variations. So if
    they "feel" significantly different to you, you can't really be basing
    your judgement on the actual technical features of the languages.

     



  • @coentje said:

    Interpreted language are very good to use if you need to have an app that is usable on any conceivable platform and compiled ones are better for platform specific apps. From what i heard and read ruby is amazing when it comes to rad, I have no idea what it does when it comes to apps that need performance and scalability though.

    I do not want to get into a cock-fight about which language is better (like some are trying to say) i just want to see which language is better for me. For me all language are equal except some are better in specific tasks then others.
     

    You seem to have a very narrow view of interpreted vs. compiled. Generally compiled languages are no better suited for "platform-specific" software than interpreted ones are. C, perhaps the most widely known compiled language, is purposefully designed to be portable to numerous environments, from embedded microcontrollers to Windows to UNIX. VB, an interpreted language, is about as platform-specific as you can get. There are so many more distinctions to be made between langauges than compiled or interpreted. There are even dynamic compiled languages (Objective-C) and static interpreted languages (VB).

    Ruby is terribly slow when compared to C... on an order of [i]hundreds[/i] of times slower in certain algorithms. In the real-world, unless you're doing serious heavy-weight computations, you will [i]never notice the difference[/i] because, in terms of human perception, each implementation performs operations in an instant. So in the case of your average application (web-based or otherwise) this doesn't preclude Ruby from being appropriate. Of course, digging deeper into the language reveals the ability to write compiled C extensions to the Ruby language that implement that "heavy lifting."

    Learning new languages is great... but just don't fool yourself in the process. Broaden your perspectives and you will be a better programmer for it.



  • [quote user="coentje"]

    [quote user="tster"]you think C# is great and java is a toy language?   How is that possible?
    [/quote]

     

    I am not saying java 'is' a toy it just feels like one to me. Java certainly has its place in the development world, my place in it is just not with java.

    [/quote]

    How does a language feel like a toy?  I'm assuming maybe because you feel too separated from the hardware, cpu, memory, etc.  Learn C or assembly if you want to get closer to the metal, maybe that would feel less toy-like to you.  Or better, find a language, simplify it, then write an interpreter for it in a language you know.  Then write a compiler for it.  After you have done this, no language should feel like a toy for you because you will know what they are all doing behind the scenes, and you will welcome this, because you realize it is no longer necessary to do those things "by hand".



  • There are some good C++ book reccomendations on this page, particularly Accelerated C++.

     



  • [quote user="CodeWhisperer"]

    [quote user="tster"]you think C# is great and java is a toy language?   How is that possible?[/quote]

    I kind of felt the same way.   I was brought in by a company to review and remediate some Java systems which, besides being miserably written by a bunch of cowboys who didn't know their ass from an algorithm, just felt clunky and slow and arbitrary...mostly because the devs seemed to go out of their way to play with cool language features rather than just doing the job. 

    I've come up against Java in two other places since, and in all three cases I've been unimpressed by both the quality of the code and the resulting systems. I was perfectly ready to get on the bandwagon, but I just ended up feeling "meh" about it.

    On the other hand, I really like C#.  I find that it exists very close to the level of my design, and complex ideas can be represented quite simply.  Once they added generics, I was a full convert.

    Might just be a quirk of how I came to be introduced to Java & C#, but I think you'll find lots of people who feel that way.  (And, of course, a lot of people who feel the exact opposite.)

    -cw

    [/quote]

     

    Mostly the bad java code out there is from the "cowboys" the "I have a degree in it so I must be right" kind of people. I have seen reliable benchmarks that place java very close to C++ in performance. Java, just like some other high level languages can be made to "work" by somebody who doesn't see the big picture of things. Properly written Java can do some amazing things when it is properly tuned, profiled, tested, and deployed.

     



  • Some books you might want to get if you are serious about learning C and system programming:

    Kernighan/Richie - The C Programming Language - Prentice-Hall

    Schildt - Born to Code in C - McGraw-Hill

    Stevens - Advanced Programming in the Unix Environment - Addison-Wesley

     



  • You did not just recommend Schildt to someone with a straight face.  Admittedly, there are worse Schidlt books than Born, but in general he's either wrong or gratuitously narrow in scope.

     



  • @Angstrom said:

    You did not just recommend Schildt to someone with a straight face.  Admittedly, there are worse Schidlt books than Born, but in general he's either wrong or gratuitously narrow in scope.

     

    hahahahahaha!

    In general, everything i know about programming in languages other than APPLE IIc "basic" and QBASIC is out of o'reilly books.



  • Most interpreted languages have some feature of calling external native routines (ie. Java JNI, PHP extensions, Perl modules, etc.). You can write the DLLs in C or C++ to do the heavy work, and the application in Java to leverage OOP. I think it's the best solution. From what I have managed to glance, JNI is quite easy to use (compared i.e. to PHP's extension interface).


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.