Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method B vs Method A

 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wanted to comment on a situation which happens time and again on coderanch, Quite often, I don't think it's very helpful, particularly to newebies. I guess it is is in the nature of these types of forums. It happens when someone, is getting some assistance in getting MethodA working, and someone else, often who knows has a wealth of knowledge about the java language, will chime in with, don't use methodA, methodB is much better, without much regard for context, or the actual reuirements of the situation. It may even be that methodB does have advantages over methodA, but in the context of the given situation those advantages don't really apply. A few simple examples...

Someone is using KeyEvents and is trying to recognize a certain type of Keystroke, and will be told don't use KeyEvents, keyBindings are better.

Someone is trying to figure out how to use an array to get a database table into a JTable, and will hear that they really shouldn't use an array, they should use a vector of vectors because blah blah blah scaleability blah blah blah

Someone is trying to parse something and is told that Regex is the best, without regard to the fact that in the given situation it has no advantage over stringTokenizers, and is probably more difficult to implement.

Or maybe someone thinks a certain type of reference type is better than another.

the list goes on and on.

Usually when you look closely at the supposed superiority of B over A, it goes something like this...

There are some situations where methodB is the method of choice, the rest of the time it really doesn't matter. Therefore methodB should always be used. Never mind the fact that methodA is perfectly satisfactory for the task at hand.

Anyways, that's all I have to say.

regards.

 
Henry Wong
author
Marshal
Pie
Posts: 21212
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It happens when someone, is getting some assistance in getting MethodA working, and someone else, often who knows has a wealth of knowledge about the java language, will chime in with, don't use methodA, methodB is much better, without much regard for context, or the actual reuirements of the situation. It may even be that methodB does have advantages over methodA, but in the context of the given situation those advantages don't really apply. A few simple examples...


IMO, any help is better than no help.... Meaning that the asker can still just ignore the method B info. Or just thank for the help, and elaborate why it must be done a certain way. In many cases, a simple "I am not allowed to do it that way" is fine -- as many of the questions are for homework problems, which are restricted (particularly against regex).

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 21212
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or another way to think about... The person took time to answer a question. It may not be what you wanted, but that person took the time for you nonetheless. It is better to thank that person, than to be "irked" about that person. After all, he/she tried to help you -- isn't that better than the 180,000 other forum users that didn't even read your topic?


[BTW, I used the pronoun "you" because it was less cumbersome -- I know that you may not be referring to your topics, but topics in general.]

Henry
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64982
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And sometimes, people are trying to drive a nail with a screwdriver and need to be shown the hammer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic