Java or C++?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • s0suk3@gmail.com

    Java or C++?

    Hello, I was hoping to get some opinions on a subject. I've been
    programming Python for almost two years now. Recently I learned Perl,
    but frankly I'm not very comfortable with it. Now I want to move on
    two either Java or C++, but I'm not sure which. Which one do you think
    is a softer transition for a Python programmer? Which one do you think
    will educate me the best?
  • Bob Martin

    #2
    Re: Java or C++?

    in 342367 20080414 074410 s0suk3@gmail.co m wrote:
    >Hello, I was hoping to get some opinions on a subject. I've been
    >programming Python for almost two years now. Recently I learned Perl,
    >but frankly I'm not very comfortable with it. Now I want to move on
    >two either Java or C++, but I'm not sure which. Which one do you think
    >is a softer transition for a Python programmer? Which one do you think
    >will educate me the best?
    C++ is for masochists. Go for Java.

    Comment

    • bdsatish

      #3
      Re: Java or C++?

      On Apr 14, 12:21 pm, Bob Martin <bob.mar...@exc ite.comwrote:
      in 342367 20080414 074410 s0s...@gmail.co m wrote:
      >
      Hello, I was hoping to get some opinions on a subject. I've been
      programming Python for almost two years now. Recently I learned Perl,
      but frankly I'm not very comfortable with it. Now I want to move on
      two either Java or C++, but I'm not sure which. Which one do you think
      is a softer transition for a Python programmer? Which one do you think
      will educate me the best?
      >
      Certainly Java. It's also easier to find Java jobs than C++ jobs.

      Comment

      • xakee

        #4
        Re: Java or C++?

        On Apr 14, 11:44 am, s0s...@gmail.co m wrote:
        Hello, I was hoping to get some opinions on a subject. I've been
        programming Python for almost two years now. Recently I learned Perl,
        but frankly I'm not very comfortable with it. Now I want to move on
        two either Java or C++, but I'm not sure which. Which one do you think
        is a softer transition for a Python programmer? Which one do you think
        will educate me the best?
        Well if you need an easier transition, go for java. But personally i
        would recommend you to go for C/C++. There are a few very solid
        reasons for that.
        1. You can still use ur python konwledge, integrate python with you
        applications, extend python with C/C++ .. and so on. That would not
        only benefit you but the whole community.
        2. C/C++ is likely to teach you more things in this transition than
        java will. You probably know all the good software engineering stuff
        and things like that maybe, (which you can still use in python) but
        going to C/C++ you can actually delve into systems programming and
        things like that. When you do that, again, you can extend python and
        contribute to the community.
        3. When you get hold of c/c++, there will be lesser friction in you
        forever to transition to any other language. I appriciate that you
        chose python in the first place since that is what i advocate as
        well ... the way i see programming should be taught or taken up is
        like :
        bash/shell scripting -python/perl -c/c++ -assembly .... (from
        there on, given you give enough time to the end parts, you should not
        have any difficulty going to C#/Java/VB/Delphi or whatever for some
        nice RAD or even production level performance not-so-critical
        applications). So if you're intrested in system programming getting to
        know how things get done, have a SOLID computing background and give
        python what python gave you, go for C/C++.

        Comment

        • Bruno Desthuilliers

          #5
          Re: Java or C++?

          s0suk3@gmail.co m a écrit :
          Hello, I was hoping to get some opinions on a subject. I've been
          programming Python for almost two years now. Recently I learned Perl,
          but frankly I'm not very comfortable with it. Now I want to move on
          two either Java or C++, but I'm not sure which. Which one do you think
          is a softer transition for a Python programmer? Which one do you think
          will educate me the best?
          if it's for educational purpose, then you have absolutely nothing to
          learn from Java. On the hi-level languages side, I'd rather recommend
          Haskell or OCaml (functional programming) and/or Erlang (concurrent
          programming). And if you want to go the 'close to the metal' way, then
          better to learn C.

          My 2 cents...

          Comment

          • Marc 'BlackJack' Rintsch

            #6
            Re: Java or C++?

            On Mon, 14 Apr 2008 00:49:13 -0700, xakee wrote:
            Well if you need an easier transition, go for java. But personally i
            would recommend you to go for C/C++.
            What's that C/C++!? C and C++ are quite different languages.

            Ciao,
            Marc 'BlackJack' Rintsch

            Comment

            • Marco Mariani

              #7
              Re: Java or C++?

              s0suk3@gmail.co m wrote:
              Which one do you think will educate me the best?
              Advanced javascript might teach you something too, and be very useful at
              the same time.
              Take a look at the Crockford lessons on Yahoo! Video.


              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.


              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.

              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.


              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.

              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.

              Yahoo Entertainment is your source for the latest TV, movies, music, and celebrity news, including interviews, trailers, photos, and first looks.


              Comment

              • lbonafide@yahoo.com

                #8
                Re: Java or C++?

                On Apr 14, 2:24 am, bdsatish <bdsat...@gmail .comwrote:
                On Apr 14, 12:21 pm, Bob Martin <bob.mar...@exc ite.comwrote:
                >
                in 342367 20080414 074410 s0s...@gmail.co m wrote:
                >
                >Hello, I was hoping to get some opinions on a subject. I've been
                >programming Python for almost two years now. Recently I learned Perl,
                >but frankly I'm not very comfortable with it. Now I want to move on
                >two either Java or C++, but I'm not sure which. Which one do you think
                >is a softer transition for a Python programmer? Which one do you think
                >will educate me the best?
                >
                Certainly Java. It's also easier to find Java jobs than C++ jobs.
                Depending on the field, that is.

                Comment

                • lbonafide@yahoo.com

                  #9
                  Re: Java or C++?

                  On Apr 14, 1:44 am, s0s...@gmail.co m wrote:
                  Hello, I was hoping to get some opinions on a subject. I've been
                  programming Python for almost two years now. Recently I learned Perl,
                  but frankly I'm not very comfortable with it. Now I want to move on
                  two either Java or C++, but I'm not sure which. Which one do you think
                  is a softer transition for a Python programmer? Which one do you think
                  will educate me the best?
                  It depends on your reasons for learning either. If you're targeting a
                  specific job market, find out what is prevelant in that market. And
                  keep in mind that if it's for a job, you'll also have to get up to
                  speed on the relevant libraries and frameworks.

                  If it's educational, I'd recommend C++ just to learn about pointers
                  and memory management, so you get a better idea of what's going on
                  under the covers in languages like Java and Python and Ruby and C#.

                  Comment

                  • =?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?=

                    #10
                    Re: Java or C++?

                    Hello, I was hoping to get some opinions on a subject. I've been
                    programming Python for almost two years now. Recently I learned Perl,
                    but frankly I'm not very comfortable with it. Now I want to move on
                    two either Java or C++, but I'm not sure which. Which one do you think
                    is a softer transition for a Python programmer? Which one do you think
                    will educate me the best?
                    >
                    I can't say from personal experience (it was C, C++, then Python for me)
                    but I think you'll find Java very annoying, especially if you value
                    Python for elegance. Both C++ and Java have different philosophy than
                    Python, but C++ is better designed and more flexible.

                    As for the 'number of jobs' argument, sure there are more Java jobs but
                    this is offset by the number of Java programmers.

                    Cheers,
                    Greg

                    Comment

                    • Carl Banks

                      #11
                      Re: Java or C++?

                      On Apr 14, 2:44 am, s0s...@gmail.co m wrote:
                      Hello, I was hoping to get some opinions on a subject. I've been
                      programming Python for almost two years now. Recently I learned Perl,
                      but frankly I'm not very comfortable with it. Now I want to move on
                      two either Java or C++, but I'm not sure which. Which one do you think
                      is a softer transition for a Python programmer? Which one do you think
                      will educate me the best?
                      If you weren't comfortable with Perl my bet is that you'll be less
                      comfortable with C++ than Java.

                      It's softer transition to Java than to C++ from just about any
                      starting point.


                      Carl Banks

                      Comment

                      • Brian Vanderburg II

                        #12
                        Re: Java or C++?

                        My idea, if you really love Python and never think about erasing it
                        from your mind, go for C (not C++). A script language plus C can solve
                        every problem you need to solve. Also Python works pretty fine with C.
                        I agree mostly with this one. Scripting is very nice when writing an
                        application especially one that needs to change very often. Plus there
                        are several toolkits and existing libraries available for Python. I've
                        used wxPython some with it, and it came in handy for a few applications
                        that I would have normally written in C++/wxWidgets and have to
                        recompile every few weeks to suit my needs (data extraction tools/etc)

                        However there are cases when a compiled language is better, especially
                        anything that needs to be 'fast' and have a lower overhead. I wouldn't
                        use Python to create a very graphics intensive game or anything, though
                        it can be used with pygame/PyOpenGL for some nice simple stuff. Also
                        everything in Python is an object so it can start to consume memory when
                        handling very large data sets. And since there is no guarantee of when
                        garbage collection occurs, simply 'deleting' an item does not ensure it
                        is completely gone, especially if there are cyclic references, though
                        that can be handled by using 'gc.collect()'.



                        I consider C++ just a simplification of C, in the sense that it makes it
                        easier to do things that would take more work to be done in C. One can
                        still use C++ without all of the more complicated aspects but still take
                        advantages of other aspects.

                        C has the advantage that it does not to anything behind your back. This
                        is very useful especially for any form of system development or where
                        you must know exactly what is going on. It is still possible to do
                        'object oriented' development in C, it just requires some more typing to
                        set up whatever is needed. Even things like COM for windows can be done
                        in C, it just requires manually building the 'vtable' so to speak.
                        Also, C seems to avoid the use of temporaries where as C++ can use them
                        in conversions and assignments automatically if needed.

                        C++ makes some of it easier by doing certain things for you. Take a
                        string object for example. In C, assignment would only do a memory copy
                        operation:

                        String a, b;
                        b = a;

                        The statement 'b = a' would only copy the memory and pointers from 'b'
                        to 'a' which means they would both point to the same buffer. To avoid
                        this, a copy constructor or assignment operator can be implemented when
                        using C++. The same in C would be something like:

                        String_Assign(& b, &a); /* instead of b = a */

                        Then if a structure contains objects, more work is needed. For example,
                        in C:

                        typedef struct Name
                        {
                        String honorary;
                        String first;
                        String middle;
                        String last;
                        String lineage;
                        } Name;

                        void Name_Create(Nam e* name)
                        {
                        String_Create(& name->honorary);
                        String_Create(& name->first);
                        String_Create(& name->middle);
                        String_Create(& name->last);
                        String_Create(& name->lineage);
                        }

                        void Name_Assign(Nam e* self, Name* other)
                        {
                        String_Assign(& self->honorary, &other->honorary);
                        String_Assign(& self->first, &other->first);
                        String_Assign(& self->middle, &other->middle);
                        String_Assign(& self->last, &other->last);
                        String_Assign(& self->lineage, &other->lineage);
                        }

                        Name p1, p2;
                        Name_Create(&p1 );
                        Name_Create(&p2 );
                        Name_Assign(&p2 , &p1);

                        But in C++, this is no problem:

                        Name p1, p2;
                        p2 = p1;

                        This will automatically call the constructors of any contained objects
                        to initialize the string. The implicit assignment operator
                        automatically performs the assignment of any contained objects.
                        Destruction is also automatic. When 'p1' goes out of scope, during the
                        destructor the destructor for all contained objects is called.

                        And if you want more control you can implement the default and copy
                        constructors, destructor, and assignment operator, and tell them to do
                        what you want. Just beware because the explicit constructors only calls
                        default constructors of any parent classes (even the copy constructor)
                        unless an initializer list is used, and an explicit assignment will not
                        automatically do assignment of parent classes.

                        Neither C nor C++ is really better, it depends on the what needs to be
                        done. C does only what it is told, and also has easier external linkage
                        since there is no name mangling. C++ does a lot of the needed stuff
                        automatically, but explicit constructors and assignment operators can
                        still be declared to control them, and frequently doing the same thing
                        in C++ takes fewer lines of code than in C.

                        As for Java, I think it is 'overly-used' in some areas, especially in
                        embedded development. I attended NC State and during orientation this
                        representative was talking about a small little robotic device and how
                        it had a full Java VM inside it and it only took '6 minutes to boot'.
                        Some claim it is for portability that Java is so good in embedded
                        devices. But still, if the program is moved to another device, it may
                        still need to be changed and recompiled if the new devices has different
                        IO pins, timers, interrupts, etc. Most chips have a C
                        compiler/translator available, and the same program could have been
                        written in C, compiled directly to the machine code needed for the
                        device, 'booted' immediately, and not needed a Java VM as well. If
                        portability to other devices is desired then an abstract layer could be
                        created in the program and the device/hardware specific code could be
                        seperated to that layer seperatly from the rest of the program.

                        Well, all of that is just my opinion though, not meant to offend anyone.




                        Comment

                        • Bob Martin

                          #13
                          Re: Java or C++?

                          in 342436 20080414 160208 =?UTF-8?B?R3J6ZWdvcno gU8WCb2Rrb3dpY3 o=?= <jergosh@wp.plw rote:
                          >Hello, I was hoping to get some opinions on a subject. I've been
                          >programming Python for almost two years now. Recently I learned Perl,
                          >but frankly I'm not very comfortable with it. Now I want to move on
                          >two either Java or C++, but I'm not sure which. Which one do you think
                          >is a softer transition for a Python programmer? Which one do you think
                          >will educate me the best?
                          >>
                          >I can't say from personal experience (it was C, C++, then Python for me)
                          >but I think you'll find Java very annoying, especially if you value
                          >Python for elegance. Both C++ and Java have different philosophy than
                          >Python, but C++ is better designed and more flexible.
                          You must be joking - better designed? C++ was a botch to an already poor
                          language.

                          Personally I find Java very satisfying to write.

                          Comment

                          • Paul Anton Letnes

                            #14
                            Re: Java or C++?

                            Brian: Impressive!


                            This is the most balanced, well-informed and interesting reply to this
                            debate. I would like to make some comments even so.

                            I have tried all languages, and consider myself agnostic. However, I
                            would like to roughly repeat what James Gosling (Java inventor) said
                            at a lecture I attended: Java is nice because you can work in Java
                            everywhere now - from embedded to desktops to supercomputers and
                            servers. And, I would like to make my own comment: Java is the
                            language I have tried which gives you the most help as a developer.
                            For every crash, there is a complete and useful stack trace. Using
                            Eclipse, you can auto-generate much of the 'boilerplate' code which is
                            claimed to make Java boring to write (get, set, constructors... ). It
                            also more or less tells you how to fix small bugs - ';' and } missing
                            for example. Even python is less helpful; concider "Unexpected indent"
                            or the very informative "incorrect syntax" when you forget a ) or a : .

                            C (or C++) for learning to talk to the metal,
                            Java or Python for object orientation,
                            Java will give you the most help,
                            Python gets you started quickly,
                            C++ is the hardest to understand in every detail,
                            but C bogs you down with administrative stuff (try converting an int
                            to a string; I found myself googling for an hour!).

                            I tried this infamous "extending in C" and I would forget that until
                            you know both C and python a bit more... Also, extending python in C++
                            or Java is possible - I didn't manage C++ yet, and Java I didn't try.


                            Cheers!
                            Paul.


                            Den 15. april. 2008 kl. 05.46 skrev Brian Vanderburg II:
                            >My idea, if you really love Python and never think about erasing it
                            >from your mind, go for C (not C++). A script language plus C can
                            >solve
                            >every problem you need to solve. Also Python works pretty fine with
                            >C.
                            I agree mostly with this one. Scripting is very nice when writing an
                            application especially one that needs to change very often. Plus
                            there
                            are several toolkits and existing libraries available for Python.
                            I've
                            used wxPython some with it, and it came in handy for a few
                            applications
                            that I would have normally written in C++/wxWidgets and have to
                            recompile every few weeks to suit my needs (data extraction tools/etc)
                            >
                            However there are cases when a compiled language is better, especially
                            anything that needs to be 'fast' and have a lower overhead. I
                            wouldn't
                            use Python to create a very graphics intensive game or anything,
                            though
                            it can be used with pygame/PyOpenGL for some nice simple stuff. Also
                            everything in Python is an object so it can start to consume memory
                            when
                            handling very large data sets. And since there is no guarantee of
                            when
                            garbage collection occurs, simply 'deleting' an item does not ensure
                            it
                            is completely gone, especially if there are cyclic references, though
                            that can be handled by using 'gc.collect()'.
                            >
                            >
                            >
                            I consider C++ just a simplification of C, in the sense that it
                            makes it
                            easier to do things that would take more work to be done in C. One
                            can
                            still use C++ without all of the more complicated aspects but still
                            take
                            advantages of other aspects.
                            >
                            C has the advantage that it does not to anything behind your back.
                            This
                            is very useful especially for any form of system development or where
                            you must know exactly what is going on. It is still possible to do
                            'object oriented' development in C, it just requires some more
                            typing to
                            set up whatever is needed. Even things like COM for windows can be
                            done
                            in C, it just requires manually building the 'vtable' so to speak.
                            Also, C seems to avoid the use of temporaries where as C++ can use
                            them
                            in conversions and assignments automatically if needed.
                            >
                            C++ makes some of it easier by doing certain things for you. Take a
                            string object for example. In C, assignment would only do a memory
                            copy
                            operation:
                            >
                            String a, b;
                            b = a;
                            >
                            The statement 'b = a' would only copy the memory and pointers from 'b'
                            to 'a' which means they would both point to the same buffer. To avoid
                            this, a copy constructor or assignment operator can be implemented
                            when
                            using C++. The same in C would be something like:
                            >
                            String_Assign(& b, &a); /* instead of b = a */
                            >
                            Then if a structure contains objects, more work is needed. For
                            example,
                            in C:
                            >
                            typedef struct Name
                            {
                            String honorary;
                            String first;
                            String middle;
                            String last;
                            String lineage;
                            } Name;
                            >
                            void Name_Create(Nam e* name)
                            {
                            String_Create(& name->honorary);
                            String_Create(& name->first);
                            String_Create(& name->middle);
                            String_Create(& name->last);
                            String_Create(& name->lineage);
                            }
                            >
                            void Name_Assign(Nam e* self, Name* other)
                            {
                            String_Assign(& self->honorary, &other->honorary);
                            String_Assign(& self->first, &other->first);
                            String_Assign(& self->middle, &other->middle);
                            String_Assign(& self->last, &other->last);
                            String_Assign(& self->lineage, &other->lineage);
                            }
                            >
                            Name p1, p2;
                            Name_Create(&p1 );
                            Name_Create(&p2 );
                            Name_Assign(&p2 , &p1);
                            >
                            But in C++, this is no problem:
                            >
                            Name p1, p2;
                            p2 = p1;
                            >
                            This will automatically call the constructors of any contained objects
                            to initialize the string. The implicit assignment operator
                            automatically performs the assignment of any contained objects.
                            Destruction is also automatic. When 'p1' goes out of scope, during
                            the
                            destructor the destructor for all contained objects is called.
                            >
                            And if you want more control you can implement the default and copy
                            constructors, destructor, and assignment operator, and tell them to do
                            what you want. Just beware because the explicit constructors only
                            calls
                            default constructors of any parent classes (even the copy constructor)
                            unless an initializer list is used, and an explicit assignment will
                            not
                            automatically do assignment of parent classes.
                            >
                            Neither C nor C++ is really better, it depends on the what needs to be
                            done. C does only what it is told, and also has easier external
                            linkage
                            since there is no name mangling. C++ does a lot of the needed stuff
                            automatically, but explicit constructors and assignment operators can
                            still be declared to control them, and frequently doing the same thing
                            in C++ takes fewer lines of code than in C.
                            >
                            As for Java, I think it is 'overly-used' in some areas, especially in
                            embedded development. I attended NC State and during orientation this
                            representative was talking about a small little robotic device and how
                            it had a full Java VM inside it and it only took '6 minutes to boot'.
                            Some claim it is for portability that Java is so good in embedded
                            devices. But still, if the program is moved to another device, it may
                            still need to be changed and recompiled if the new devices has
                            different
                            IO pins, timers, interrupts, etc. Most chips have a C
                            compiler/translator available, and the same program could have been
                            written in C, compiled directly to the machine code needed for the
                            device, 'booted' immediately, and not needed a Java VM as well. If
                            portability to other devices is desired then an abstract layer could
                            be
                            created in the program and the device/hardware specific code could be
                            seperated to that layer seperatly from the rest of the program.
                            >
                            Well, all of that is just my opinion though, not meant to offend
                            anyone.
                            >
                            >
                            >
                            >
                            --
                            http://mail.python.org/mailman/listinfo/python-list

                            Comment

                            • Ivan Illarionov

                              #15
                              Re: Java or C++?

                              On 15 ÁÐÒ, 07:46, Brian Vanderburg II <BrianVanderbu. ..@aim.com>
                              wrote:
                              [...]
                              C has the advantage that it does not to anything behind your back. This
                              is very useful especially for any form of system development or where
                              you must know exactly what is going on. It is still possible to do
                              'object oriented' development in C, it just requires some more typing to
                              set up whatever is needed. Even things like COM for windows can be done
                              in C, it just requires manually building the 'vtable' so to speak.
                              Also, C seems to avoid the use of temporaries where as C++ can use them
                              in conversions and assignments automatically if needed.
                              Great point. It's also possible to do Python object-oriented
                              programming in C. 'PyMethodDefs' are the same 'vtables'. I've found
                              that Python/C API is not that hard, the problem is a lack of good
                              tutorials and false assumptions that ctypes or SWIG are somehow
                              better. After `#include Python.h` C becomes very Python friendly.

                              Comment

                              Working...