I have a situation, in which I would like your opinion about the best approach that I should take.
Let's consider 10 classes (obj001, obj002 etc.) all which represent some business entities, and are to be serialized with XML and sent via a WS to another server. Each of these classes is backed-up by a XSD schema (from which they were built). There are certain differences in their structure, so they cannot be treated all the same (eg. one may contain a table with values, another one only few static fields).
Now, I have to develop a desktop application (.net based, so either Winforms or WPF), with a distinct screen for each entity, and the following functionalities: Save to XML, Load from XML, Submit msg (send over WS), Generate document (filling a template), Validate object etc.
Methods like Generate document and Validation must be implemented differently due to the nature of the objects.
Currently I have a tabbed page control, and each page contains the data fields for a certain object. All the function buttons are common, docked to top, and based on the active page, they perform the corresponding action. The event flow works like this:
buttonSave_Clicked switch (selected_page) if obj001_page then SerializeOBJ001(); if obj002_page then SerializeOBJ002(); else ... end end
I thought of the following approaches too:
- Create buttons on each tab page (this means I would know exactly what logic to execute. But still, they are all together.
- Convert the application to WPF, and build custom controls for each object, that are totally in charge of the corresponding logic and UI - a lot of redundant code!
As an example, my obj001 class, has over 20 properties (attributes), and all are binded to textboxes in the UI, so all the validations are written and performed in the MainWindow.cs class. Moving them to a separate class would mean to pass each value as a parameter to the validator, which is quite inpractical too. Maybe switching to MVVM (and making use of the WPF's data binding) is a better solution, don't you think?
Extensibility is very poor: for each new object, I have to add a new case to each function button. And the MainWindow.cs class is getting heavier and heavier.
I'm new to software engineering. Starting from scratch, what would be the right approach? What architectural or design pattern(s) should I look into? And how should I structure my classes?