In my previous blogs we have discussed about diagrams, UML, design patterns, and so far we have already seen the basis of software design and and some of the uses of UML in software representation.
Now with these representations lets learn how to convert from the class design learned in the last post and turn it into code capable of running and be implemented in the system.
The only problem in trying to turn the diagrams into code is that if the diagrams are not well design or not understandable the code may be harder to code, and because diagrams are object oriented the code must be object oriented, that a must have requirement, otherwise the system must be harder to code even with the diagrams, with this the identity and functionality of the system will remain clean and keep the escence of your system.
There are some things to know before tryng to translate from classes to code:
- Know your system, know how does your system works, its capabilities, its highs and lows, what can it do or not, this because you will have to translate your system
- Know the way to translate, if you want to turn your classes into code first you need to know how are you going to do it, how are you doing it, know the paradigm and if the language supports your system capabilities
- Take advantage of the information you have, literaly it is not hard to translate your system if you know all the comunication within, and the behaviour of your system
- Know the atributes you will have to initialize in your code
- Every methods name indicates what the class must do, as an example the buy method should let the user to buy something so a product, a client must be some of its elements
- The inheritance in the system indicates how the classes communicates, the only thing you have to do is implement the design you already have
- Enjoy your coding, don’t get frustrated if the first time you try to translate it it does’t work mistakes are made by everyone so get fun coding
My own experience
Through my experience I have faced many challenges while building a project, this because sometimes you code too much instead of analysing the system you want to build, so you have something like an spaguetti code that has no head no bot, and somethimes you analyze your system too much that when you want to build your project it actually becomes very hard to code so what you wanted your system to be seems almost imposible to code, so when you analize your code just enough and start to code just the needed you system becames wxactly what you wanted and if there still some free time you can try to add a few implementations to the system.

