Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Why I like C++

Why I like C++

Scheduled Pinned Locked Moved The Lounge
csharpc++comquestion
55 Posts 23 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M MetalNate

    I have never been involved in writing kernel-level software, software for microcontrollers, or game development, so I think I just never got to harness full power of C/C++ in it's natural sphere of application. My only encounter with C++ apart from university was with "full blown enterprise application with rich UI" (although it did use some 3D data visualization), and I guess this took it's part in forming my bias against it :-D

    F Offline
    F Offline
    Fabio Franco
    wrote on last edited by
    #30

    MetalNate wrote:

    I have never been involved in writing kernel-level software, software for microcontrollers, or game development

    It's a shame, but I think you should give it a try, it's a lot of fun. Personally I'd recommend playing with an arduino device just for the fun of it.

    To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

    1 Reply Last reply
    0
    • S shiprat

      C++ is just a language lol, that's funny, I though it was THE language. what is .NET written in btw?

      R Offline
      R Offline
      richinsea
      wrote on last edited by
      #31

      No. PL/I is the language. Look how far it got.

      1 Reply Last reply
      0
      • F Fabio Franco

        MetalNate wrote:

        Moving from .NET to C++ feels like moving from comfortable city apartment with electric lights, hot water and other conveniences along with modern city infrastructure to stone cave in a middle of wilderness with only wooden stick in hands

        I loved your analogy, it cracked me up :laugh: But I think you may be missing one point. You don't need to move away from .net to use C++. It's just another tool to be used for another job. A lot of you want to do can be accomplished by both, but many tasks are better accomplished with one tool rather than the other. For example, you can't go to managed language if you're designing a kernel-mode driver. Or you can use an unmanaged component for your managed framework to perform performance dependent task. Say you're developing a real time image processing application. Chances are that you'd be better off with C++ (not saying it's the only option). One thing that I love about C++ is how it integrates easily with native hardware instructions, you can even have pure assembly instructions inside a C++ code block :rolleyes: It's so amazing that it's quite rewarding when you see blinking hardware lights just the way you programmed it to. It's a very satisfying experience. I had the opportunity to interface with hardware through C# and .net, but it is not the same thing and you can only go so far. Of course, using C++ to develop a full blown enterprise application with rich UI can be really, really painful. That's why you should always choose the right tool for the job. And I just love when the right tool for the job is C++ :)

        To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

        R Offline
        R Offline
        richinsea
        wrote on last edited by
        #32

        I cant see where he said that so I will reply here. Shouldn't that be two sticks? It is not intended as a serious comment.

        1 Reply Last reply
        0
        • M Martin Cheng

          Oh, It's unbelievable that there are responses for my questions! Thanks for the suggestions, really! Actually, I have got the concepts things about C++, like objects, hierarchies things. I guess I am lack of some projects experiences. Even I got the concepts about it, I have no idea how to use them in programming. It might be the more practices make it perfect. I have to spend much time on it and use C++ times and times. Anyway, thanks a lot! Buy the way, I red effective C++ recently. It talks about STL and boost things. I almost program with BOOST and STL library every day. They are important for the C++, aren't they ?

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #33

          Martin.Cheng wrote:

          Actually, I have got the concepts things about C++, like objects, hierarchies things...Even I got the concepts about it, I have no idea how to use them in programming.

          Well then you don't actually understand the concepts. As I recall it took me about 2 years to figure out how to apply objects to designs in C++ after I figured out the syntax of classes in C++. Before that I was still doing structured programming rather than object oriented programming even though I was using C++ (and classes.)

          M 1 Reply Last reply
          0
          • M Martin Cheng

            Oh, It's unbelievable that there are responses for my questions! Thanks for the suggestions, really! Actually, I have got the concepts things about C++, like objects, hierarchies things. I guess I am lack of some projects experiences. Even I got the concepts about it, I have no idea how to use them in programming. It might be the more practices make it perfect. I have to spend much time on it and use C++ times and times. Anyway, thanks a lot! Buy the way, I red effective C++ recently. It talks about STL and boost things. I almost program with BOOST and STL library every day. They are important for the C++, aren't they ?

            F Offline
            F Offline
            Fabio Franco
            wrote on last edited by
            #34

            I have a couple of suggestions based on my experiences. Although you may think you got everything, it's more likely that you don't. Practice says more than theory. I remember myself that one day it hit me: "AHA!!!". It was like that, from one day to the other everything made sense. The problem is that it's very difficult to get to the "AHA!!!" moment, but I do know that the fastest way to get there is by having real world experiences. I don't think you should learn object oriented design through C++ as many of its little nuances can get in the way of learning the real deal which is object oriented design. I'd say to go with C# first if you want to learn OO design. Now, there are a few steps I'd suggest you to take: 1 - Read open source code of well designed OO applications. If you look around it shouldn't be hard to find. 2 - Design a real OO application, with its own domain model layer, with all objects that contain both data and behavior, completely separated from user interface or data access layer. You can get a lot of ideas from open source projects and design pattern books. Try creating an application for someone you know that run a small business, for free, as an experimental project. 3 - Publish the code so people can give you their opinion and point out where you went wrong and where you did right. Here is where the real learning will occur. 4 - Port your application to C++ Just an idea of what I believe is a good way to learn OO C++

            To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

            M 1 Reply Last reply
            0
            • S SeattleC

              paul_71 wrote:

              you can't just "turn away from .NET to C++".

              I disagree. To a significant extent, the world may be divided into projects that choose to live within a humongous infrastructure such as .NET, and projects that stand alone, importing smaller bits of third-party code when they seem relevant. .NET is very much a lifestyle choice. Many C++ projects exist because they have chosen to steer clear. .NET is 10,000 twisty little objects, all alike, and yet all different. Not all parts of .NET are equally well designed, and none of it is brilliant. It's a big infrastructure built by a big team in a big hurry. C++ is around 50 keywords, and a standard library with around 50 template classes. You can get to know all of it. All of C++ compiles to machine code. You can reason about the performance of every bit. The STL is genius, now copied by other popular languages. The people who don't like C++ because it doesn't come with a standard library having 10,000 functions don't get C++ at a fundamental level. C++ is useful because of the extent to which it is stripped down to essentials. You can't write a web browser in 10 lines of C++ code by invoking the WebBrowser object like you can do in .NET. C++ is for the guys who want to implement that WebBrowser object, and who need for it to run at a competitive speed.

              S Offline
              S Offline
              shiprat
              wrote on last edited by
              #35

              actually coding in .NET (or Java or PHP or bash or whatever..) feels a lot like any other of the occasional obligations I have as a C++ programmer to delve into the idiosyncrasies of the diverse 'ecosystem' I work in, which might include a million other 'packages' that exist, like UTF-8, SMB, TCP/IP, RS232, USB, HTML, JavaScript, GWT, SQL, lambda calculus, the visitor pattern or a Logo tortoise. but at the core of this ecosystem is the project itself with resources, objectives and requirements that (for usually good reasons) exclude the use of Java or PHP or bash or (in extreme cases) computer science itself and mandate coding in C or C++. all there is (apart from silicon, wire and electrons) is a compiler. and where did the compiler come from? somebody ported it using C or C++ and a bit of assembler. at the end of the day, I find the real challenge comes when I have to 'turn away from' C++ and use C, or 'turn away from' from boost and use STL, or 'turn away from' templates and use macros or 'turn away from' OpenGL and use DirectX or 'turn away from' BSD and use GPL. turning away from .NET feels like ignoring the existence of a cow in a paddock down the road. it's there. it might provide me with milk or butter one day, but I don't really need it unless I need it. it goes moo.

              1 Reply Last reply
              0
              • M Martin Cheng

                Oh, It's unbelievable that there are responses for my questions! Thanks for the suggestions, really! Actually, I have got the concepts things about C++, like objects, hierarchies things. I guess I am lack of some projects experiences. Even I got the concepts about it, I have no idea how to use them in programming. It might be the more practices make it perfect. I have to spend much time on it and use C++ times and times. Anyway, thanks a lot! Buy the way, I red effective C++ recently. It talks about STL and boost things. I almost program with BOOST and STL library every day. They are important for the C++, aren't they ?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #36

                Don't worry. It's really a lot of things you get to hear about and it all must be very confusing. That's why I told you to start with understanding the intentions behind object orientation. The problem with all books, design patterns or libraries is, that they all solve problems you have not encountered yet. You can believe them or not, but simply using them as you are told will not help you understand more. Start writing a small C++ program and try to do it with as little help as possible. Try to rely on what you have learned so far and do things as you think they should be. To be honest, you will probably run into problems every step on the way and your solutions may not be the best. Yet. The good thing is, that each problem will be an opportunity to gain some experience by solving it yourself. At first this may be very frustrating, unless you keep in mind that this is just an excercise. Be proud of every victory, as small as they may be in the beginning, They will lead you to the things you must think about next and after a while books will become helpful again. Once you have understood a problem, you also have a chance to understand a solution.

                M 1 Reply Last reply
                0
                • L Lost User

                  I have been turning away from .Net lately and looking for alternatives. I don't want to have to rewrite everything when a certain company heads into a different direction once more. My answer is C++. I always liked its flexibility to allow you to do very low level programming just as well as very high level programming. And today I stumbled over this video[^], in which Bjarne Stroustrup answers two simple questions. Now I know why I like C++ so much. Thanks, Bjarne.

                  J Offline
                  J Offline
                  Jonas Hammarberg
                  wrote on last edited by
                  #37

                  I like C++ as it let's me do my job without getting in the way, either trying to help me or, heaven forbide, try to protect me.

                  1 Reply Last reply
                  0
                  • S SeattleC

                    Martin.Cheng wrote:

                    Actually, I have got the concepts things about C++, like objects, hierarchies things. I guess I am lack of some projects experiences. Even I got the concepts about it, I have no idea how to use them in programming. It might be the more practices make it perfect.

                    You have sensed the trouble; lack of experience. If you cannot apply concepts like object orientation, you don't really understand them yet. You should therefore stop saying, "I get the concepts." You should ask questions like, "How do I learn to view a project as a collection of objects?" or "How do I decide which operations are closely enough related to put into a single object?" For the first question, I personally very much like the work of Rebecca Wirfs-Brock (search "Wirfs-Brock" on amazon) on class roles and collaborations. I used Designing Object Oriented Software to teach a team of C developers OOP, but I suspect the more recent titles are also good. For the second question, much as been written on the web on "separation of concerns" and "dependency injection". But as a practical matter of learning, you should start writing module tests for each class you write. Nothing slims down your classes like having to test all the interfaces and import all the dependencies into each test case.

                    M Offline
                    M Offline
                    Martin Cheng
                    wrote on last edited by
                    #38

                    Thanks again. It 's quite boring reading book without implement project, isn't ? :sigh: It was supposed to be a tool or a manual when I got some problem. I will follow your suggestion anyway, spending much time to read the book and practicing more~

                    S 1 Reply Last reply
                    0
                    • M Martin Cheng

                      Thanks again. It 's quite boring reading book without implement project, isn't ? :sigh: It was supposed to be a tool or a manual when I got some problem. I will follow your suggestion anyway, spending much time to read the book and practicing more~

                      S Offline
                      S Offline
                      SeattleC
                      wrote on last edited by
                      #39

                      Martin.Cheng wrote:

                      It 's quite boring reading book without implement project

                      This is always the problem for learning. If you are lucky, some employer will let you learn on their time. Otherwise, there's nothing to do but try to think of some sufficiently interesting thing to code on your own time. Best of luck.

                      M 1 Reply Last reply
                      0
                      • J jschell

                        Martin.Cheng wrote:

                        Actually, I have got the concepts things about C++, like objects, hierarchies things...Even I got the concepts about it, I have no idea how to use them in programming.

                        Well then you don't actually understand the concepts. As I recall it took me about 2 years to figure out how to apply objects to designs in C++ after I figured out the syntax of classes in C++. Before that I was still doing structured programming rather than object oriented programming even though I was using C++ (and classes.)

                        M Offline
                        M Offline
                        Martin Cheng
                        wrote on last edited by
                        #40

                        I had been there months before. I use C++ as C, hah~ It's quite wired. So I have this kinda confusion and post here for suggestions. ;P

                        1 Reply Last reply
                        0
                        • M Martin Cheng

                          Oh, It's unbelievable that there are responses for my questions! Thanks for the suggestions, really! Actually, I have got the concepts things about C++, like objects, hierarchies things. I guess I am lack of some projects experiences. Even I got the concepts about it, I have no idea how to use them in programming. It might be the more practices make it perfect. I have to spend much time on it and use C++ times and times. Anyway, thanks a lot! Buy the way, I red effective C++ recently. It talks about STL and boost things. I almost program with BOOST and STL library every day. They are important for the C++, aren't they ?

                          M Offline
                          M Offline
                          Member 4608898
                          wrote on last edited by
                          #41

                          Boost and STL are great until you try to see what is inside the structures when the program crashes. Some debuggers are intelligent enough to be able to print the contents of collections. In many of them, it is just an undecipherable structure so you have to pick through the STL/Boost bit to see how it was implemented and then work out how to check the values in the debugger. Picking through template libraries can be really painful: why do the writers insist on using one or two letter variables with leading underscores? Were these written by two finger typists?

                          M 1 Reply Last reply
                          0
                          • S SeattleC

                            Martin.Cheng wrote:

                            It 's quite boring reading book without implement project

                            This is always the problem for learning. If you are lucky, some employer will let you learn on their time. Otherwise, there's nothing to do but try to think of some sufficiently interesting thing to code on your own time. Best of luck.

                            M Offline
                            M Offline
                            Martin Cheng
                            wrote on last edited by
                            #42

                            I am supposed to be the lucky one and the project are not that emergency that I can spend more time on studying. Anyway, nobody want to wast time on the wrong direction, is that right?

                            1 Reply Last reply
                            0
                            • M Member 4608898

                              Boost and STL are great until you try to see what is inside the structures when the program crashes. Some debuggers are intelligent enough to be able to print the contents of collections. In many of them, it is just an undecipherable structure so you have to pick through the STL/Boost bit to see how it was implemented and then work out how to check the values in the debugger. Picking through template libraries can be really painful: why do the writers insist on using one or two letter variables with leading underscores? Were these written by two finger typists?

                              M Offline
                              M Offline
                              Martin Cheng
                              wrote on last edited by
                              #43

                              hah~ It's really vivid to represent the problem, funny you! Whatever, Thanks for your tips.

                              1 Reply Last reply
                              0
                              • L Lost User

                                I just deleted a very long response. Simple answer: Really, can't I? Why should I allow Mickeysoft (or anybody else) to lock me into their walled gardens? Why should I pay for the OS, the development environment and a modest 30% developer tax on top of that for the honor of being allowed to publish my work? Why should I work more to keep my code current than to expand it? And what makes you think that there are no alternatives? No, this time Mickeysoft has jumped the shark and nuked the fridge, all at the same time. I will rewrite my code only once more. To make certain that they can't do that to me again, no matter what crazy ideas they have next. Perhaps then I will see the day when a code module is actually reused instead of rewritten.

                                P Offline
                                P Offline
                                Paul Michalik
                                wrote on last edited by
                                #44

                                I reply to your message, although the answer applies to all comments. No, you can't. "C++" and ".NET Framework" are just not compatible terms to compare, therefore you can't "switch" from one to another. .NET Framework is an implementation of a specification which defines an Application Development Framework plus the humongous infrastructure which enables to run the framework itself plus applications written against it. C++ is a language specification consisting of 1250 pages of text (*) at least my copy does. Its up to vendors to implement this specification but here the parallels are over. I'd understand if somebody wrote "I am switching from .NET to Java" (which happens to be both language and AVR), or, to certain extent, "I am switching to native C++ development based on Qt". But in these cases, you are putting yourself in the similar position as before - you get dependent on somebody (**). Of course, you can write software based solely on C++ specification, but this is not really comparable to application development based on a infrastructure of the .NET Framework kind, not even comparable to writing software against an native C++ application development framework like Qt etc. (*) ...written by masochists (**) The "open source" arguments also apply to .NET specification for which an oss implementation exists

                                1 Reply Last reply
                                0
                                • F Fabio Franco

                                  I have a couple of suggestions based on my experiences. Although you may think you got everything, it's more likely that you don't. Practice says more than theory. I remember myself that one day it hit me: "AHA!!!". It was like that, from one day to the other everything made sense. The problem is that it's very difficult to get to the "AHA!!!" moment, but I do know that the fastest way to get there is by having real world experiences. I don't think you should learn object oriented design through C++ as many of its little nuances can get in the way of learning the real deal which is object oriented design. I'd say to go with C# first if you want to learn OO design. Now, there are a few steps I'd suggest you to take: 1 - Read open source code of well designed OO applications. If you look around it shouldn't be hard to find. 2 - Design a real OO application, with its own domain model layer, with all objects that contain both data and behavior, completely separated from user interface or data access layer. You can get a lot of ideas from open source projects and design pattern books. Try creating an application for someone you know that run a small business, for free, as an experimental project. 3 - Publish the code so people can give you their opinion and point out where you went wrong and where you did right. Here is where the real learning will occur. 4 - Port your application to C++ Just an idea of what I believe is a good way to learn OO C++

                                  To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                  M Offline
                                  M Offline
                                  Martin Cheng
                                  wrote on last edited by
                                  #45

                                  Oh~It's amazing that so much experiences and thanks for sharing. As you said, it 's the directly way reading some open source code instead of book, I will have a try to find some in communities. It's sure thing that I will avoid the open source code without documents, it 's really nightmare, isn't it ? :-D For the 2nd tip, it 's out of my range, It might I am from a China... I have never thought about run a business, even it 's for free. But you are right. I must have a try. I will publish the code if everything is fine which I make a real project. Anyway, thanks! sincerely !

                                  F 2 Replies Last reply
                                  0
                                  • M Martin Cheng

                                    Oh~It's amazing that so much experiences and thanks for sharing. As you said, it 's the directly way reading some open source code instead of book, I will have a try to find some in communities. It's sure thing that I will avoid the open source code without documents, it 's really nightmare, isn't it ? :-D For the 2nd tip, it 's out of my range, It might I am from a China... I have never thought about run a business, even it 's for free. But you are right. I must have a try. I will publish the code if everything is fine which I make a real project. Anyway, thanks! sincerely !

                                    F Offline
                                    F Offline
                                    Fabio Franco
                                    wrote on last edited by
                                    #46

                                    You're welcome Martin. About the second point, I didn't actually meant that you should run a business, but develop and application help running a small business of someone you know

                                    To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                    M 1 Reply Last reply
                                    0
                                    • M Martin Cheng

                                      Oh~It's amazing that so much experiences and thanks for sharing. As you said, it 's the directly way reading some open source code instead of book, I will have a try to find some in communities. It's sure thing that I will avoid the open source code without documents, it 's really nightmare, isn't it ? :-D For the 2nd tip, it 's out of my range, It might I am from a China... I have never thought about run a business, even it 's for free. But you are right. I must have a try. I will publish the code if everything is fine which I make a real project. Anyway, thanks! sincerely !

                                      F Offline
                                      F Offline
                                      Fabio Franco
                                      wrote on last edited by
                                      #47

                                      You're welcome Martin. About the second point, I didn't actually meant that you should run a business, but develop and application help running a small business of someone you know

                                      To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                      1 Reply Last reply
                                      0
                                      • L Lost User

                                        Don't worry. It's really a lot of things you get to hear about and it all must be very confusing. That's why I told you to start with understanding the intentions behind object orientation. The problem with all books, design patterns or libraries is, that they all solve problems you have not encountered yet. You can believe them or not, but simply using them as you are told will not help you understand more. Start writing a small C++ program and try to do it with as little help as possible. Try to rely on what you have learned so far and do things as you think they should be. To be honest, you will probably run into problems every step on the way and your solutions may not be the best. Yet. The good thing is, that each problem will be an opportunity to gain some experience by solving it yourself. At first this may be very frustrating, unless you keep in mind that this is just an excercise. Be proud of every victory, as small as they may be in the beginning, They will lead you to the things you must think about next and after a while books will become helpful again. Once you have understood a problem, you also have a chance to understand a solution.

                                        M Offline
                                        M Offline
                                        Martin Cheng
                                        wrote on last edited by
                                        #48

                                        Thank you for that! sincerely. You are 100% right about the intentions things. I should not study C++ for studying instead of real problem. Actually I encounter problems every day and I do my best to solve them. Even there are some problems I meet everyday but they are changed everyday, they are different. It means that my capacities get higher and higher day by day. It really make sense.

                                        1 Reply Last reply
                                        0
                                        • F Fabio Franco

                                          You're welcome Martin. About the second point, I didn't actually meant that you should run a business, but develop and application help running a small business of someone you know

                                          To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                          M Offline
                                          M Offline
                                          Martin Cheng
                                          wrote on last edited by
                                          #49

                                          I got the point.Thanks! The business can be various, right ? You mean the real requirement is much better.

                                          F 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups