-
instance variable as a means for passing method args (3 messages)
- Posted by: hari sujathan
- Posted on: November 16 2006 10:12 EST
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 SujathanThreaded Messages (3)
- 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
-
Re: instance variable as a means for passing method args[ Go to top ]
- Posted by: Christopher Stach II
- Posted on: November 16 2006 12:27 EST
- in response to hari sujathan
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. -
Re: instance variable as a means for passing method args[ Go to top ]
- Posted by: arijit dey
- Posted on: November 17 2006 07:12 EST
- in response to Christopher Stach II
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/ -
then they say - its procedural programming[ Go to top ]
- Posted by: hari sujathan
- Posted on: November 17 2006 07:27 EST
- in response to hari sujathan
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?