A case study regarding how a fairly complex learning system was developed in Plone by way of a tool that takes a UML diagram and converts it into working code.
2. Rapid Application Development in Plone Presenter: Paul Roe Company: The Virtual Limited Building Plone sites since 2002 www. the virtual .co.nz
3. People get pictures “When you talk code, logic or in abstract it hurts the head of the client and misses that rare opportunity to use the client's eyes and ears at the same time”. Steven Gourley
18. Manual Code class photodoc(BaseContent, BrowserDefaultMixin): """ """ security = ClassSecurityInfo() implements(interfaces.Iphotodoc) meta_type = 'photodoc' _at_rename_after_creation = True schema = photodoc_schema ##code-section class-header #fill in your manual code here ##/code-section class-header # Methods registerType(photodoc, PROJECTNAME) # end of class photodoc ##code-section module-footer #fill in your manual code here ##/code-section module-footer
19. Install Copy across product, restart plone and you can install in a plone site.
21. A real project Steve Gourley approached us with the plan to build a web application for his Heath and Fitness Training and Recruitment company (NZIHF).
25. Steve Gourley - NZIHF “ A significant feature in attaining a good result for us was the opportunity to see the object and its relationships to other objects” “ We had no idea the thing was then generating code, but we did know what was being talked about and therefore had a richer exploration of what we wanted in a more economic (time, which is money in development too!) way”.
26. Rapid Application Development in Plone Presenter: Paul Roe Company: The Virtual Limited Building Plone sites since 2002 www. the virtual .co.nz
Notes de l'éditeur
Hi I'm Paul from TheVirtual
I'm going to give brief introduction to using UML modelling and the ArchGenXML code generator. Quickly describe a more complicated real world web application . And then talk about some of the advantages that come with being able to use visual modelling in conjunction with ArchGenXML My hope is that you'll see the potential of these tools and give them a go.
We use ArgoUML. There are some relevant tutorials on the Plone site in the ArchGenXML howtos.
Initial ArgoUML screen. There's a UML Profile available for Archetypes which includes most of the stuff you need for getting things working.
As an example we'll subclass a Document and add a couple of fields.
Changing properties of fields, content types and relationships is easy. Select the field, Click tags and add tags to change the label, description and field level permissions etc You can add tags on the content type as well allowing permissions and many other properties to be controlled. We've set the modify permission on the field when we generate code later we'll see the label and write permissions have been set on the schema
Now we'll add a simple workflow. If you're happy with the default plone workflow you don't need to do anything as ArchGenXML takes care of that. But if you need something special adding a workflow to a content type is simple. Select the content type and add a statechart from the context menu You can also assign an existing workflow via a tag on the content type
Add workflow states and transitions, and events. Set permissions on the object and control access to the transitions
There are pros and cons of using code generation and gui tools for building applications. I've used a few systems in the past and I'm well aware of problems that can arise. Using version control on the models and generated code ensures that you understand whats going on when things are regenerated. Some of the many advantages are the reduction in boilerplate and ease of making major changes to the code base. Upgrades in Plone have also been much easier. The change to Generic Setup being one as new versions of ArchgenXML support the changes
Now we're going to generate the code, the first line invokes archgenxml. The rest is just a small part of the generated code for the schema in the content type. You can see the label and write permission on the field is set as per our model.
Throughout all the generated files there are plenty of places to put custom code which is kept across rebuilds. ArchGenXML builds the entire file structure and sets up the profiles for install and configuration
This all took about as long to explain as to actually do it! The real value of the UML diagramming and ArchGenXML comes when building something more complicated.
Its all very well being able to demo easy stuff, but how practical is it in the real world working with customers. These are a couple of the UML models from a real project.
Steve was well prepared and at our first meeting I suggested that the best way forward was to use use a GUI tool to analyse and explore the project. By collaboratively building a visual model of the application we would both better understand the project, and be able to work through any complex relationships and workflows more easily. We had regular meetings for an hour or two. With builds, extra custom code and testing done between. The previous image shows parts of that project.
There's not a lot of time to go into detail, but in this and the next few slides I'll show a few small parts that correspond to the simple demo at the start This is one of the simple workflows from the project Its reused over a few content types
This shows the permissions on a state in a training workflow. It shows who can access and change the object. The worklist tag means that when the object is in this state it appears in a review list similar to what a Reviewer would see with pending items.
This shows the properties on a transition in a workflow. Events can be fired on transitions. We setup a subscriber in the Effect Field. The subscriber in this case is fired when someone passes part of a course. This does a few checks and can change the state of their course to Passed if they've completed everything. It generates all the boiler plate for the Subscriber, just leaving the actual checks to be coded. There's a lot more to show, but that all we have time for.
Steve best sums up the advantages of UML, ArchGenXML and Plone. It really works well and the more input from the customer the better it works! Thanks – Questions? Steve is happy to talk to people he's at nzihf.co.nz