The making of an object model for Tikz
The making of an object model for Tikz
By Vincent Pit (vincent) from Paris.pm
Date: Thursday, 5 August 2010 10:00
Duration: 20 minutes
Target audience: Any
Language: English
Tags: code generation latex model moose object optimization overloading
My PhD thesis requires me to draw a lot of geometrical figures based on points computed by a Perl program. Since those figures are to be included in a LaTeX document, the natural tool to use is TikZ (http://pgf.sourceforge.net/), a LaTeX package that provides a sublanguage for generating graphics. But given the complexity of my drawings, the code has to be generated, so the best way to solve the problem on the long term was to write an object model to cleanly generate TikZ code from Perl. Started as a one-file quick hack of classes, it became eventually a full featured Moose app and was released on CPAN as LaTeX::TikZ.
I'll cover some of the aspects of its development :
- The design of the object model for simplicity (unification of different TikZ concepts) and maintainability.
- How it allows simplifications and optimizations of the TikZ object code.
- Where Moose brought added value to the initial design.
- Integration with a set of existing classes.
- If there's some time left, the optimization of the Perl code itself, with Devel::NYTProf.
Attended by: Steffen Schwigon (renormalist), Steffen Mueller, John Scoles (byterock), Clinton Gormley (DrTech), Karl Moens (CountZero), Vincent Pit (vincent), Reini Urban (rurban), Lars Dɪᴇᴄᴋᴏᴡ (daxim), Shmuel Fomberg, Tim Bunce, simotrone, Franck Cuny, Joel Bernstein (joel), Adde Nilsson, Herbert Breunung (lichtkind), Sébastien Aperghis-Tramoni (maddingue),