469,578 Members | 1,914 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Automatic Code Generation


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
0 2197

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Kannan Goundan | last post: by
5 posts views Thread by Abhishek Srivastava | last post: by
4 posts views Thread by Petterson Mikael | last post: by
1 post views Thread by woessner | last post: by
reply views Thread by JoshforRefugee | last post: by
25 posts views Thread by sidd | last post: by
34 posts views Thread by =?ISO-8859-1?Q?Marcel_M=FCller?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.