Reducing the Cost of Software Development in Automotive Industry using CODE GENERATORS

Reducing the Cost of Software Development in Automotive Industry using CODE GENERATORS

What is a Code Generator?

Code Generator

A code generator is a tool that converts a Platform Independent Model(PIM) to a Platform Specific Model (PSM). The whole process of conversion is called Model Driven Development. Say for instance, If you are drawing a flowchart in a tool- the flow chart is not dependent on any particular model, so the flowchart is called- Platform Independent Model. If the tool you are using is able to convert the flowchart directly into a Python Code or JAVA code (Platform Specific), then the tool is working like a code generator. We might have been using code generators in our lives without knowing that we are using a code generator. Possible Inputs to a code generator can be a DSL, Code in other formats, wizard or data sources.

How does a Code Generator Work?

So how does a code generator work. As discussed, a code generator converts a Platform Independent Model to a Platform Specific Model. Lets break it into smaller pieces. A code generator will have a Class, Model and a Template. In the class, also called as Class name, we will have all the attributes of the class defined. For example, all the classes may be defined as a tabular column, or a flowchart or or a database file or any other format. The user can use the tabular column/flowchart and define the value for the objects of the class. This process is called MODEL. Then there is a template. The template will have the rules of the particular platform. Once the user provides the values for the objects then the the code generator will generate the code (PYTHON,JAVA etc) for the particular use case.

A typical code generator looks like this

A typical code generator

A code generator has a PIM . The Input to the the PIM can be in different forms like a database file or any other input format that was defined earlier. The Generator Model will be constructed once all the values for the objects in the class are defined. The Engine in the code generator will use the Template ( the rules of the platform) and the values from the Generator model to construct the code in the platform that is specified by the user.

Why do we need Code generators?

The reason to use code generation are fundamentally four: productivity, simplification, portability, and consistency.

With code generation you write the generator once and it can be reused as many times as you need. Providing the specific inputs to the generator and invoking it is significantly faster than writing the code manually, therefore code generation permits to save time.

With code generation you generate your code from some abstract description. It means that your source of truth becomes that description, not the code. That description is typically easier to analyze and check compared with the whole generated code.

Once you have a process to generate code for a certain language or framework you can simply change the generator and target a different language or framework. You can also target multiple platforms at once

With code generation you get always the code you expect. The generated code is designed according to the same principles, the naming rule match, etc

Role of Code Generators in Automotive Industry

Code generators effectively bring down the cost of the software development and testing in all industries. However, it play a very vital role in bringing down the cost of the software development in the Automotive Industry. Code generator tools help to generate a large amount of code by the use of a configuration GUI. These tools allow the software developers to produce massive amounts of code using less effort.
Code generators are used in many stages during the software development life-cycle of the ECU. One of the development sector where the code generator are widely used, is to generate the basic software in ECUs.
Second, using a tool to generate a different code types, and using a code generator with high usability can help to reduce the effort of development. Using code generators could help to identify and correct large number of defects, before the C/C++ code is generated and run on the target hardware.
Third, Code Generators also play vital role in testing. The developer and tester needs to only modify the model diagram and regenerate the code. There is no need to write manual test cases. Ultimately, these benefits can result in reduced development and testing time and ofcourse reduction in software development and maintenance costs.
There are several methods used to estimate the cost of the software. One of widely used method is COCOMO (COnstructive COst MOdel). Research has clearly shown that Code Generators have helped to decrease the cost of software development by at least 15% in Automotive Industry and the cost reduction increases dramatically with more Line of Codes and increased complexity levels ( Cost estimation was done using the COCOMO model). Cost reductions of upto 200% have also been demonstrated in many projects where the complexity levels are high.

Leave a Comment

Shopping Cart
WhatsApp chat