RE: Introspect whether setCharacterEncoding is present..

<[email protected]> Thu, 14 Oct 2004 03:21:04 +0530
Newsgroups gmane.comp.java.advanced-servlets
Message-ID <[email protected]>
> > I would still look for other "elegant" ways to do it before falling
> > down to using Exceptions. Using Exceptions being the easy way out,
> > tends to also become the most difficult to maintain
> > implementation. Again, this is _generally_ true, and there
> > definitely are exceptions (pun not intended this time).

> There aren't any other elegant ways to do non-local exits. Are you
> saying that you try to avoid ever using non-local exits?

That is correct. My brain's too small, and my screen real-estate too limited (even at 1280x800 and Lucida Console pt 8), to see beyond local. I also believe that a single method shouldn't scroll - horizontally or vertically - beyond your screen, with your class browser/method-browser, debugger, compilation window, output console, etc, turned on (though not necessarily all of them at the same time). Which tends to come out to about 80x40 characters (80 to allow printing the code without wrapping, if I need to - though that is really 76).
 
Or, in simpler words, I'm just too lazy.

> Now we get to the root cause (pun intended) of the argument.

> You believe (and I presume that Endre and others who don't like
> Exceptions for control flow feel the same) that programmers are more
> often stupid than not.

> I don't believe that. I believe that I am no more intelligent than
> most other programmers. I do believe that programmers are often taught
> badly or not at all. But I further believe that teaching people to
> program well is actually not that hard.

Teaching them is easy. But probability says 50% of your students are not going to understand the broader significance of what you teach. Atleast what I teach. Not in the given time.

> Maybe there's another problem?  /8->

Highly possible :)

> And teaching isn't hard, it's just about patience. The programmers I

That's accurate.
 
> have taught have generally gone on to be succesfull, some are now
> leading their own teams, some have specialized away from programming
> but I think they all have a good grasp of the language.

> Of course, I ended up mainly teaching computer science and not
> particularly Java. But because they understood the computer science
> they understood Java.

I wouldn't say what I do is that different, though I _would_ ask what exactly you mean by "teaching computer science".

> In what environment did you teach? Maybe that has an effect. I've
> always done on the job training. Week long courses in anything seem
> pretty futile to me and most of the people I've taught agree.

On the Job Training. Which makes it all the more important to reduce the review cycle. If they do something the bad way, it takes more time for me to fix the problem, or to explain to them how to fix it. If they are stuck because all the "right ways" don't work, then I tell them it's ok to break the rules sometimes. Much quicker that way.

> Again, you presume that other programmers
> are more stupid than you. If people make a mistake
> then try and correct it and move on.

Unfortunately there isn't always the time.

> > > - predicating behaviour on assertion by Exception
>
> > You got me on the last one. Hadn't thought about that.
>
> The last one is what Charles' example was doing.

Advantage Nic.

> I don't believe in exceptions to rules. They're just what people say
> when they've made a bad rule, eg: string theory.

Well then let's call them guidelines. I call them rules because it's easier to get people to obey them, then. A guideline is going to be ignored more often than is okay. (But that's just semantics)

> In fact, I generally don't believe in rules that much (eg: string
> theory).

<offtopic>
How about Quantum Mechanics?
</offtopic>

> Ermmm... if you're maintaining code then you have the code I guess. If
> you don't have the source you have the class files... if you have the
> class files you have the source code.

(I do that, but I've been told it's not legal to admit it) And anyway. It's usually easier to look at the log file than to decompile an entire jar. Getting the source code for external api, is the third step in solving the problem. Not the second. Just habit I guess, from using obfuscated jars.

> > And I hate 'break' and 'continue' more than I don't like
> > 'goto'. They're like the black sheep in the family dressed in cotton
> > candy.  The people working at Sun aren't necessarily the smartest
> > Java coders in the world. Remember java.util.Stack?

> This is really interesting. Why do you hate 'break' and 'continue'?

Because they confuse me. (See previous comment about small brain)
 
> These are necessary things. Do you try to avoid them? How?

I don't just try to avoid them. I make sure I do. I haven't had to use either in over five years (When I used to program using Turbo C - yuck).
Give me code that uses break or continue, and I'm sure I could re-write it to not use them. And the code would look nicer, and much easier to understand.
I also stay away from 'switch' and '?:', though I do use the latter sometimes, purely for fun.

> You seem to be quite a purist.
 
No one's ever called me _that_ before...
 
> But it's interesting that very purist
> languages like Scheme and Haskell (have you ever used these?) still
> have to include something for arbritary exits. Both provide
> continations.

Sorry. Never had the opportunity and the time, both at the same time.

> Scheme, Haskell and ML programmers would laugh at this argument. Their
> reaction might go something like:

> "How can you use a language which has parts that you hate? Why would
> you not use all your language's expressive capability?"

Well I don't like break and  continue, and they are part of Java. So I disagree with them too. You don't use everything a language offers you "just because it's there". It's not Everest, for God's sake.
You use the parts that work for you, and that you are comfortable with. Everything else is just bloat.

> For those who are interested I've sent a separate message with a
> little about continuations.

Where?

> > See Nic? I'm really on your side.

> Hey... it's not about sides. It's about the journey.

Ah, sorry. Wrong joke made in wrong forum. There's a convoluted context to that one. So, please ignore.

> There you go again, wanting to stop people
> doing stuff. Let them go! Free the programmer!

Sure. But only after reading the Ten Commandments to them! (more if you can think of any)

> And they're so stupid they can't read my code? It's just not true. And
> even if was I don't want to believe in a world like that.

Not _your_ code specifically. Any code that takes too long to get to grips with.

> I will when it's done. You'll be hearing a lot
> more about Thin on the new forum.

I can wait.
 
Rajesh J Advani


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

Before posting a question, try to find your answer here: 
<http://www.egroups.com/links/advanced-servlets>
Announcements should go to: [email protected]
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/advanced-servlets/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/