Automatic Code Generation

Discussion in 'Python' started by Rasmus Fogh, Oct 5, 2003.

  1. Rasmus Fogh

    Rasmus Fogh Guest

    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:
    Dept. of Biochemistry, University of Cambridge,
    80 Tennis Court Road, Cambridge CB2 1GA, UK. FAX (01223)766002
    Rasmus Fogh, Oct 5, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasmus Fogh

    Re: Automatic Code Generation

    Rasmus Fogh, Oct 6, 2003, in forum: Python
    Replies:
    1
    Views:
    306
    John J. Lee
    Oct 6, 2003
  2. JoshforRefugee

    help with automatic code generation

    JoshforRefugee, Jan 31, 2007, in forum: C++
    Replies:
    0
    Views:
    400
    JoshforRefugee
    Jan 31, 2007
  3. JoshforRefugee

    help with automatic code generation

    JoshforRefugee, Jan 31, 2007, in forum: C++
    Replies:
    6
    Views:
    309
    JoshforRefugee
    Feb 1, 2007
  4. fpga_designe

    Automatic VHDL generation from C code

    fpga_designe, May 15, 2009, in forum: VHDL
    Replies:
    1
    Views:
    680
    fpga_designe
    May 15, 2009
  5. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    319
    John W. Long
    Nov 24, 2003
Loading...

Share This Page