The Artima Developer Community
Sponsored Link

Java Answers Forum
Methods

1 reply on 1 page. Most recent reply: Mar 7, 2002 3:53 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Tim

Posts: 5
Nickname: anna
Registered: Mar, 2002

Methods Posted: Mar 7, 2002 3:07 PM
Reply to this message Reply
Advertisement
Its reccommended that most java methods dont read input from users and dont print information onto the computer screen. Why is this reccommended? A program with many methods, one method only is used for all reading of user input and printing onto the screen, Why?


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Methods Posted: Mar 7, 2002 3:53 PM
Reply to this message Reply
Probably who ever recommended this to you had in mind the idea of flexibility. If you write a whole system that has methods all over the place putting output to the screen and asking for input, it is very rigid. At some later point, maybe you will want to migrate it to a graphical (or other) user interface, but since all the I/O is spread throughout the app it will be a big mess.

Also, by centralizing this I/O, you can add features to it. For instance, you may want later have the output logged somewhere in addition to being displayed. Now if you have to go track down every place you used System.out.print() or and System.out.println() and any other method of output, you have a big job. However, if you centralized it in a class or method for displaying results, then voila! One simple place to update!

Flat View: This topic has 1 reply on 1 page
Topic: How to reach methods from ccl.util.Util Previous Topic   Next Topic Topic: Crystal Reports

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use