Thread: Triggers

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    127
    Rep Power
    13

    Triggers


    Hi!

    I found this at The Codeless Code about database triggers:

    http://thecodelesscode.com/case/42

    It's a site that discusses software development in the form of buddhist koans. When I hit this one, I immediately thought of this forum, and wanted to know what the resident mySQL experts thought of it.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by almo2001
    ... and wanted to know what the resident mySQL experts thought of it.
    i don't get it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    127
    Rep Power
    13
    Originally Posted by r937
    i don't get it
    Ok, then it's not just my lack of knowledge of triggers. Some of these things are quite cool, like this one:

    http://thecodelesscode.com/case/32

    They vary from more obvious like this one to cryptic like the trigger one.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    127
    Rep Power
    13
    Hmm... maybe it's saying that leaving automatic actors (the mousetraps) in the dark (your database) can hurt you. And that they are invisible until you run into them? The writer seems to have a distaste for them.

    He does refer to some of the high preist types as "Java Masters." That should give some inkling of his tastes.
  8. #5
  9. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by almo2001
    Some of these things are quite cool, like this one:

    http://thecodelesscode.com/case/32
    i don't get this one either, and it's supposed to be obvious?

    needless to say, that website is worthless to me

    buncha mumbo-jumbo jive @ss hipster garbage

    Comments on this post

    • shammat agrees
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    127
    Rep Power
    13
    Hahah!

    #32 says that if one programmer makes a mistake, but his code is clear, you'll be able to find the mistake. So that mistake is not a big problem.

    If the other programmer writes code that works but is a mess, it is worth less even though it works because it will be hard to work with in the future.
  12. #7
  13. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    Originally Posted by almo2001
    Hmm... maybe it's saying that leaving automatic actors (the mousetraps) in the dark (your database) can hurt you. And that they are invisible until you run into them? The writer seems to have a distaste for them.
    Yes Triggers can hurt you a lot when you least expect it and make you waste days trying to debug some piece of code that just behaves very irate and you can't make any sense of it until you suddenly get a flash and realize that triggers are performing a lot of hidden activities and then you have to spend a lot of time trying to figure out how they work and are intended to work.

    To understand and debug an application your best tool as a programmer is to step through the code, line by line in your debugger, and verify variable values etc along the way.

    Using triggers in the database is like if the debugger would randomly not show (but still execute) a few lines of code from time to time. Because suddenly something happens in the database without your code have done anything of the sort and you can't for the love of God understand why it happened.

    As you can imagine I'm not pro triggers either and none of the good programmers I know like them. We have all lost toes!

    Just my 2 cents
    /Stefan
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    127
    Rep Power
    13
    Ah right. That makes more sense to me now, thanks.

IMN logo majestic logo threadwatch logo seochat tools logo