Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. The Master, The Expert, The Programmer

The Master, The Expert, The Programmer

Scheduled Pinned Locked Moved The Lounge
9 Posts 8 Posters 3.0k Views
  • 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.
  • J Offline
    J Offline
    john_god
    wrote on last edited by
    #1

    I find this article very good, sharing it

    "http://zedshaw.com/essays/master_and_expert.html":http://zedshaw.com/essays/master_and_expert.html

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      Thanks for your post, this is interesting.I am a novice programmer
      and pretty hate one of the situation mention by this post

      making sure EVERY SINGLE CLASS HAS AN INTERFACE, and ending every class with “Impl”

      I don't understand why there are so many people like to use
      inheritance even they don't really need it, they just try to make
      their codes become harder to maintain and induce unnecessary
      burden to the machine.The weirdest thing is, many people
      know nothing but OO, OO is like "god" to them, start with OO,
      end with OO, everything should be OO. You should inherit it
      anyway else it is not a good OO design

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ryadav
        wrote on last edited by
        #3

        I too am a lazy coder, I hate mental juggling, I follow the KISS princile, and I've seen my share of master coders over engineering things...and the pimpl pattern just gets me vexed!!!

        Kind Regards,
        Rajinder Yadav

        SafetyNet Test Driven Development
        http://safetynet.devmentor.org

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          The key is knowing when to use each design pattern. Obviously, giving EVERY class an interface is an overkill, and using the PIMPL pattern in small apps is silly.

          OO isn't just about inheritance, it is also about encapsulation and structuring your project to make it MUCH easier to maintain.

          The PIMPL pattern is great for libraries (like Qt). Why? Imagine this scenario: You develop a large Qt app that is very popular. However, it is a bit slow, because there was inefficient code in Qt. One day, someone improves the inefficient code by massively changing the internal code structure. Your users would love the performance boost! Now, how do you get this improvement out to your users?

          If Qt had not used the PIMPL pattern, you would probably need to recompile your WHOLE app -- even if your code hasn't changed at all -- and then get your users to download the new app AND the new Qt libraries. However, since Qt uses PIMPL, you don't have to do that; just distribute the new Qt libraries, and run your old app as usual. No recompilation required!

          That was only a small, simple example. You can read about why Qt uses PIMPL here: http://qt-project.org/wiki/Dpointer

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • B Offline
            B Offline
            broadpeak
            wrote on last edited by
            #5

            Bruce Eckel - Thinking in C++ book:
            "Evolution of C++ programmers
            C programmers seem to acquire C++ in three steps. First, as simply a “better
            C,” because C++ forces you to declare all functions before using them and is
            much pickier about how variables are used. You can often find the errors in a C
            program simply by compiling it with a C++ compiler.
            The second step is “object-based” C++. This means that you easily see the
            code organization benefits of grouping a data structure together with the
            functions that act upon it, the value of constructors and destructors, and
            perhaps some simple inheritance. Most programmers who have been working
            with C for a while quickly see the usefulness of this because, whenever they
            create a library, this is exactly what they try to do. With C++, you have the aid
            of the compiler.
            You can get stuck at the object-based level because you can quickly get there
            and you get a lot of benefit without much mental effort. It’s also easy to feel
            like you’re creating data types – you make classes and objects, you send
            messages to those objects, and everything is nice and neat.
            But don’t be fooled. If you stop here, you’re missing out on the greatest part of
            the language, which is the jump to true object-oriented programming. You can
            do this only with virtual functions.
            Virtual functions enhance the concept of type instead of just encapsulating
            code inside structures and behind walls, so they are without a doubt the most
            difficult concept for the new C++ programmer to fathom. However, they’re
            also the turning point in the understanding of object-oriented programming. If
            you don’t use virtual functions, you don’t understand OOP yet."

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stereomatching
              wrote on last edited by
              #6

              bq. If you don’t use virtual functions, you don’t understand OOP yet

              These are right if programmers do not overuse virtual and inheritance.
              Exceptional C++, items 20~25 give a very good explanation
              on OOP.

              bq. You can get stuck at the object-based level because you can quickly get there
              and you get a lot of benefit without much mental effort

              Looks like my experiences is a little bit different than yours?
              I used to like to design a virtual base class for different
              projects, but now I would not do that atleast I find out I really
              need virtual.Maybe someday I would like to design my programs
              as pure OO again, but not now.

              Besides, don't forget other abstraction powers offer by C++.
              C++ support many paradigms, not only OO, there are generic
              programming, functioanl programming(not as easy to use as haskell),
              procedural programming and metaprogramming(like functional
              programming, but much more harder to codes than haskell, and do not
              support runtime polymorphism, yet it is very a very powerful compile time tool).

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goblincoding
                wrote on last edited by
                #7

                [quote author="john_god" date="1354801536"]I find this article very good, sharing it

                "http://zedshaw.com/essays/master_and_expert.html":http://zedshaw.com/essays/master_and_expert.html[/quote]

                Brilliant read, thanks for sharing :)

                http://www.goblincoding.com

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  utcenter
                  wrote on last edited by
                  #8

                  OOP is being over-advertised, but it has its own drawbacks, virtual methods cannot be inlined and may end up costing significant performance. Object orientation is not always best suited for being cache friendly, and simple approaches to implement better data orientation can provide substantial performance increase by reducing cache misses and cache pollution.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SaraJampen
                    Banned
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved