Some Notes on Developing with the frostillic.us Framework
Thu Oct 09 19:23:04 EDT 2014
Now that I have a few apps under my belt, I've been getting a better idea of the plusses and minuses of my current development techniques - the frostillic.us Framework combined with stock controls + renderers. This post is basically a mostly-unordered list of my overall thoughts on the current state.
- Component binding is absolutely the way to go. This pays off in a number of ways, but just knowing that the component is pointed unambiguously at a model property - and thus getting its field type and validators from there - feels right.
- Similarly, externalizing all strings for translation via a bean or via component binding is definitely the way to go. The "standard" way of adding translation promises the ability to not have to think about it until you're ready, but the result is more of a drag.
- On the other hand, having to manually write out translation lines for every model property and enum value (e.g.
model.Task$TaskStatus.INPROGRESS=In Progress
) is a huge PITA. Eventually, it may be worth writing a tool to look for model objects in a DB and present a UI for specifying translations for each property and enum value. -
It feels like there's still too much domain knowledge required for using Framework objects. Though I try to stick with standard Java and XSP idioms as much as possible, you still have to "just know" and remember classes like
BasicXPageController
,AbstractDominoModel
(and that you should make aAbstractDominoManager
inside it), andAbstractXSPServlet
. This may be largely unavoidable - Java isn't big on implied and generated code without work. But there's enough specialized knowledge that even I've forgotten stuff like how I added support for the@Table
annotation for models to set the form.- Designer plugins could help with this, providing ways to create each class type with pre-made Java templates and potentially adding views of each class type. I don't know if I want to bother doing that, though.
@ManagedBean
is awesome and makes thefaces-config.xml
method seem archaic (even in light of my recent dabbling with the editor). The down side I can think of is that you don't have a good overview of what the beans in your app are, but that doesn't really come up as a need in reality.- The Framework and renderers work great in XPiNC. Good to know, I suppose. They are probably actually a huge boost, speed-wise, over putting a lot of code and resources in the NSF - they dramatically cut down on the network transactions required to render a page.
- Sticking with stock+ExtLib controls is mostly great. Combined with component binding, my XPages are svelte, I have comparatively few custom controls, and I haven't had to go through the laborious process of writing controls in Java.
-
On the other hand:
- Trying to write a Bootstrap app with standard components leaks like a sieve. Though there are many times when the controls match up perfectly -
xe:formTable
,xe:forumView
, etc. - the stock controls have no concept of Bootstrap's column layout, so I've had to write custom controls for that. - Some ExtLib controls are surprisingly rigid, lacking
attrs
properties or having weird interaction models like theonItemClick
event withcontext.submittedValue
on trees. I guess I could add them myself, but I don't want to get into the business of maintaining a forked ExtLib. - Trying to adapt standard code to Bootstrap+jQuery can be a huge PITA. For example, Select2 (and Chosen) don't trigger onchange event handlers written in XSP. While there are ways to work around it, they involve writing odd code that makes big assumptions about the final rendering, and avoiding that is the whole point. I have a "fix" that sort of works, but it's not ideal - it has the side effect of triggering a too-much-recursion exception on the console. There's a bunch of this sort of thing to deal with.
- Trying to write a Bootstrap app with standard components leaks like a sieve. Though there are many times when the controls match up perfectly -
- My model framework has been serving me extremely well, but some aspects feel weirder over time (like how it blurs the distinction between getting a collection vs. individual model by key). I'm still considering switching to Hibernate OGM, but adapting it would likely be a mountain of work and I'm not 100% sold on its model. Still, the idea of moving to a "real" framework is appealing.
- Using enums for fixed-value-set model properties is great.
- I don't yet have a good solution for multi-lingual data. Maybe I could use a convention like "fieldname$fr". It hasn't actually cropped up, though, so it's a theoretical issue.
- I should standardize the way I do configuration and come up with a standard "keywords" mechanism.
- Similarly, I should codify the bean-backed table into a control, since I use this all the time and end up with similar code all over the place.
- I should add specific support for using model objects as properties on other objects - both referenced by ID and potentially beans stored via MIME in the documents.
- I need to add a way to specify error messages in the model translation file. Currently it's not much better than this.
- I should really add built-in Excel exporting for collections.
- I'm going to be happy I did the REST services down the line.
Overall, it mostly feels right, and working on "normal" apps feels archaic and brittle by comparison.
Nathan T. Freeman - Thu Oct 09 19:30:38 EDT 2014
By November 19th, I'll have an alternative model framework for you that I strongly believe you'll want to work with. :)
AndreGr - Sun Nov 16 03:34:00 EST 2014
Thank you for sharing that! Re solution for multi-lingual data: I do use in my framework internal convention fo multilang fields, like "valueData", "valueData_uk", "valueData_fr". Where 1st one is default value holder for default language of the app, all other - additional languages of the app.
Showed approach is based on approach used with resource files.
Additionally, there is some logic which holds info on collection of available languages in app, multilang fields in model, and lang switcher on UI, and some additional helpers for multilang support...