Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

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?....

OpenStudy (shadowfiend):

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.

OpenStudy (rsmith6559):

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.

OpenStudy (shadowfiend):

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.

OpenStudy (rsmith6559):

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.

OpenStudy (anonymous):

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

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!