A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 4 years ago

Why is it that I always view the introduction of objects to my java as an increase to the programs complexity for no good reason?.. how is it important?....

  • This Question is Closed
  1. shadowfiend
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Well, there are probably two reasons: (1) For relatively simple programs, objects don't really help maintainability and do jack up complexity. In the words of John Carmack: "Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function." This is the massive downside of Java's approach of classes-and-objects-absolutely-everywhere. (2) Really learning how to use objects properly takes time, studying other people's code/how frameworks work, and practice. You eventually gain a way of approaching problems in an object-oriented way that does make their usefulness clearer than it might be at first. You'll realize that you may well be able to decrease complexity if you do things right.

  2. rsmith6559
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Classes allow for complex actions to be accessed very simply. Even in a "Hello World" type program, the use of the System class ( System.out.println( "Hello World" ) ) hides all the good stuff of iterating through the characters and writing them to file descriptor one.

  3. shadowfiend
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Usually true, but I don't know that I like the example. print "Hello World" in Python or Ruby both provide the same hiding without the complexity of a static main function, wrapping class, System.out, etc. Java sucks for simple programs because its design decisions are entirely based around complex programs, and leave no room for simplicity when it's needed.

  4. rsmith6559
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    True, but the print function still hides the same good stuff. If you want Python objects, how about lists? I've also gone over to: if( __name__ == "__main__" ): which basically makes a main function, in most of my recent programs.

  5. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks guys the important thing to note is when writing simple programs shouldnt be a language of choice..:)

  6. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.