I found this on Twitter this morning, and thought it very, very wise:
I found this on Twitter this morning, and thought it very, very wise:
'So much complexity in software comes from trying to make one thing do two things.' -- Ryan Singer
And then, this afternoon, it totally bit me in the ass!
I'm working on my legacy app, sprucing up the UI a bit, when I notice that at runtime, this button appears out of no where and sticks itself right in the middle of some other stuff.
A little investigation reveals that someone actually had this thought process:
"I need a new button for certain circumstances. I know, I'll take an existing button, change its caption, change its size, change its position, and attach a completely different event handler, and I"ll have exactly what I need!!"
You know, because buttons are so expensive to create.
'So much complexity in software comes from trying to make one thing do two things.' -- Ryan Singer
And then, this afternoon, it totally bit me in the ass!
I'm working on my legacy app, sprucing up the UI a bit, when I notice that at runtime, this button appears out of no where and sticks itself right in the middle of some other stuff.
A little investigation reveals that someone actually had this thought process:
"I need a new button for certain circumstances. I know, I'll take an existing button, change its caption, change its size, change its position, and attach a completely different event handler, and I"ll have exactly what I need!!"
You know, because buttons are so expensive to create.
OMG brilliant!
ReplyDeleteThat being said... the world would be a better place if someone with a time machine could go back and implement layout managers in Delphi 1...
LOL Nick you could fill the Delphi category in thedailywtf.com alone :)
ReplyDeleteHeh. but one must admit that, on a modern system, if you want to have more than a couple of millions of buttons in a UI, you should definitely consider recycling them :-)
ReplyDeleteIt doesn't take millions but rather ten thousands (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724291(v=vs.85).aspx).
ReplyDeleteJust use inappropriate GUI elements for the job (like lots of edits on panels to display a change history in a ticket system) an you soon get some out of handle error - been there seen that :)
Stefan Glienke Wow, didn't know that. Good thing you told me though, I'll reconsider my amazing new "Each pixel's a button" UI :-D
ReplyDeleteUse TSpeedButton that does not need a new handle or FireMonkey.
ReplyDeletePanagiotis Drivilas a speed button rules out keyboard interaction which makes your application a lot harder to use for quite a few categories of users.
ReplyDeleteJeroen Wiert Pluimers that's true but you can emulate keyboard interaction and focus for graphic controls by handling the proper messages.
ReplyDeleteThanks for sharing, I really like that tweet!
ReplyDeleteStefan Glienke , Nick Hodges : submitting to the Daily WTF is not a bad idea (regardless of what you think of the site these days.) Reason being, it's read by a lot of people and seeing Delphi code there - even bad Delphi code - would raise awareness of the language being out there.
ReplyDeleteDavid Millington I would have done this numerous times in the past if I were allowed to ;)
ReplyDeleteStefan Glienke Does your employer prevent you submitting content? Understandable, but a shame...
ReplyDelete