aspose file tools*
The moose likes Ranch Office and the fly likes Method B vs Method A Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "Method B vs Method A" Watch "Method B vs Method A" New topic
Author

Method B vs Method A

Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
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
Sheriff

Joined: Sep 28, 2004
Posts: 19002
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19002
    
  40

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

Joined: Jan 10, 2002
Posts: 61658
    
  67

And sometimes, people are trying to drive a nail with a screwdriver and need to be shown the hammer.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Method B vs Method A