10

Fellow Deviants, I need your help in understanding the importance of C++

Okay, I need to clarify a few things:

I am not a beginner or a newbie who has just entered this community...

I have been using C++ for some time and in fact, it was the language which introduced me to the world of programming... Before, I switched to Java, since I found it much better for application development...

I already know about the obvious arguments given in favour of C/C++ like how it is a much more faster and memory efficient than other languages...

But, at the same time, C/C++ exposes us and doesn't protect us from ourselves.. I hope that you understand what I mean to say..

And, I guess that it is a fair tradeoff for the kind of power and control that these languages (C/C++) provide us..

And, I also agree with the fact that it is an language that ideally suits our need, if we wish to deal with compilers, graphics, OS, etc, in the future...

But, what I really want to ask here is:

In this age and times, when hardware has advanced so much, where technically, memory efficiency or execution speeds no longer is the topmost priority... These were the reasons for which C/C++ was initially created...

In today's time, human concept of time matters more and hence, syntactical less complicated languages like Java or Python are much more preferred, especially for domains like application development or data sciences...

So, is continuing with C++, an endeavour worth sticking with in the future or is it not required...

I am talking about this issue since I am in a dilemma about the use of C++ in the future...

I would be grateful if we could talk about keeping AI, Machine Learning or Algorithms Optimisation in mind... Since, these are the fields in which I am interested in...

I know that my question could have been posted in a better way.. But, considering the chaos that is present in my mind, regarding this question doesn't allow me to do so...

Any kind of suggestion or thoughts would be welcome and much appreciated...

P.S: I currently use C++ only for competitive programming or challenges...

