views:

77

answers:

2

Hello all as part of our application i need to build component that will output code in php and asp that have the same functionality ( and maybe latter jsp ) . how can i design this kind of component to be generic as possible ?

+1  A: 

I would personally go with the Strategy Pattern. You could have a master code maker class and instantiate it with a strategy.

PHPCodeStrategy ASPCodeStrategy

Then each would have a method called execute maybe. Bu then you could add further strategies down the line and extend your application.

Andrew

REA_ANDREW
+1  A: 

You need to be able to create a parse tree out of all input languages.

For each output language, you will need to create a set of tree transforming grammar.

You may also require a runtime library to help translate routines that are not available in your output language.

Unknown
The input will be GUI not some language i need to parse