By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

Automatic Code Generation

P: n/a

Someone raised the question of automatic code generation a few weeks back.

And yes, we (CCPN) are using automatic Python code generation in a major
way. Basically we are making data models in UML, and using automatic code
generation to make Python APIs, XML I/O etc. (more below). We can be found
at http://www.ccpn.ac.uk/index.html

As a general point, automtic code generation would seem like a good idea
in special cases where:

- a lot of repetitive code can be derived completely from a more compact
or problem-oriented description.
- The problem is large
- You need to keep doing new pieces of code and/or maintain several sets
of synchronized files on top of an evolving problem description
- You avoid hand-modifying the code, either because you can get 100%
automatic generation, or you can 'park' the handcoded modifications where
they are read into the automatic generation process.

Yours,

Rasmus

================================================== ========================

In case you are interested, here are some details:

We work on data models for domain-specific data storage and interchange,
making precise data specifications, libraries, XML specifications, etc.
The UML model specifies the classes, attributes and links that describe
the data. We then generate Python classes with properties and access
functions, XML mappings and schemas. We generate Python APIs and XML
storage, and are working on extending to Java and relational databases (in
progress) and C and C++ APIs (planned). All the code generation is done
with Python scripts, of course.

So far, we have:

277 classes and 2006 attributes in the data model

316000 lines of Python (mostly autogenerated) and
527000 lines of HTML documentation (mostly autogenrated)

Better than 98% autogeneration for the API.

Because we need to guarantee that data stored in the model are consistent
and conform to specifications, our Python functions check data type (yes,
we had to), arbitrarily specified constraints, data consistency, data
encapsulation, and supports notifiers so that e.g. GUIs can be notified
when underlying data change.

---------------------------------------------------------------------------
Dr. Rasmus H. Fogh Email: r.******@bioc.cam.ac.uk
Dept. of Biochemistry, University of Cambridge,
80 Tennis Court Road, Cambridge CB2 1GA, UK. FAX (01223)766002


Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.