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
●
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);
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
–
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
●