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. Do you really use C++?

Do you really use C++?

Scheduled Pinned Locked Moved The Lounge
oopc++hardwarehelpquestion
23 Posts 16 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.
  • L Lost User

    A good OO design can give you maintainability and expandability. If your project requires this, you can (and should) do it. So close to the hardware there is also another aspect: Performance. We are not always in the land of the plenty and sometimes you have to take whatever the processor has to offer. You have to cut some corners and write some 'clever' code to get this performance. This code will be less maintainable and harder to understand. Again, you can do it, but better encapsulate the 'ugly' code in some object and place lots of comments why this had to be done that way. P.S.: I usually can't wait until the CodeNazis (TM) descend on such code to 'review' it, turn purple and fall off their chairs. They will never unerstand that there is more than one sort of code and that they certainly are not its prophet. :-)

    The language is JavaScript. that of Mordor, which I will not utter here
    This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
    "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

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

    +1 for the CodeNazis (I love Grand Theoretical Programmers [who often change their job title to 'architect' without asking and without understanding what that actually means], usually fresh out of uni, in their first job with no experience delivering projects to customers) :laugh: "Martin Fowler wouldn't write it like this!" they say. "He ain't *!&"ing here!" says I ;P

    I came into this game for the action, the excitement. Go anywhere, travel light, get in, get out, wherever there's trouble, a man alone. Now they got the whole country sectioned off, you can't make a move without a form.

    G 1 Reply Last reply
    0
    • C charlieg

      And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

      Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

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

      Yes, I do.

      1 Reply Last reply
      0
      • C charlieg

        And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

        Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

        C Offline
        C Offline
        charlieg
        wrote on last edited by
        #14

        All good comments. In my rant area, we don't have performance issues. When talking to "the machine" (I like that term), some data items HAVE to be coordinated. Rather than putting it in a class, I have it in multiple places. So, I have bugs in multiple places. I also DESPISE globals. Sure, like goto's, sometimes they just work. And this code is coming from people who ought to know better. Well, you've cheered me up. At least some consider these things as useful. :)

        Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

        1 Reply Last reply
        0
        • C charlieg

          And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

          Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #15

          I try not to. I've dabbled a little. I've done a lot of C, and what I don't like about C# is that everything must be in a class. (And yet no multi-inheritence. :mad: ) I prefer to use the right tool for the right job. And please stop referring to VS as a compiler.

          1 Reply Last reply
          0
          • C charlieg

            And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

            Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

            G Offline
            G Offline
            Gary Wheeler
            wrote on last edited by
            #16

            charlieg wrote:

            I live in the embedded world where our code has to adapt to the reality of real life.

            Ironically, that view is one that prevents deep adoption of C++ in the embedded world. There's a widespread perception that C++ includes a lot of overhead that embedded applications can't support. The perception is mistaken. Any loss in performance due to C++ constructs (virtual function calls come to mind) is more than made up by improved engineering. If it's really that much of an issue, C++ can always be treated as "a better 'C'". For that matter, performance requirements that stringent call for custom hardware anyway. I'm dealing with this myself at the moment. A few months ago I inherited one of our long-term products, which is written in 'C'. The code is over 25 years old. It started life running on two single-board embedded computers, and now runs as a service on a Windows box. It's awful. Globals everywhere. Code reaches up the skirt of data structures without regard to access safety. Hell, it doesn't even follow good structured programming practices half the time. My intent with this crap is to answer questions if necessary. I ain't touching the code with my ten foot pole or anyone else's.

            Software Zen: delete this;

            1 Reply Last reply
            0
            • L Lost User

              +1 for the CodeNazis (I love Grand Theoretical Programmers [who often change their job title to 'architect' without asking and without understanding what that actually means], usually fresh out of uni, in their first job with no experience delivering projects to customers) :laugh: "Martin Fowler wouldn't write it like this!" they say. "He ain't *!&"ing here!" says I ;P

              I came into this game for the action, the excitement. Go anywhere, travel light, get in, get out, wherever there's trouble, a man alone. Now they got the whole country sectioned off, you can't make a move without a form.

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #17

              Brent Jenkins wrote:

              "Martin Fowler wouldn't write it like this!" they say. "He ain't *!&"ing here!" says I

              Awesome. He and Grady Booch are going to be the first against the wall when the revolution comes. Oh wait. I forgot about the Lotus Notes development team. And the entire staff from InstallShield. And the device driver group at Microsoft...

              Software Zen: delete this;

              L 1 Reply Last reply
              0
              • C charlieg

                And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

                Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                M Offline
                M Offline
                MikeTheFid
                wrote on last edited by
                #18

                Well, I personally think we always do an OO implementation even when we aren't using an OO language. It just turns out soooooo much messier and hard to maintain if the language lets you shoot from the hip too much. :)

                Cheers, Mike Fidler "I intend to live forever - so far, so good." Steven Wright "I almost had a psychic girlfriend but she left me before we met." Also Steven Wright "I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.

                1 Reply Last reply
                0
                • G Gary Wheeler

                  Brent Jenkins wrote:

                  "Martin Fowler wouldn't write it like this!" they say. "He ain't *!&"ing here!" says I

                  Awesome. He and Grady Booch are going to be the first against the wall when the revolution comes. Oh wait. I forgot about the Lotus Notes development team. And the entire staff from InstallShield. And the device driver group at Microsoft...

                  Software Zen: delete this;

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

                  To be fair, I'll bet most of what I'm told Martin Fowler would or wouldn't do is made up 2 seconds before I'm spoken to. He'd probably be pretty surprised by some of the code I've had to work on. I worked on a solution containing 159 projects a few years ago. All it did was show a login screen which didn't work properly. Domain driven design to the nth-level of abstraction and plenty of unit tests though, which is all your end customers really care about (although they might not know it themselves) :laugh:

                  I came into this game for the action, the excitement. Go anywhere, travel light, get in, get out, wherever there's trouble, a man alone. Now they got the whole country sectioned off, you can't make a move without a form.

                  1 Reply Last reply
                  0
                  • C charlieg

                    And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

                    Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                    S Offline
                    S Offline
                    Stuart Dootson
                    wrote on last edited by
                    #20

                    I totally agree that abstraction and encapsulation are vital - but... there are more ways to skin a cat than just putting it into a class :-) Structs and functions, classes or whatever you want to use, are all just implementation details - appropriately splitting your application into cohesive parts with low coupling is what matters.

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    1 Reply Last reply
                    0
                    • C charlieg

                      And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

                      Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                      P Offline
                      P Offline
                      pschaeffer
                      wrote on last edited by
                      #21

                      “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                      The liberty that Franklin was referring to was the right of the legislature to impose war taxes. To Franklin, imposing war taxes was an "essential liberty". Read Against a Crude Balance: Platform Security and the Hostile Symbiosis Between Liberty and Security | Brookings Institution[^] to understand what Franklin actually meant. A clue. He was opposed to what people call "liberty" today.

                      1 Reply Last reply
                      0
                      • C charlieg

                        And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

                        Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                        A Offline
                        A Offline
                        AnotherKen
                        wrote on last edited by
                        #22

                        C++ was used to teach Object Oriented programming in a University Class I took in Computer Science back in the late 80's. I found it was easy enough to pick up if well presented. I was able to get things to work and that is a big plus. Modern tools are even better than the ones I used then. It also offers Multiple Inheritance which is also a major concept of OO, but also quite a complication if combined with Polymorphism at the same time. If you want an easier language to learn, then I would suggest C# since you can get a good free IDE from Microsoft for that.

                        1 Reply Last reply
                        0
                        • C charlieg

                          And by that, I mean OO principles? Encapsulation, etc. I'm not worried at all about inheritance, and polymorphism is helpful at times. But abstraction and encapsulation seem so powerful to me. OO programming (language does not apply) lends itself to interfaces, discipline, self preservation. For those of you who sit down in front of VS2xxx or any other OO oriented compiler, do you ask yourself, "Can I put this in a class?" After writing thousands of lines of code, does a bell ever ring, "If you keep digging, the hole is only going to get deeper?" I live in the embedded world where our code has to adapt to the reality of real life. A machine has inertia and a large number of other physical properties. Sometimes the interactions BEG to be encapsulated in a class where the domain knowledge and behavior can be kept in one location.

                          Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                          D Offline
                          D Offline
                          DeerBear
                          wrote on last edited by
                          #23

                          Classes do not exist. Good design does.

                          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