12.01.2013 Views

JavaFX in Action - Manning Publications

JavaFX in Action - Manning Publications

JavaFX in Action - Manning Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduc<strong>in</strong>g <strong>JavaFX</strong><br />

thirteen answers, but let me (your humble author) risk suggest<strong>in</strong>g a couple of prime<br />

suspects:<br />

■ UIs generally require quite large nested data structures: trees of elements, each<br />

provid<strong>in</strong>g a baffl<strong>in</strong>g array of configurable options and behaviors. Figure 1.1<br />

demonstrates the hierarchy with<strong>in</strong> a typical desktop application: controls laid<br />

out with<strong>in</strong> panels, panels nested with<strong>in</strong> other panels (tabbed panes, for example),<br />

ultimately held with<strong>in</strong> w<strong>in</strong>dows. Procedural languages like to work <strong>in</strong><br />

clearly del<strong>in</strong>eated steps, but this l<strong>in</strong>ear pattern conflicts with the tree pattern<br />

<strong>in</strong>herent <strong>in</strong> most GUIs.<br />

■ Graphics code tends to rely heavily on concurrency—processes runn<strong>in</strong>g <strong>in</strong> parallel.<br />

Modern UI fashions have amplified this requirement, with several transition<br />

effects often runn<strong>in</strong>g with<strong>in</strong> a s<strong>in</strong>gle <strong>in</strong>terface simultaneously. The<br />

boilerplate code demanded by many languages to create and manage these animations<br />

is verbose and cumbersome.<br />

Perhaps you can th<strong>in</strong>k of other problems, but the above two I mentioned (at least <strong>in</strong><br />

my experience) seem to create more than enough trouble between them. It’s deep,<br />

fundamental problems like these that a doma<strong>in</strong>-specific language can best address.<br />

Figure 1.1 A complex GUI typical of modern desktop applications. Two w<strong>in</strong>dows host scroll<strong>in</strong>g<br />

control palettes, while another holds an editable image and rulers.<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!