in reply to Perl Tk - propagating events
Yes, pTk (and Perl in general) provide lots of clever ways to do things, esp. for propagating events. And they're very convenient if an app is 100 lines or less in size.
But when dealing with large scale apps, with lots of GUI components and HMI interactions, I've learned the hard way that keeping to simple disciplines is a far better solution than trying to implement every clever bit of minimalist sigilism.
I've developed a large scale IDE for database apps in Perl and pTk. At first, it was very organic: model and view were all tangled up together. That worked OK when there were 4-5 distinct HMI functions. But the logic got very convoluted after that. Ultimately, I took 3 or more big steps back and rewrote the app to completely separate the GUI from the app logic. As in isolating the View code completely, and explicitly routing all the GUI events to the model through an imperative controller interface.
No, its not sexy. And its a bit more code, It even starts looking like Java at times. It makes me cringe a bit every time I think about the overhead of passing events and responses back and forth through a Controller object.
But every time I put it away for 3 months, and then go back to do some maintenance, I can quickly dive back in. Perhaps as importantly, I'm in the process of converting everything to a browser based solution, and its much easier to focus on just the view components, and XHR all the interactions back to the model.
My advice is to avoid the pitfall of trying to be too clever. Perl and pTk provide many opportunities to use short cuts. They're great for golfing quick solutions to simple problems to impress friends and coworkers. But in the arena of large scale GUI apps, its probably best to let the right and left cranial lobes each focus on the things they do well, and implement a simple bridge between them. Within their hemispheres, feel free to minimize as much as you like; but trying to optimize by declaratively leaking GUI event dispatch into the model will eventually become a liability.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl Tk - propagating events
by vkon (Curate) on Jun 15, 2006 at 08:39 UTC | |
by renodino (Curate) on Jun 15, 2006 at 15:05 UTC | |
by vkon (Curate) on Jun 15, 2006 at 15:55 UTC | |
by TGI (Parson) on Jun 15, 2006 at 18:11 UTC |