• HelluvaEngineer (unregistered)

    You see, you can use a singleton model for every class!

  • (cs)

    yeah i mean, who needs an exception stack trace, right?

     

    just make everything static. imagine the resources you save when you dont instantiate anything!

  • (cs) in reply to HelluvaEngineer
    Anonymous:
    You see, you can use a singleton model for every class!


    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)
  • Thiago (unregistered) in reply to HelluvaEngineer

    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."

  • Single Ton (unregistered)

    How can they be an architecture team if they don't use patterns?

  • (cs)

    "some very error messages"?
    as opposed to only "some error messages"

  • a0a (unregistered)
    • lack of error/exception handling..
    • no propper log/debug system..
    • no test framework..
    • huge j2EE systems probably have huge management and architecture overhead, and very small development teams..

    .. 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..



  • (cs)

    This is proof that singletons are like crack.  Dangerous if not used properly.

  • (cs) in reply to pbounaix
    pbounaix:

    yeah i mean, who needs an exception stack trace, right?



    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
  • (cs)

    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.

  • (cs)
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.

    I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?
  • (cs)

    ya'll know that the real WTF is using java for such application in the first place [:D]

  • HelluvaEngineer (unregistered) in reply to ObySamKenoby
    ObySamKenoby:
    Anonymous:
    You see, you can use a singleton model for every class!


    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)


    Hmmm...come to think of it, they should implement a new Session object this way.
  • (cs) in reply to Single Ton
    Anonymous:
    How can they be an architecture team if they don't use patterns?


    They just mis-use them....
  • Rain dog (unregistered) in reply to Xargon
    Xargon:
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.

    I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?


    Those are generally every exception handled in Java or C#. It's expected that those throw exceptions.
  • mikeyd (unregistered) in reply to Xargon

    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.

  • Shadow_x99 (unregistered) in reply to BlackTigerX

    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?


  • .* (unregistered) in reply to Shadow_x99
    Anonymous:
    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?


    Python, of course. Maybe if this forum was coded in Python instead of ASP it would work without Javascript.

  • (cs) in reply to Xargon
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.


    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!"


  • (cs) in reply to Xargon
    Xargon:
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.


    I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?

    invalid username/password

  • (cs) in reply to mikeyd
    Anonymous:
    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.


    Exceptions aren't particularly fast.
  • (cs)
    Alex Papadimoulis:
    DataNotFoundException.getInstance().setMessage(errMsg);
    throw DataNotFoundException.getInstance();

    ... and, as one might expect, DataNotFoundException was implemented as a singleton, as were all other exception classes. A rather interesting choice for what was a high-traffic J2EE web application in a multithreaded environment ...

    Wouldn't that be an example of the famed Simpleton Pattern? (the 5th Cremational Resign Pattern)

    Anonymous:
    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?


    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

  • (cs) in reply to .*
    Anonymous:
    Anonymous:
    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?


    Python, of course. Maybe if this forum was coded in Python instead of ASP it would work without Javascript.



    ASP is not a programming language.

  • (cs) in reply to Shadow_x99

    Anonymous:
    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?


     

    Fortran.net.  That way everyone else I work with would actually have a shot at understanding how these newfangled webthingamajigs are programmed.

  • anon (unregistered)

    Obviously the following pattern is required in this situation:

    DataNotFoundException.getInstance().setMessage(errMsg);
    DataNotFoundException.getInstance().setMessage(errMsg);
    DataNotFoundException.getInstance().setMessage(errMsg);
    throw DataNotFoundException.getInstance();


    http://www.thedailywtf.com/forums/56896/ShowPost.aspx

  • anon (unregistered) in reply to anon

    It totally cut out the url I tacked on.  See the forum posting "Ask Thrice. . ." if you don't get it. . .

  • (cs) in reply to mikeyd
    Anonymous:
    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.


    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.
  • (cs) in reply to SeekerDarksteel
    SeekerDarksteel:

    Anonymous:
    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?


     

    Fortran.net.  That way everyone else I work with would actually have a shot at understanding how these newfangled webthingamajigs are programmed.

    Fortran.Net is for the weaklings, Real Programmers use CGI/Fortran (or CGI/ASM if you prefer).

  • (cs) in reply to chrismcb
    chrismcb:
    Xargon:
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.


    I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?

    invalid username/password



    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...)
  • (cs) in reply to Djinn

    Djinn:
    Anonymous:
    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.


    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.

    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.

  • (cs)

    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.

  • (cs) in reply to masklinn
    masklinn:

    Fortran.Net is for the weaklings, Real Programmers use CGI/Fortran (or CGI/ASM if you prefer).



    Nonsense.  Real programmers use Verilog on Rails.  Compiling means programming an FPGA!

  • (cs) in reply to ObySamKenoby
    ObySamKenoby:
    chrismcb:
    Xargon:
    Alex Papadimoulis:

    An unexpected exception occurred. Please try again.


    I've always wondered: what would an "expected exception" be, and would I be told if I encountered one?

    invalid username/password



    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...)

     

    there is always one who thinks they are so smart!!

  • Brian White (unregistered) in reply to giannis

    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.

  • (cs) in reply to versatilia
    versatilia:
    pbounaix:

    yeah i mean, who needs an exception stack trace, right?



    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


    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.
  • (cs) in reply to Shadow_x99
    Anonymous:
    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?




    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)
  • (cs) in reply to giannis

    He never said it was, he said it was a web development platform... which it is... twat.

  • Shane (unregistered) in reply to Brian White

    Anonymous:
    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.

    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...

  • (cs)

    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 ...

  • Oli (unregistered)

    The thought of rewriting an erroneous singleton-based application makes me cry blood.

  • (cs) in reply to Satanicpuppy
    Anonymous:
    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?


    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.
  • (cs) in reply to hash
    hash:
    He never said it was, he said it was a web development platform... which it is... twat.


    How long have you been dying to use that word on the internet?
  • (cs)

    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.

  • Cabbage (unregistered)
    Alex Papadimoulis:
    An unexpected exception occurred. Please try again.


    Sound familiar? ("Something didn't quite work out ...")

  • (cs) in reply to masklinn
    masklinn:

    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



    this forum needs a huge rolleyes smiley
  • Casual WTF Viewer (unregistered) in reply to mikeyd

    Anonymous:
    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.

    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.

  • Andy (unregistered)

    Sounds like a typical 'enterprise' solution: only works in an imaginary world and is shot full of holes by aliens on a regular basis.

  • Matthew (unregistered) in reply to .*

    Anonymous:
    Anonymous:
    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?


    Python, of course. Maybe if this forum was coded in Python instead of ASP it would work without Javascript.

    Maybe. Or maybe you could read this instead:

    http://en.wikipedia.org/wiki/Logical_fallacies

  • Matt (unregistered) in reply to Casual WTF Viewer

    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

  • Matt (unregistered) in reply to Casual WTF Viewer

    Er... lets try this again, with quoting:

    Anonymous:

    Anonymous:
    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.

    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.

    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

Leave a comment on “Exceptional Singleton”

Log In or post as a guest

Replying to comment #:

« Return to Article