Thread: Is C++ getting too complex for today's technology?

  1. #46
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    I don't quite follow what you are saying. The syntax dictates how we express teh concepts of the language? Right, and the point of the language is to be able to express concepts, so why is syntax not so important? If we can express the same concepts in every language then why do we bother to use any language over assembly? As Paul Graham article suggests, isn't it because the other languages provide for succinct ways to express the same concepts because of the different syntax and this is more powerful?
    What you are trying to say seems unclear to me. It seems as though you are suggesting the syntax is not very important but then saying it is because we can express things more easily in C over ASM which is why we use C. Is this what you are saying? If so, doesn't that make syntax fairly important? Libraries can't abstract us away from the machine much because they are dependent on the language, so it seems that syntax is what abstracts us from teh machine, which is why we choose various languages often (how well we are abstracted from the machine) which is syntax right?

    valis:
    Why would I think you are attacking me, you appear to be agreeing with m.

  2. #47
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    No, orbitz, it seems we simply have a different view of what syntax is. For me, syntax is the difference between saying:
    Code:
    blueprint bird
    begin
      begin interface
      end
    
      begin implementation
        song as soundSequence
        maxSpeed as real
      end
    end
    and:
    Code:
    class bird
    {
    public:
    
    private:
      soundSequence song;
      float maxSpeed;
    };
    As such, syntax is largely irrelevant. The ability to define a class/blueprint/whatever is what defines the language.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #48
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    Another point which I don't think has yet been fully addressed is the pointy haired manager. He may be an idiot, he may make completely unfounded claims, but he also supplies you with a constant flow of money. The more knowledgeable one is of multiple languages, the more likely the pointy haired manager will keep that person around because he/she can implement functionality the way the manager wants. Of course with such a large job market, if work is miserable it may be better to just quit the job.
    I for one don't particularly like C#, but I've done a bit of study on it anyway simply because
    a) it's still a lot of fun, just not as mind rending as I would like
    b) I'm sure much of the market will shift towards it as Microsoft continues to force it into the market.

    There have been very interesting arguments so far and quite a few articles, for those currently working on a company project, I'm curious about what language is being used.

    edit:
    Why would I think you are attacking me, you appear to be agreeing with m.
    glad to hear it, I've just run across some pretty strange people, and it's always sad to see an interesting debate turn into a flame war.
    Last edited by valis; 09-11-2005 at 12:09 PM.

  4. #49
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    I did mention managers in a previous post + provide a link to Paul Grahams article o it.

    As such, syntax is largely irrelevant. The ability to define a class/blueprint/whatever is what defines the language.
    Your example is not quite fair. Defining an object to contain slots for various data is most likely going to be fairly similar in most languages and there isn't really much differences between the end result. It's not like you can really express wanting an object to contain slots A, B, and C more succinctly than simply doing it, which is pretty much how most languages do it. A fairer example would probably involve actually doing something, such as a concurrent web server operating over N distributed nodes. I think you would notice a drastic difference in what syntax of a language can offer you in that situation.

  5. #50
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Your example is not quite fair.
    My example is perfectly fair. You still don't understand that "syntax" seems to mean something entirely different to me than to you.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #51
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    I am also a bit hesitant to beleive that OOP truly models how we think. Do you have any research papers that show this or is it your intuition?
    orbitz, though I doubt objects are the only way we can think, people have done studies on object recognition, and this ability occurrs at a fairly early age.


    As far as I know, few people are really aware of how we think and are not in a position to provide comparisons to a programmatic concept. If we really do think in an OO style, then I would argue that a language such as C++ or Java model this fairly poorly. Thoughts seem more dynamic and fluid than these languages allow.
    Agreed but only for the language itself. You can have a farily natural progression from free flowing thoughts to the language.

    As most humans do, we think in an object-oriented mind. Due to today's complexity, usually .NET/Java would fit in this area. Like ASM had to switch to C, C had to switch to C++ due to complexity later. Is C++ about ready to be too complex today?
    dxfoo, well, I don't think the C++ most people use is really that more complicated than Java or C#.

    After noticing the amount of productivity I get for using these languages, I look back at C++ and wonder why it's so obscure to do even the simplest of things. For instance, in DirectX, you're looking at 200-400 lines of code just for a video on the screen.
    The amount of code needed to put a video on the screen I would think depends on the library.

    Due to today's complexity, I'm glad they built these tools. Companies even see a need for these languages to decrease debugging time, and focus more on getting a product done less than the time they thought.
    OK, but I think both the garbage collector and a VM can be used with C++. For some projects, these are needed but for other projects using smart pointers and collection classes is better.


    Now think of using C++ for every major cell phone. It's too complex, and developing compilers for each one takes time and money.
    In that case, each different cell phone might need a differerent Java VM.

  7. #52
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Quote Originally Posted by orbitz
    Your example is not quite fair. Defining an object to contain slots for various data is most likely going to be fairly similar in most languages and there isn't really much differences between the end result. It's not like you can really express wanting an object to contain slots A, B, and C more succinctly than simply doing it, which is pretty much how most languages do it.
    I agree with you in spirit, but defining an object to contain slots for various data _is_ different in different languages.

    For example, in Io, a two dimensional point type would be created with

    Code:
    point := Object clone
    point x := 0
    point y := 0
    Then, you might define a method.

    Code:
    point mag := method(((self x ^ 2) + (self y ^ 2)) sqrt)
    Then you might make a point of your own.

    Code:
    q := point
    q x := 7
    q y := 5
    Maybe you want this to be a three-dimensional point.

    Code:
    q z := 12
    q mag := method(((self x ^ 2) + (self y ^ 2) + (self z ^ 2)) sqrt)
    Copy it and you have another.

    Code:
    s := q
    s x := 0
    Print out its magnitude, if you wish.

    Code:
    s mag print
    (This prints 13)

    Defining slots in Io and other prototype-based programming languages is much different than it is for other programming languages, and you're generally right that "most" languages do it one way, but I don't think this difference should be overlooked.

    Making q a three-dimensional point certainly is more succinct than it would be in other languages.

  8. #53
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    http://wagerlabs.com/tech/2005/09/ja...erlang-ii.html

    A blog entry attempting to weigh two languages, mostly an attempt to persuade the reader that succinctness is power.

  9. #54
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    CornedBee:
    I have been spending time learning Haskell. From what I understand of monads so far they arn't as complex as you made them out to be. They simply provide artifical data dependenceis to force operations to happen in a given order. Is this correct from what you understand?

  10. #55
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    That is correct. Understanding the detailed interactions of the more complex monads hurts my brain, though.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #56
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    How so? Do you have an example?

  12. #57
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I'm referring to objects that appear to have state.
    OK, the thing that really confused me was during the time I was learning Haskell, this exercise:

    Based on a simple binary tree:
    Code:
    data Tree a = Leaf a | Node a (Tree a) (Tree a)
            deriving Show
    Create a function label:
    Code:
    label :: Tree a -> Tree Integer
    with this property:
    Takes a binary tree as an argument. Creates a mirroring tree that has as its
    node values the infix index of the other tree's nodes.
    Do this with and without monads.

    The non-monadic version is simple enough:
    Code:
    label_helper :: Tree a -> Integer -> (Integer, Tree Integer)
    label_helper (Leaf _) i = ((i + 1), Leaf i)
    label_helper (Node _ ol or) i = let
            (myi, nl) = label_helper ol i
            (reti, nr) = label_helper or (myi + 1)
            in (reti, Node myi nl nr)
    
    
    label :: Tree a -> Tree Integer
    label t = snd (label_helper t 0)

    For the monadic version, I wanted to make a monad from the tree that behaves like the list monad, i.e. loops the following code over its elements (in infix order):
    Code:
    instance Monad Tree where
            (Leaf v) >>= k = k v
            (Node vOld leftOld rightOld) >>= k = let
                    leftNew = leftOld >>= k
                    (Leaf vNew) = k vOld
                    rightNew = rightOld >>= k
                    in
                    (Node vNew leftNew rightNew)
            return x = Leaf x
    Base on this, it would have been easy to do this:
    Code:
    mlabel t = do
            e <- t;
            return running_counter
    However, I failed both at implementing and understanding the logic behind implementing such a running counter. I know it's possible. I just don't get it.
    My mind at least really doesn't work in a functional way, although I love the idea of functional languages.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #58
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Hrm, I havn't learned Monads very well yet beyond the idea, I'll see if I can wrap my head around it later today.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Complex Number Class
    By Sephiroth1109 in forum C++ Programming
    Replies: 15
    Last Post: 12-12-2007, 04:46 PM
  2. Why am I getting 'undelcared identifier' ???
    By Bill83 in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2006, 01:00 PM
  3. arithmetic operator friend functions
    By linucksrox in forum C++ Programming
    Replies: 7
    Last Post: 02-06-2006, 11:39 PM
  4. 2 am complex double conversion woes
    By Roule in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2004, 02:53 PM
  5. Problem from texbook
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2002, 04:55 AM