SlideShare a Scribd company logo
1 of 39
wxPerl
Agile Cross-Platform GUI Development
 (What I had to Learn the Hard Way)




           Eric Wilhelm
       Scratch Computing
  http://scratchcomputing.com
wxPerl
    bindings for wxWidgets GUI toolkit
●



    multi-platform
●



    native widgets
●



    object-oriented
●



    event driven
●
wxWidgets platforms
    Win32
–

    Mac OS X
–

    GTK+
–

    X11
–

    Motif
–

    WinCE
–

    and more
–
Windows
Linux
Mac
Why Desktop Apps?
    local machine resources
●


        large files
    –

        soundcard
    –

        cpu
    –

    private data
●



    encryption
●



    airplanes
●
Why Perl?
    freedom from
●


        static code
    –

        compilers
    –

        quot;cross-platform reinvention of string
    –
        librariesquot;
    easier reuse
●


        common (e.g. company-wide) modular
    –
        code
        web apps
    –

        command-line apps
    –
The “Wx” distribution (aka
            wxPerl)
    wraps wxWidgets in XS and some Perl
●



    332K tarball
●



    breakdown:
●


      xs:          ~21680 (57.42%)
      perl:          8685 (23.00%)
      cpp:           7395 (19.58%)
      xsp:          ~1662
    note: SLOCCOUNT doesn't really speak XS

    but very little documentation
●
Compare to WxGTK
                         (i.e. core+gtk port)

    6.9M of C++                                               !
●
                                                     20x21k

      cpp:         416710 (77.09%)
     ansic:       112754 (20.86%)
     sh:           10026 (1.85%)
     python:         645 (0.12%)
     lex:            194 (0.04%)
     yacc:           128 (0.02%)
     pascal:          74 (0.01%)
     lisp:             6 (0.00%)
    generated using David A. Wheeler's 'SLOCCount'
dotReader
           open-source e-book reader in Perl

    read, annotate, and search books
●



    browse the web, send mail, etc
●



    shared annotations
●



        online/offline network fun
    –

    DRM (makes publishers happy)
●



    flexible, environment-agnostic architecture
●



    open source
●



    plugins, plugins, plugins
●
dotReader details
    today's raw numbers     (Jun. 25th, 2007)
●


    13K SLOC
    98 modules + ~1200 line Build subclass
    drop-in distributions
●



        linux/qdos - PAR
    –

        mac - PerlWrapper + ExtUtils::MacMaker
    –

    embedded html widgets
●



        IE (activeX)
    –

        Webkit
    –

        Mozilla
    –
Getting Started with wxPerl
              Finding Documentation
    wxPerl specific
●



        a slow wiki (somebody please make a US
    –
        mirror)
        not much pod
    –

        some perlmonks stuff
    –

        demo directory
    –

    C++ documentation
●



    C++ examples
●



    wxGlade
●
Cross-platform Development
                    (aka fun with vnc)

    svk and working copy on linux workstation
●



         more and better tools
     –

         80% or more development is command-line
     –

          tests
          ●


        ● small utilities


        ● good discipline


        ● good for architecture


    rsync+fam
●



    rdesktop/vnc to windows+cygwin
●



    vnc to mac
●
Cross-platform Builds
    automate
●



    automate
●



    automate
●



    Module::Build
●



    CPDK + remote ssh automation
●



    nightly builds
●



    cross-platform repackaging from linux
●
Installation
    (aka fun with make/nmake/bake/shake/quake)

    Linux
●



        debian (sarge, etch)
    –

    Windows
●



        camelpack + sourceforge PPMs
    –

           ExtUtils::FakeConfig
         ●


        Strawberry
    –

    Mac
●



        xcode
    –

        cpan
    –
wxGlade
BAD
code generation and why it is (maybe) a good idea


    XRC (speed?)
●



    segregate generated code
●



    have a consistent environment
●



        windows vs linux, glade versions
    –

    use version control!