Comments
  • 3
    Im a data analyst, so i can talk a bit about algorithm opimalization.

    We.. We just use java. Yes, we could use c++ and spend weeks on pointers and whatnot to win 1-2 seconds of computation time, but at the same tim we would have to port to web, make our own servers, our cluster would be one hell of a mess if we had to write the os for it (this one is a bit exaggerated but still)

    But when using java (7), we can simply deploy to a jsp server and let the customized cluster do the work. Yes, it might be slower to calculate on larger datasets, but instead of spending weeks to optimalize a code, we actually get work done.
  • 0
    Yeah and also haskell runs really fast but ive never really dipped into that
  • 4
    Whatever allows you to do the most work in the shortest time. You've answered your own question.
  • 1
  • 1
    @Jifuna Can you be a little more explicit??

    I am grateful that you have liked my rant but I would be grateful if you could express your views regarding this topic...
  • 0
    //Just suscribing to thread. Sry for not adding anyhing lol
  • 2
    C++ is the most widely used programming language on the planet, and has a larger dev base than any other language. Virtually all hardware drivers are written in C++, as well as system kernels, controllers, etc. Most game core code is written in C++, simply because no other language can perform like C++. Once you start digging, you will quickly find out that it is still the most used programming language over any other.
  • 1
    @SuyashD95 haha, I was just subscribing to this rant but I can ofcourse share my views on this topic. I just beginned learning c++ but I started learning it because it so low to the "metal", fast and because you can run it almost everywhere (except the use of platform depending librarys ofcourse).
  • 2
    @drymonsoon First of all, thank you so much for your response...

    Frankly, I haven't used Go and the only thing that I know about it, is the fact, it is developed by Google...

    And, I have heard so much about the efficiency of functional languages that it has successfully been able to create a curiosity for me to take a look at it...

    So, once again, thanks for your answer and making me a lot more interested in Go...

    I would love if you could tell me a little more about Go.. I know that I could Google it up but still I would love if you could tell me why you prefer Go or its features in a little more detail...
  • 1
    @Jifuna Thank you for explaining me your reasons... It really helps me in coming to an answer....
  • 1
    @Luigi003 Your reply made me chuckle for a moment, considering how it was written.. Talking about the use of // symbol...

    Reminds me of the debates regarding comments...

    I hope that this rant or my dilemma could also aid you in finding an answer to your own questions...
  • 1
    I assume you used an Android Device to write this post. Lets see how C/C++ played a role in it.

    You typed this post using your touchscreen, right? Your touchscreen's entire driver is written in C, can be found in your device's kernel source.

    The fact that you are able to see what you are typing on your display, the display drivers, too are written in C.

    The fact that you are actually able to see the display, the lights HAL, is also written in C.

    The keyboard you used for typing, although its written in Java, it has a JNI, so ofcourse the native code is written in C/C++.

    And then there is your wifi/Mobile data (RIL actually) using which you posted this, whose drivers and HAL/HAL like implementation is also written in C/C++.

    And there's more.

    Ok enough of C/C++ for today.
  • 1
    @boo1997 Wow... Never really about these kind of stuff...

    So, what I gather from your post, is that while C/C++ might not be the main star of the show, but without it, anything else is not possible...

    Since, it is the driving force on which everything depends on/ builds on...
  • 1
    @iAmNaN I would like to thank you for your views... It was really insightful...

    I felt that I was kind of stupid to invest time and effort into something which might have become obsolete or will become irrelevant in the future..

    So, thank you once again for showing me the other side of this coin...
  • 1
    @QoolQuy2000 You are right... Time is indeed precious and anything which helps us doing things faster is supposed to be better..

    But, what if time is not a factor or to be more precise, not the topmost priority, then my question to you is:

    Will your answer still remain the same?

    I am asking this because I know how crucial time is, especially when it comes to application development..

    But, in my case, my path is not still completely set... If possible, I would like to enter into R&D, to be more precise, research related to Machine Learning or AI...

    In these scenarios, I assume that instead of time, efficiency of the solution will be more important...

    So, even in the above mentioned case, will investing time in C/C++ still considered to be a waste??

    I know that I am deviating from the original path but I like I said earlier, I am confused...

    And, any kind of advice will be much welcomed...
  • 2
    @SuyashD95 Your questions are good, and deserve a detailed reply, which I want to provide, but the 1000 char limit it making that really hard.

    First I'll ask what you mean by "what if time is not a factor". Do you mean in terms of dev time (ie, how long to code something) or program run speed?

    I don't know what is commonly used in ML or AI. I would recommend investigating what's used there, rather than listening to people tell you what language they find cool (unless they're using it for ML/AI themselves). "I assume that instead of time, efficiency of the solution will be more important" I agree, so I would have guessed they'd use Python, R, Matlab, etc, but that's just a guess.

    Some of the replies here have been trying to big-up C and C++ by saying it's used for kernels and device drivers. True, but why does that matter to you unless you're writing dev drivers or kernels? That's like saying truck drivers are the most important part, because they delivered your computer to you.
  • 1
    @QoolQuy2000 When I say, time is not a factor... I am referring to the time, a Dev spend on coding..

    In my opinion, application development is all about delivering production level apps in a limited amount of time... And, these scenarios, it doesn't make sense to write everything from scratch..

    Hence, the better the support of native/ third party packages, the more efficient a language is considered... In the end, it all comes down to domain specificity...

    But, research is about finding the most efficient answer to a particular question...

    In my experience, I found C++ useful, especially while dealing with implementation of classical algorithms or use of advanced data structures... This is why I mentioned that I use them specifically for competitive programming...

    I found them more intuitive to use than other languages due to their proximity to the 'metal'...

    BTW, what happens if we cross the character limit?

    Just curious for situations like now...
  • 1
    Damn, character limit...

    @QoolQuy2000, I understand that C++ is not the ideal language for everything...

    In fact, that is why I switched to Java... But, even then, I see cases where C++ just looks like a more viable medium to reach to a conclusion...

    And, the reason for this question.. I am in the process of revisiting C++ due to the reasons mentioned in my earlier reply to you...

    But, I hear so many people telling me that investing time in C++ will be not worth it... And, I should leave it...

    This, again leads me to a dilemma..

    Should I stop exploring this archaic language abruptly or are there any advantages to continue digging deeper??

    And, if I stop, then, what could be the point, where I could consider that's it's a good time to leave??

    And, if I dig deeper, then what could be the things that I could explore in this language which could make this endeavour worthwhile??
  • 1
    @SuyashD95 I'd take a step back from the "dev time not a factor" idea. That is *never* true. Budgets and manpower aren't limitless. If they where, would we still code in assembly language? I doubt it's useful as a thought experiment.

    You understand how higher level concepts are good for application development, so I won't go over that (bc 1k char limit).

    In ML/AI research, I'd have assumed the important thing would have been the correctness of the maths/algo, rather than how fast an implementation of it runs. Hence why I'd assume they'd use HLLs like Matlab, R, etc, they'd take less effort than C++.

    In research the correctness of your theory would be more important than making your implementation of the theory run 50% faster. If you find some legit breakthrough, the C++ guys in industry will make a fast library for it for the C#/Java guys to use.

    As a researcher you have a finite lifespan, it would likely be better spent doing research and testing theories, than C/C++ coding.
  • 1
    I'm lost some where in this post. Could you help find myself? I'm just between receipt for coffee and "question". GL
  • 1
    @SuyashD95 Summary bc 1k char limit:

    C: Good for device drivers, kernels, binary APIs, embedded programming, or performance related stuff. Low level stuff. C is a "portable assembly language".

    C++: NOT good for dev drivers, kernels, or bin. APIs (anyone remember COM?), unless you limit yourself to such a tight subset of C++ that you're basically back to using C. Good for performance stuff. Had relevance for higher level application dev, but is getting squeezed out of it by Java, C#, etc.

    I do not know what's being used in ML/AI, but I would guess that there are more domain specific languages there that would be more productive.

    I'd say C/C++ would be useful for ML/AI research if performance was a concern, but as mentioned before I am not sure how important perf. is there. That's probably the point where you should draw the line with C++: performance. C++ contains many features and there is a lot of it to learn. Almost all C++ projects don't use all the features of C++.
  • 1
    @Ferror Just keep pressing the "back" button :D
  • 1
    @QoolQuy2000 Thanks for your quick response... I guess, your arguments make sense and are pretty convincing...

    So, I was never really concerned with execution speed to begin with.. I was more concerned with the fact that whether giving more access to memory or low-level resources is beneficial for any other purpose, apart from cases like kernels, drivers, compilers, etc....

    Since, I have been hearing a lot of things about languages like Haskell or Scala...

    So, my prime query was instead of spending time with C++, should I spend more time getting acquainted with these languages...

    And, if not, then, what are the advantages of sticking with C/C++....

    And, here, I am not talking from end product's perspective, but from the logical impact of the language...

    To be more precise, will it help in identifying patterns better or devising more algorithmcally precise solutions or something similar...

    I hope that now, you could understand the crux of my rant...
  • 2
    I really (really) hate c++, but i have to admit, learning it is never a waste
  • 1
    @SuyashD95 I've certainly heard of Haskell and Scala being mentioned often in the context of ML/AI. It would likely be unwise to overlook those languages. Remember I'm not a ML/AI guy tho, just saying what I've heard about it. It's a shame there doesn't appear to be anyone in this thread involved with ML/AI, they could have contributed their direct experience. I can only speak in general terms somewhat.

    The good thing about C/C++ is their closeness to the hw. Great if you want to know exact memory layouts, where things are and what is being done to them etc. That's one of the reasons why C is useful for dev drivers and kernels. But that can also be a burden when you don't need it.

    I don't think C/C++ on their own are going to be that useful for ML/AI. They don't sound like they would be the catalysts of any ML/AI discoveries.

    It's 23:30 here in the UK, this is probably my last post tonight!
  • 1
    It really depends on country and what industry you are having. Ml/Ai are more algorithmic and thinking problems rather than coding. I saw lots of Ml/Ai done in python(etc char limit). The faster coding the better...

    If you are a country where hw is developed c/c++ are really important for it but for high end solutions java is generally prefered.

    C/C++ needs a certain behaviour in coding which myself cannot bring to it. I like stuff outside the box and libraries and in general c/c++ are searched for the idea to make something that isn't there already.

    So its really comes down to how good you are and how much you want to invest in yourself, at the end of the day it doesn't matter the tool but the one who use it.
  • 1
    @QoolQuy2000 Thank you so much for being part of this rant... And, having such a meaningful and thought provoking conversation with me...

    This was exactly what I wished for, when I posted my rant...

    And, I live in India... I started this rant before having my dinner but right now, it is nearly 5'o clock in the morning... Yet, I don't feel like this was a waste..

    This is the reason I joined this community because I am glad that I was proved right...

    So, once again, a HUGE THANKS and Good Night... You truly deserve it, mate...
  • 0
    @RazorSh4rk Sorry for not responding sooner... But, I guess, I was busy being engaged in another engrossing conversation...

    I did read your earlier answers... And, I agree with you that Java does provide a better native support to stuff like GUI, Db connectivity, server support, etc...

    Actually, I mainly shifted to Java to use these features.. And, then, jumped to Android development...

    But, like I said earlier, the libraries are the reason which makes Java or for that matter, any language more potent and useful...

    And, I discovered Java lacking when it came to implementing advanced Data Structures or algorithms (1)...

    And, I know that it is possible but I found the implementation to be difficult and unintuitive due to their dependency on existing libraries and methods...

    But, since you use it for algorithm optimisation, can I request you to tell me topics or places which I should explore to achieve better results for the above mentioned problem (1) using Java...
Add Comment