The intention of witchcraft model driven code generation tool is to help automate creation and maintenance of database driven enterprise applications. Automatic code generation using time tested design principles helps developers focus on core business development and minimizes the effort spent on boilerplate code.
Objectives
a) Generate code for different layers like view, business rules and persistence.
b) Generate tests – both unit and functional.
c) Generate code for non functional architectural requirements like security, logging, failure notifications, internationalization etc.
d) Ensure Industry best practices like code to interfaces, loose coupling.
e) Create a team collaboration environment – SCM, Build and release policies. etc
f) Support a modularized, pluggable architecture for multiplatform code generation.
The driving force behind a Witchcraft application will be an xml model file – this file can be created by a variety of sources – most preferred will be xmi export from an extended version of a UML2 /1.4 class diagram. The generated code will address following cross cutting concerns:
1. Security
2. Internationalization
3. Transaction Management
4. Extensibility
5. SOA Core
6. Multichannel Access
There will be DOM (domain object model) objects which will also act as Data Transfer objects and would be moved between the three layers mentioned above. Each application will consist of three tiers Presentation Tier : It will consist of a. Browser Tier (HTML, css, Java Script etc ) b. Server Tier (JSP, Struts, JSF, PHP, ASP etc ) Following operations will be supported on all objects (i) CRUD (Create Read Update Delete) (a) Add new /Edit Forms and success screens (b) Tabular view (ii) Search The view should work on multiple devices for instance same struts action should be used for a browser interaction as well as mobile/PDA. Business Logic Tier: (Business logic POJOs with dependency injection and AOP) All of the business methods that deal with database will be transactional. Basic validations as described in the model will be available.
Persistence tier: Will use DAO pattern and some Object Relational Mapping tool. Also will be responsible for generating database level artifacts such as constraints, stored procedures, triggers etc. Reports User should be able to specify in model the basic reports. Also support for custom reports will be provided in a later release. Test Generation Tests – Unit, Integration and functional tests will be generated. The unit tests will be self contained in that all the dependencies will be mocked. The functional tests will emulate a user entering information using a browser and a framework like HttpUnit will be used to test the system end to end. Build Script A build script for tools like ant/maven/nant etc will be generated. This build script will handle compilation, testing packaging, project health management etc. Security Basic security will be supported. There will be users and roles and different levels of privileges.
As much as possible,
security will be considered as an Aspect and the application code will
be kept separated from any security specific code. A future release
will address issues like Single Sign On. Service Oriented Architecture
All functionality other than view i.e data access and business rules
should be exposable using web services. A future release will address
enterprise service bus integration . Miscellaneous Scheduling:
Schedulable jobs can be created and executed. Messaging To facilitate
loose coupling P2P and pub sub messaging will be available from within
model. Manageability: Artifacts should have a capability to be used as
JMX Mbeans. Development environment setup: This will include creation
of wiki, Bug tracking, project management HttpFilters: Email Templates:
Some templating engine like velocity will be used to create emails
etc