if methA() needs to call methB() passing variable "a" as argument, instead of making syntax of methB as methB(a), an instance variable is declared which would be updated by methA() and methB(). my personal opinion is not to use instance variables as a way of passing arguments. (https://www.theserverside.com/discussions/thread.tss?thread_id=14559#54305) Please suggest plus & minus points. Thanks, Hari Sujathan
- Posted by: hari sujathan
- Posted on: November 16 2006 10:12 EST
- Re: instance variable as a means for passing method args by Christopher Stach II on November 16 2006 12:27 EST
- Re: instance variable as a means for passing method args by arijit dey on November 17 2006 07:12 EST
- then they say - its procedural programming by hari sujathan on November 17 2006 07:27 EST
Isn't that covered in the first ten pages of every intro to OO programming book? It's retarded. Of course you shouldn't do that. Instance variables and method arguments are completely different concepts. It's also not thread safe.
If your are working alone thats fine but when multiple entities access your class you will be under a serious spell of multithreaded demon.Think....the things you are talking of are ages old and simple forgotten.No need to dig graves. cheers, http://www.javaicillusion.blogspot.com/
Yes, use of instance variables is concern when using threaded apps. Also ejbs, tapestry etc.. heap size increase. From performance point also I believe it slows down things. any more comments?