- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
You see, you can use a singleton model for every class!
Admin
yeah i mean, who needs an exception stack trace, right?
just make everything static. imagine the resources you save when you dont instantiate anything!
Admin
Yes, and starting your brain before doing something like that could be a good thing. (NB: it's a continuation of your statement, not an offence)
Admin
this wtf makes me remember of this famous donald knuth quote: "Premature optimization is the root of all evil (or at least most of it) in programming."
Admin
How can they be an architecture team if they don't use patterns?
Admin
"some very error messages"?
as opposed to only "some error messages"
Admin
.. and I just have the feeling that the application had some performance issues because of the high-traffic?
I wonder if there is actually J2EE stuff which works for these *huge* applications..
Admin
This is proof that singletons are like crack. Dangerous if not used properly.
Admin
Don't get me started on those things... My eyes bleed every time I see a production system (read: public website) throw up pages and pages of stack trace when all you want is a user-friendly error message.
I'm beginning to think exception handling is last on the 'to do' list of java programmers.
As for tomcat fans and their insistence that a dual 1.5Ghz CPU with 2GB DDR is just not enough to handle their 100 user website...
/troll
Admin
Do you really want to throw an exception when a user fails to enter the right username or password? Hardly exceptional with my users.
If said yes to 1 and you were creating your own exception class for it, would you call it "DataNotFoundException?" How about AuthenticationFailureException? Or LoginFailureException?
This is just another example of developers wasting too much time trying to "properly" handle exceptions and ending up with a worse result than if they had done nothing at all.
Admin
I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?
Admin
ya'll know that the real WTF is using java for such application in the first place [:D]
Admin
Hmmm...come to think of it, they should implement a new Session object this way.
Admin
They just mis-use them....
Admin
Those are generally every exception handled in Java or C#. It's expected that those throw exceptions.
Admin
I've used exceptions to break out of a bunch of inner functions while returning a result, and so of course you wouldn't tell the user, it's expected.
Admin
What would you use as a Web Development Platform?
ASP?
ASP.NET?
PHP4?
PHP5?
Perl?
Ruby?
Plain HTML with some AJAX with a SOAP Server?
Admin
Python, of course. Maybe if this forum was coded in Python instead of ASP it would work without Javascript.
Admin
This is like saying: "We expect to have certain exceptions happen on a regular basis (which makes one start to think, gee, if I expect this to happen, it isn't really an exception is it?) however, you just did something which caused another type of error which was totally unexpected and the application is not designed to handle it. I guess it's not your day today but maybe if you try again in a few minutes, your luck will be in and it will work!"
Admin
invalid username/password
Admin
Exceptions aren't particularly fast.
Admin
Wouldn't that be an example of the famed Simpleton Pattern? (the 5th Cremational Resign Pattern)
Ruby/RoR or Python/Django (or maybe Python/Turbogears if you prefer, I'd go with Django though).
And if you want to toy with Ajaxy stuff, Prototype, MochiKit or Dojo (I think Django bundles Dojo, not sure though)
Not PHP for sure (too bothersome to keep clean), no fscking way I'd use Perl, and I don't know ASP nor ASP.Net.
So either RoR or Django, depending on the language you prefer (Ruby or Python).
There are some differences between the RoR and the Django "philosophies" (ways of life) that may also play a role in your choice, but... that's an other issue
Admin
ASP is not a programming language.
Admin
Fortran.net. That way everyone else I work with would actually have a shot at understanding how these newfangled webthingamajigs are programmed.
Admin
Obviously the following pattern is required in this situation:
Admin
It totally cut out the url I tacked on. See the forum posting "Ask Thrice. . ." if you don't get it. . .
Admin
You bastard.
[ unrelated ]
Just as with becoming a programmer in general, you should have to get a license to use design patterns. You get a license for driving, guns, and hunting, because we don't want people mishandling these things and getting hurt. Same principle here.
Admin
Fortran.Net is for the weaklings, Real Programmers use CGI/Fortran (or CGI/ASM if you prefer).
Admin
This shouldn't be an exception - it's something that you expect to happen. An exception is that - an exception, something that CAN happen but is not intended to happen (required files not found etc...). You should never use exceptions to handle your software flow, just to manage something wrong that can be corrected - automatically or not (ie - database not availableand so on...)
Admin
I dunno, whoever they dug up to teach the course would probably make it worse...
Imagine if you will, the next attempt at dealing with the singleton databaseexception. A flyweight-cache so as to share common message instances, a factory to create the right style of database exception, coupled with the option to choose one's factory at runtime via a prototype, and then the database exceptions could use a template pattern instead of messages, an observer pattern to decouple logging the databaseexceptions, and a swarm of decorators to allow these exceptions to wrap on top of each other.
Admin
Data Not Found is Data Not Found! No need to be picky about small details like the actual message sendt back. In fact, these users should just be happy that they didn't get a File Not Found, because, as everybody know, that is the same as 'false', which in turn is the same as '0', which is an artifact from C that means isTrue("trouble")=="paula", which will show you it's brillancy with a server-side seg. fault.
Sincerely,
![pi] approved.
Admin
Nonsense. Real programmers use Verilog on Rails. Compiling means programming an FPGA!
Admin
there is always one who thinks they are so smart!!
Admin
Neither ASP nor ASP.Net are programming languages. That's true. That's also irrelevant. The question was which would you use as a web development pattern. Both ASP and ASP.Net are web development platforms. Both can be implemented with multiple different languages. ASP can be done in either VBScript or JScript natively, and there were other plugins to allow other languages, I'm pretty sure perl was one. ASP.Net can be done in VB.net, C#, and JScript.net natively, and in others using plugins, including Perl, Python, and even (god help me) COBOL.net.
Admin
Are there really Tomcat "fans". I use Tomcat exclusively when I need to host JSP, and even I hate that piece of crap. The documentation is scanty, the configuration is weird, debugging other peoples setup is a nightmare. If there was something better, I'd use it in a second.
Admin
In order of preference:
Python,
*Pulls on flame retardant garmets*
Php5,
Perl,
*Removes flame retardant garmets*
Java,
C#.Net (I wouldn't let my dog code in ASP)
Admin
He never said it was, he said it was a web development platform... which it is... twat.
Admin
I'm pretty sure that if you're using COBOL.NET God has already abandoned you. Go ahead and make a sign that reads "Now Entering Hell" and hang it just outside your cubicle entrance...
Admin
While it required a collective blindness and stupidity to make error data code effectively global, I have to say that Java encourages a special kind of typed exception hell which ridiculous bookkeeping.
The nonsense is that you have to declare exception types that you may throw. This does not help design; no other language does this. You all know what you do when the compiler says that you're throwing something undeclared ... you use the IDE's refactor function to declare that you throw it. I hate fighting the compiler like that.
The easy way out of this, to make exceptions behave like other languages, is to only throw subclasses of RunTimeException (and hint! you can make your own!). You don't have to declare that you throw it then, you know <wink wink>!
How hard would it have been to change the exception types to RunTimeException, replace all the catch-drops, and voila! there would have been actual real error information.
But no. They hired a team of architects to build a solution that only Java suggests is necessary, and end up with something for a single thread environment. What's sad is that this is far and away the rule ...
Admin
The thought of rewriting an erroneous singleton-based application makes me cry blood.
Admin
I do all my HTMLs in ASM, on a processor I designed myself with parts from Radio Shack. I don't trust high-level languages or processors. Sure, it takes up my whole basement, runs at 0.000133MHz, and crashes after a good 15 minutes of processing, but if something breaks I don't have to ask M$ or Int€£ what's broken.
Admin
How long have you been dying to use that word on the internet?
Admin
It didn't occur to anyone to check the code as they were adding in the exception handling?
Not sure which effort was more misguided here.
Admin
Sound familiar? ("Something didn't quite work out ...")
Admin
this forum needs a huge rolleyes smiley
Admin
Arg...this might be one of the most prevelent things I see when reviewing code of recent CS graduates. It is NEVER appropriate to use exceptions to determine program flow. Throwing and catching an error take up significantly more resources than checking to see if you have met a condition. Int32.TryParse was created for a reason (C#; however, most languages have something similar). It is a poor solution no matter how you look at it. Please, do everyone who will interact with your code a favor - never use exceptions for process flow.
Admin
Sounds like a typical 'enterprise' solution: only works in an imaginary world and is shot full of holes by aliens on a regular basis.
Admin
Maybe. Or maybe you could read this instead:
http://en.wikipedia.org/wiki/Logical_fallacies
Admin
Well, mostly I agree. However, in Python, using exceptions for such purposes is encouraged, and the core language itself has, for instance, a StopIteration exception. On the newsgroups, using exceptions for flow control is advocated by the senior pythonistas and the BDFL. So, as long as the language the OP was writing in was python, one might forgive him or her.
I gotta say, though, that the idea does make me a bit queasy (coming from a C++ background), but I'm otherwise quite fond of python, so I accept it.
-matt
Admin
Er... lets try this again, with quoting:
Well, mostly I agree. However, in Python, using exceptions for such purposes is encouraged, and the core language itself has, for instance, a StopIteration exception. On the newsgroups, using exceptions for flow control is advocated by the senior pythonistas and the BDFL. So, as long as the language the OP was writing in was python, one might forgive him or her.
I gotta say, though, that the idea does make me a bit queasy (coming from a C++ background), but I'm otherwise quite fond of python, so I accept it.
-matt