How to write Java style classes in C++

Discussion in 'C++' started by aardappel, Dec 28, 2005.

  1. aardappel

    aardappel Guest

    Some of you may enjoy this style of programming:

    http://strlen.com/rants/javaclassesincpp.html

    I am aware that this post will generate a lot of complaints that this
    is not how one is "supposed" to program C++, but if you do, please
    quantify why you think its bad :)
     
    aardappel, Dec 28, 2005
    #1
    1. Advertising

  2. aardappel wrote:

    > is not how one is "supposed" to program C++, but if you do, please
    > quantify why you think its bad :)


    Is easy: if you want the style of another language, just use that language,
    or design another one with the same ideas.

    --
    Salu2
     
    =?ISO-8859-15?Q?Juli=E1n?= Albo, Dec 29, 2005
    #2
    1. Advertising

  3. Julián Albo wrote:

    > aardappel wrote:
    >
    >
    >>is not how one is "supposed" to program C++, but if you do, please
    >>quantify why you think its bad :)

    >
    >
    > Is easy: if you want the style of another language, just use that language,
    > or design another one with the same ideas.


    Perhaps you could point me to some realtime Java compilers for various uP in
    that case...?

    --
    Dirk

    The Consensus:-
    The political party for the new millenium
    http://www.theconsensus.org
     
    Dirk Bruere at Neopax, Dec 29, 2005
    #3
  4. aardappel

    Mike Smith Guest

    Dirk Bruere at Neopax wrote:
    > Julián Albo wrote:
    >
    >> aardappel wrote:
    >>
    >>
    >>> is not how one is "supposed" to program C++, but if you do, please
    >>> quantify why you think its bad :)

    >>
    >>
    >>
    >> Is easy: if you want the style of another language, just use that
    >> language,
    >> or design another one with the same ideas.

    >
    >
    > Perhaps you could point me to some realtime Java compilers for various
    > uP in that case...?


    Then write in C++, not Java.

    --
    Mike Smith
     
    Mike Smith, Dec 29, 2005
    #4
  5. aardappel

    KeithSpook Guest

    aardappel wrote:
    > Some of you may enjoy this style of programming:
    >
    > http://strlen.com/rants/javaclassesincpp.html
    >
    > I am aware that this post will generate a lot of complaints that this
    > is not how one is "supposed" to program C++, but if you do, please
    > quantify why you think its bad :)


    It would be really easy to catch "traditional" C++ programmers off
    guard with some of these constructs... Especially the

    struct something {
    #include "ALotOfStuff.h"
    #include "SomeMoreStuff.h"
    };

    If I saw that in production code, I would resign on the spot and become
    a cabby in Tbilisi.

    Also, in Java the idea is that everything is in a class. Sure, one can
    do this in C++:
    #include <iostream>

    class Application {
    void Run() {
    std::cout << "Never mind main()! Use global objects!\n"
    }
    public:
    Application() {
    Run();
    }
    } myGlobalApplication;

    int main() { return 0; }

    But the net gain is a loss. Seems silly to me to ignore the ability to
    use free functions in C++...

    ~KS
     
    KeithSpook, Dec 29, 2005
    #5
  6. Dirk Bruere at Neopax wrote:

    >> Is easy: if you want the style of another language, just use that
    >> language, or design another one with the same ideas.

    > Perhaps you could point me to some realtime Java compilers for various uP
    > in that case...?


    No. Ask in a more adequate group, search the web... or write one.

    --
    Salu2
     
    =?ISO-8859-15?Q?Juli=E1n?= Albo, Dec 29, 2005
    #6
  7. Julián Albo wrote:

    > Dirk Bruere at Neopax wrote:
    >
    >
    >>>Is easy: if you want the style of another language, just use that
    >>>language, or design another one with the same ideas.

    >>
    >>Perhaps you could point me to some realtime Java compilers for various uP
    >>in that case...?

    >
    >
    > No. Ask in a more adequate group, search the web... or write one.
    >

    Well, unfortunately I have to get real stuff done for real money to real timescales.

    --
    Dirk

    The Consensus:-
    The political party for the new millenium
    http://www.theconsensus.org
     
    Dirk Bruere at Neopax, Dec 29, 2005
    #7
  8. Mike Smith wrote:

    > Dirk Bruere at Neopax wrote:
    >
    >> Julián Albo wrote:
    >>
    >>> aardappel wrote:
    >>>
    >>>
    >>>> is not how one is "supposed" to program C++, but if you do, please
    >>>> quantify why you think its bad :)
    >>>
    >>>
    >>>
    >>>
    >>> Is easy: if you want the style of another language, just use that
    >>> language,
    >>> or design another one with the same ideas.

    >>
    >>
    >>
    >> Perhaps you could point me to some realtime Java compilers for various
    >> uP in that case...?

    >
    >
    > Then write in C++, not Java.


    So, some reason why I should not take up the suggestion offered by the original
    poster in order to make life easier?

    --
    Dirk

    The Consensus:-
    The political party for the new millenium
    http://www.theconsensus.org
     
    Dirk Bruere at Neopax, Dec 29, 2005
    #8
  9. aardappel

    Luke Meyers Guest

    Dirk Bruere at Neopax wrote:
    > Julián Albo wrote:
    > > Dirk Bruere at Neopax wrote:
    > >>Perhaps you could point me to some realtime Java compilers for various uP
    > >>in that case...?

    > >
    > > No. Ask in a more adequate group, search the web... or write one.
    > >

    > Well, unfortunately I have to get real stuff done for real money to real timescales.


    So do many of us, but that doesn't mean we get snippy when someone
    advises us that posting a question in comp.lang.c++ about the
    availability of Java compilers is a bit misguided. Creates a bit of a
    signal-to-noise problem for those of us reading this thread to see
    responses to the OP's idea.

    Luke
     
    Luke Meyers, Dec 29, 2005
    #9
  10. Dirk Bruere at Neopax wrote:

    >> Then write in C++, not Java.

    >
    > So, some reason why I should not take up the suggestion offered by the
    > original poster in order to make life easier?


    Your code will be difficult to read and understand for both Java and C++
    programmers.

    --
    Salu2
     
    =?ISO-8859-15?Q?Juli=E1n?= Albo, Dec 30, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ankit
    Replies:
    1
    Views:
    367
    Alex Martelli
    Dec 22, 2005
  2. Isaac Rodriguez

    Are all classes new-style classes in 2.4+?

    Isaac Rodriguez, Dec 31, 2006, in forum: Python
    Replies:
    4
    Views:
    399
    Steven D'Aprano
    Dec 31, 2006
  3. Quek
    Replies:
    3
    Views:
    351
  4. Terry Reedy
    Replies:
    5
    Views:
    531
    Robert Kern
    Nov 30, 2010
  5. Ken Varn
    Replies:
    0
    Views:
    526
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page