●



        use subversion
    –

    have to make it be valid (strict) Perl
●



        stupid regular expressions do the trick
    –
Getting Past Getting Started
    copy and paste is evil
●



    strive for deep clarity, not superficial
●



    don't ape glade
●



    don't ape C++
●



    don't even ape the examples
●
Leaving “Getting Started”
           Way Behind
    modularity
●



    subclassing
●



    traits
●



    CMT / POE for responsiveness
●



    subprocesses
●



    discipline
●



         as always, but particularly because we don't
     –
         have “best practices” in this realm yet
Eliminating Tabular Code
       EVT_MENU( $self, 5007, sub {$_[0]­>activate_sidebar($_[1])});
       EVT_MENU( $self, 5011, sub {$_[0]­>activate_reader($_[1])});
       ...
       my $acc_table = Wx::AcceleratorTable­>new(
         [0,             WXK_F2,   5007, ], # activate sidebar
         [0,             WXK_F3,   5011, ], # activate widget
         ...
       );
       $self­>SetAcceleratorTable($acc_table);


my $acc_table = Wx::AcceleratorTable­>new(
  map({$self­>_accel(@$_)}
    ['F2',     sub {$_[0]­>activate_sidebar($_[1]);}],
    ['F3',     sub {$_[0]­>activate_reader($_[1]); }],
    ...
  ),
);
$self­>SetAcceleratorTable($acc_table);
needs Perlin'
...
if($stroke =~ s/^(.*)+//) {
  my $mk = 'wxACCEL_' . $1;
  Wx­>can($mk) or croak(quot;cannot find modifier key $mkquot;);
  $mod = Wx­>$mk;
}
...
if($kl > 1) {
  my $key_const = 'WXK_' . $key;
  Wx­>can($key_const) or croak(quot;cannot find keyquot;);
  $key = Wx­>$key_const;
}
else {
  # it's a letter
  $key = ord(uc($key));
}

my $id = Wx::NewId;
Wx::Event::EVT_MENU($self, $id, $subref);
return([$mod, $key, $id]);
More Perlification
    can() doesn't work right
●



    wxPerl::Constructors
●



    wxPerl::Styles
●



    wxPerl::Lay_er_outer ???
●
What we really want is a
           better wxGlade?
    stealing ideas from smalltalk
●



        (without losing unixness)
    –

    named objects and accessors
●



    DSL / YAML
●



    read + write and in-process dynamicism
●



    procedural / config-integration
●



    and/or code-snippet insertion?
●
Other Thoughts
    menu introspection
●                        (WxPerl::MenuMaker)


    event driven OOP
●



        break into small pieces (e.g.
    –
        backend_file_open)
    callbacks
●



        closures
    –

        method calls
    –

        NOT &subname, please
    –

    accessors
●



    Needs more Perlin' -- WxPerl/foo.pm
●
Wx::Perl/wxPerl Modules on
              CPAN
    wxPerl::Constructors
●



    wxPerl::Styles
●



    Wx::Perl::Throbber
●



    Wx::Perl::ProcessStream
●



    Wx::Perl::Imagick
●



    Wx::TreeListCtrl
●
Browser Widgets
    wxMozilla / Wx::Mozilla
●


        my eyes are bleeding!
    –

    Wx::WebKit
●



    Wx::ActiveX
●


        move along, nothing to see here
    –

    wxWebCore / Wx::WebCore
●


        Apple's Objective-C experiment (take 2)
    –

        cross-platform
    –

        “The Future”
    –
Logger
    Log::Log4perl
●



        dynamically configurable
    –

        init_and_watch
    –

        SIGHUP
    –

    insanely configurable
●



        5 levels
    –

        any depth of 'class' hierarchy
    –

        levels are even implicit classes
    –

        don't get carried away here
    –
wrap it
    not
●


    $logger = Log::Log4perl­>get_logger('blahblahblah');
    $logger­>debug('foo');

    just returns a singleton, so:
●


    use dtRdr::Logger;
        L - logging in caller() package
    –

          L­>debug('foo');
        RL - arbitrary logging
    –

    trapping
●



        $SIG{__WARN__}, logging to file
    –

        trapping $SIG{__DIE__}      (popup)
    –
Testing
    ./Build test
●



    standard tests
●



        300 lines of custom test-support code
    –

        3200 5400 lines of regular tests
    –

        only 400 600 of that is gui
    –

                               t/location   1
    t             5
                               t/logger     2
    t/_gui        9
                               t/multitask  3
    t/annotation  8
                               t/plugins    3
    t/book       34
                               t/range      1
    t/config      4
                               t/search     3
    t/_sync       5
                               t/toc        5
    t/history     3
                               t/user       1
    t/library     3
Building
    make a custom Module::Build class
●



        (not with a HEREdoc)
    –

    Custom targets
●



        ./Build par
    –

        ./Build starter_data
    –

        ./Build books
    –

        ./Build binpush
    –

        ./Build bindistribute
    –
Testing
    ./Build testall
●



        'test', 'testsync', and 'testgui'
    –

    ./Build testgui
●



        is t/_gui/*.gt + Module::Build hack
    –
Packaging and Deployment
    Windows and Linux
●



        PAR
    –

             (Wx::ActiveX hack)
         ●


             bundle the dlls, etc -- no dependencies for
         ●


             user
             a bit slow to rebuild
         ●


             startup speed needs work here
         ●


    Mac
●



        needs an AppBundle
    –
PerlWrapper (Mac)
    wxPerl (appbundle)
●



        required to even get a working GUI
    –

        compiled with xcode, resource file, etc
    –

        automated tests work fine, but no focus
    –
        before click
    PerlWrapper
●



        a perl interpreter embedded in a compiled C
    –
        app
        allows quot;open myAppquot; from command-line
    –

    ExtUtils::MacMaker
●



        uh, no I don't run xcode on dos and linux
    –
No really! Testing
    ./Build testgui
●



    outside-in
●



        X11::GUITest
    –

        Win32::GuiTest
    –

    inside-out
●



        EVT_IDLE
    –

        Wx::Timer
    –

        DISPLAY=localhost:3 ./Build testall
    –
Manual Testing
    just hacks:
●



        Ctrl+Shift+F5 does Module::Refresh
    –

        F7 quick window resize (to see console)
    –

    production stuff
●



        Ctrl+L activate library pane
    –

        F2/F3 focus switch
    –

    command-line options or parameters
●



        ./run test_packages/foo/book.xml
    –

    dual-purpose tests
●



        perl -Ilib t/_gui/note_editor.gt foo
    –
Acceptance Tests
    ala data-driven testing
●



    scripted manual verifications
●



    automate actions as much as possible
●



    still need better GUI test frameworks
●
Questions?
Thanks
    scratchcomputing.com
●



    wxperl.sourceforge.net
●



    dotreader.com
●

More Related Content

What's hot

Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10Arto Santala
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgePuppet
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Camilo Alvarez Rivera
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsersjeresig
 
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, PuppetPuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, PuppetPuppet
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency ManagerUjjwal Ojha
 
Splash screen for Embedded Linux 101: How to customize your boot sequence
 Splash screen for Embedded Linux 101: How to customize your boot sequence Splash screen for Embedded Linux 101: How to customize your boot sequence
Splash screen for Embedded Linux 101: How to customize your boot sequencePierre-jean Texier
 
4. open mano set up and usage
4. open mano set up and usage4. open mano set up and usage
4. open mano set up and usagevideos
 
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppet
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdownLarry Cai
 
Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldFrank Hunleth
 
Server::Starter meets Java
Server::Starter meets JavaServer::Starter meets Java
Server::Starter meets JavaTokuhiro Matsuno
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPMax Romanovsky
 
Defcon - Veil-Pillage
Defcon - Veil-PillageDefcon - Veil-Pillage
Defcon - Veil-PillageVeilFramework
 

What's hot (20)

Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet Forge
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Fastlane - ATC 2016
Fastlane - ATC 2016Fastlane - ATC 2016
Fastlane - ATC 2016
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
Swoole Love PHP
Swoole Love PHPSwoole Love PHP
Swoole Love PHP
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
 
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, PuppetPuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
 
Splash screen for Embedded Linux 101: How to customize your boot sequence
 Splash screen for Embedded Linux 101: How to customize your boot sequence Splash screen for Embedded Linux 101: How to customize your boot sequence
Splash screen for Embedded Linux 101: How to customize your boot sequence
 
4. open mano set up and usage
4. open mano set up and usage4. open mano set up and usage
4. open mano set up and usage
 
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdown
 
Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled World
 
Server::Starter meets Java
Server::Starter meets JavaServer::Starter meets Java
Server::Starter meets Java
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHP
 
Defcon - Veil-Pillage
Defcon - Veil-PillageDefcon - Veil-Pillage
Defcon - Veil-Pillage
 

Similar to Agile Cross-Platform GUI Development with wxPerl

Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMySQLConference
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Zabbix
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xrkr10
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureJérôme Petazzoni
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppetelliando dias
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsTobias Oetiker
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Libraryjeresig
 
Deep learning - the conf br 2018
Deep learning - the conf br 2018Deep learning - the conf br 2018
Deep learning - the conf br 2018Fabio Janiszevski
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with PuppetKris Buytaert
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Docker, Inc.
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013dotCloud
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDTBastian Feder
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Prajal Kulkarni
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructureSergiy Kukunin
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabMichelle Holley
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Bastian Feder
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Community
 

Similar to Agile Cross-Platform GUI Development with wxPerl (20)

Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With Maatkit
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
 
Deep learning - the conf br 2018
Deep learning - the conf br 2018Deep learning - the conf br 2018
Deep learning - the conf br 2018
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDT
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph
 
Capistrano2
Capistrano2Capistrano2
Capistrano2
 

More from oscon2007

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5oscon2007
 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifmoscon2007
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashearsoscon2007
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swposcon2007
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Mythsoscon2007
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholisticoscon2007
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillipsoscon2007
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdatedoscon2007
 

More from oscon2007 (20)

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5
 
Os Borger
Os BorgerOs Borger
Os Borger
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifm
 
Os Bunce
Os BunceOs Bunce
Os Bunce
 
Yuicss R7
Yuicss R7Yuicss R7
Yuicss R7
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
 
Os Fogel
Os FogelOs Fogel
Os Fogel
 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashears
 
Os Tucker
Os TuckerOs Tucker
Os Tucker
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
 
Os Furlong
Os FurlongOs Furlong
Os Furlong
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Myths
 
Os Kimsal
Os KimsalOs Kimsal
Os Kimsal
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholistic
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillips
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdated
 

Recently uploaded

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Agile Cross-Platform GUI Development with wxPerl

  • 1. wxPerl Agile Cross-Platform GUI Development (What I had to Learn the Hard Way) Eric Wilhelm Scratch Computing http://scratchcomputing.com
  • 2. wxPerl bindings for wxWidgets GUI toolkit ● multi-platform ● native widgets ● object-oriented ● event driven ●
  • 3. wxWidgets platforms Win32 – Mac OS X – GTK+ – X11 – Motif – WinCE – and more –
  • 6. Mac
  • 7. Why Desktop Apps? local machine resources ● large files – soundcard – cpu – private data ● encryption ● airplanes ●
  • 8. Why Perl? freedom from ● static code – compilers – quot;cross-platform reinvention of string – librariesquot; easier reuse ● common (e.g. company-wide) modular – code web apps – command-line apps –
  • 9. The “Wx” distribution (aka wxPerl) wraps wxWidgets in XS and some Perl ● 332K tarball ● breakdown: ●   xs:          ~21680 (57.42%)   perl:          8685 (23.00%)   cpp:           7395 (19.58%)   xsp:          ~1662 note: SLOCCOUNT doesn't really speak XS but very little documentation ●
  • 10. Compare to WxGTK (i.e. core+gtk port) 6.9M of C++ ! ● 20x21k cpp:         416710 (77.09%)  ansic:       112754 (20.86%)  sh:           10026 (1.85%)  python:         645 (0.12%)  lex:            194 (0.04%)  yacc:           128 (0.02%)  pascal:          74 (0.01%)  lisp:             6 (0.00%) generated using David A. Wheeler's 'SLOCCount'
  • 11. dotReader open-source e-book reader in Perl read, annotate, and search books ● browse the web, send mail, etc ● shared annotations ● online/offline network fun – DRM (makes publishers happy) ● flexible, environment-agnostic architecture ● open source ● plugins, plugins, plugins ●
  • 12. dotReader details today's raw numbers (Jun. 25th, 2007) ● 13K SLOC 98 modules + ~1200 line Build subclass drop-in distributions ● linux/qdos - PAR – mac - PerlWrapper + ExtUtils::MacMaker – embedded html widgets ● IE (activeX) – Webkit – Mozilla –
  • 13. Getting Started with wxPerl Finding Documentation wxPerl specific ● a slow wiki (somebody please make a US – mirror) not much pod – some perlmonks stuff – demo directory – C++ documentation ● C++ examples ● wxGlade ●
  • 14. Cross-platform Development (aka fun with vnc) svk and working copy on linux workstation ● more and better tools – 80% or more development is command-line – tests ● ● small utilities ● good discipline ● good for architecture rsync+fam ● rdesktop/vnc to windows+cygwin ● vnc to mac ●
  • 15. Cross-platform Builds automate ● automate ● automate ● Module::Build ● CPDK + remote ssh automation ● nightly builds ● cross-platform repackaging from linux ●
  • 16. Installation (aka fun with make/nmake/bake/shake/quake) Linux ● debian (sarge, etch) – Windows ● camelpack + sourceforge PPMs – ExtUtils::FakeConfig ● Strawberry – Mac ● xcode – cpan –
  • 18. BAD code generation and why it is (maybe) a good idea XRC (speed?) ● segregate generated code ● have a consistent environment ● windows vs linux, glade versions – use version control! ● use subversion – have to make it be valid (strict) Perl ● stupid regular expressions do the trick –
  • 19. Getting Past Getting Started copy and paste is evil ● strive for deep clarity, not superficial ● don't ape glade ● don't ape C++ ● don't even ape the examples ●
  • 20. Leaving “Getting Started” Way Behind modularity ● subclassing ● traits ● CMT / POE for responsiveness ● subprocesses ● discipline ● as always, but particularly because we don't – have “best practices” in this realm yet
  • 21. Eliminating Tabular Code   EVT_MENU( $self, 5007, sub {$_[0]­>activate_sidebar($_[1])});   EVT_MENU( $self, 5011, sub {$_[0]­>activate_reader($_[1])});   ...   my $acc_table = Wx::AcceleratorTable­>new(     [0,             WXK_F2,   5007, ], # activate sidebar     [0,             WXK_F3,   5011, ], # activate widget     ...   );   $self­>SetAcceleratorTable($acc_table); my $acc_table = Wx::AcceleratorTable­>new(   map({$self­>_accel(@$_)}     ['F2',     sub {$_[0]­>activate_sidebar($_[1]);}],     ['F3',     sub {$_[0]­>activate_reader($_[1]); }],     ...   ), ); $self­>SetAcceleratorTable($acc_table);
  • 23. More Perlification can() doesn't work right ● wxPerl::Constructors ● wxPerl::Styles ● wxPerl::Lay_er_outer ??? ●
  • 24. What we really want is a better wxGlade? stealing ideas from smalltalk ● (without losing unixness) – named objects and accessors ● DSL / YAML ● read + write and in-process dynamicism ● procedural / config-integration ● and/or code-snippet insertion? ●
  • 25. Other Thoughts menu introspection ● (WxPerl::MenuMaker) event driven OOP ● break into small pieces (e.g. – backend_file_open) callbacks ● closures – method calls – NOT &subname, please – accessors ● Needs more Perlin' -- WxPerl/foo.pm ●
  • 26. Wx::Perl/wxPerl Modules on CPAN wxPerl::Constructors ● wxPerl::Styles ● Wx::Perl::Throbber ● Wx::Perl::ProcessStream ● Wx::Perl::Imagick ● Wx::TreeListCtrl ●
  • 27. Browser Widgets wxMozilla / Wx::Mozilla ● my eyes are bleeding! – Wx::WebKit ● Wx::ActiveX ● move along, nothing to see here – wxWebCore / Wx::WebCore ● Apple's Objective-C experiment (take 2) – cross-platform – “The Future” –
  • 28. Logger Log::Log4perl ● dynamically configurable – init_and_watch – SIGHUP – insanely configurable ● 5 levels – any depth of 'class' hierarchy – levels are even implicit classes – don't get carried away here –
  • 29. wrap it not ● $logger = Log::Log4perl­>get_logger('blahblahblah'); $logger­>debug('foo'); just returns a singleton, so: ● use dtRdr::Logger; L - logging in caller() package – L­>debug('foo'); RL - arbitrary logging – trapping ● $SIG{__WARN__}, logging to file – trapping $SIG{__DIE__} (popup) –
  • 30. Testing ./Build test ● standard tests ● 300 lines of custom test-support code – 3200 5400 lines of regular tests – only 400 600 of that is gui – t/location   1 t             5 t/logger     2 t/_gui        9 t/multitask  3 t/annotation  8 t/plugins    3 t/book       34 t/range      1 t/config      4 t/search     3 t/_sync       5 t/toc        5 t/history     3 t/user       1 t/library     3
  • 31. Building make a custom Module::Build class ● (not with a HEREdoc) – Custom targets ● ./Build par – ./Build starter_data – ./Build books – ./Build binpush – ./Build bindistribute –
  • 32. Testing ./Build testall ● 'test', 'testsync', and 'testgui' – ./Build testgui ● is t/_gui/*.gt + Module::Build hack –
  • 33. Packaging and Deployment Windows and Linux ● PAR – (Wx::ActiveX hack) ● bundle the dlls, etc -- no dependencies for ● user a bit slow to rebuild ● startup speed needs work here ● Mac ● needs an AppBundle –
  • 34. PerlWrapper (Mac) wxPerl (appbundle) ● required to even get a working GUI – compiled with xcode, resource file, etc – automated tests work fine, but no focus – before click PerlWrapper ● a perl interpreter embedded in a compiled C – app allows quot;open myAppquot; from command-line – ExtUtils::MacMaker ● uh, no I don't run xcode on dos and linux –
  • 35. No really! Testing ./Build testgui ● outside-in ● X11::GUITest – Win32::GuiTest – inside-out ● EVT_IDLE – Wx::Timer – DISPLAY=localhost:3 ./Build testall –
  • 36. Manual Testing just hacks: ● Ctrl+Shift+F5 does Module::Refresh – F7 quick window resize (to see console) – production stuff ● Ctrl+L activate library pane – F2/F3 focus switch – command-line options or parameters ● ./run test_packages/foo/book.xml – dual-purpose tests ● perl -Ilib t/_gui/note_editor.gt foo –
  • 37. Acceptance Tests ala data-driven testing ● scripted manual verifications ● automate actions as much as possible ● still need better GUI test frameworks ●
  • 39. Thanks scratchcomputing.com ● wxperl.sourceforge.net ● dotreader.com ●