Following are some of tips & techniques for doing code migration of your C++ application to C#:
- Conversion using Tool: One strategy can be to use some of the existing tools such as that provided by Tangible Software Solutions or sourceforge project on c++ to C# code conversion. Once the code gets migrated, you may want to look out for traps which may lead to error while code migration. Given that C# looks a lot like C++, there are areas (traps) you may want to review to make sure that code conversion took care of those so-called traps. This is not known on how effective these tools do the automated migration and you may want to check for all aspects before making up your mind for using the tool.
- Conversion using Lutz Reflector: Another strategy can be to use Reflector from Lutz Roeder. Following can be strategy:
- Compile C++ code with /CLR option.
- Load assembly into Reflector.
- Use de-compiler to get C# code.
- Manual Conversion: Yet another strategy can be to go for manual code conversion. However, this is time taking and can prove quite cumbersome if the C++ code does not adhere to code quality standards and consists of various code smells. However, one has a better visibility and control on overall code conversion process.
Common to all of the above strategies are following additional steps that can be taken to ensure minimum acceptable quality:
- Static Code Analysis: Use static code analysis tool such as FxCop to analyze the converted code and create reports on areas such such as design, localization, performance, security etc and suggest possible improvements.
- Unit Tests: Try and create unit tests around key functions in order to make sure that converted code passes the unit tests on regular basis.
- Code Review Policy & Tool: Lay down the code review policy and have the team do the code review, preferably, using the tool such as Crucible, code collaborator etc. These code review tools enhance the collaboration on code review and cut down on time taken in doing code review using emails.
- Release frequently: In any conversion project, one may want to adopt the strategy of releasing frequently in order to have business users validate the migration. Agile based development methodology such as SCRUM can prove very useful.
- Integration test frequently: A migration project may involve the migration of decomposed modules. One may want to adopt the strategy of integrating these modules on regular basis and do frequent integration testing in order to surprises at the end.
Latest posts by Ajitesh Kumar (see all)
- Mean Squared Error or R-Squared – Which one to use? - September 30, 2020
- Linear Regression Explained with Python Examples - September 30, 2020
- Correlation Concepts, Matrix & Heatmap using Seaborn - September 29, 2020