oop - Where do I instantiate my Objects in CRUD n-Tiered WinForm App? -
Say that I have WinForm CRUD (like) application I want to follow best practices on this, so I try And I want to follow the OOP and N-Tierd design.
Unfortunately I am familiar with words but not their practice. So go with the following example: My Case Note Program I have a tabbed app, where you go to the Search tab to search for a member and then to make a new case note to go to the Cesanot tab for an option. Look at current cessnotes, or follow Cessnot for a parent. All this is for the member you choose from the Search tab.
So if I am creating objects and using them in various forms to go around, then where do I want to interrogate them? I thought I would have 3 layers; UI, Object, DAL, where I fall flat, where I give examples of Theo objects, I can not give them examples in the object layer, am I? Also, if I write them on the form how can I pass them in a bigger app by form?
CaseNotes Screen Shot
If you want to see some more words around this problem, you can use MVP and MVC wants to see. (This stand for model view controller and model view presenter) Some people shot me to say this but they are quite similar in concept.
The purpose of MVP and MVC is to allow you to design your application logic despite thinking about your application. It also allows you to define your user interaction without applying the actual GUI. Specifically your model is your application logic, your data, your classes that actually work as you talk to your database, your presenter or controller is the one who contacts your model and who controls your user interface And responds to the user's operation on the interface. Finally your view is your unique design or your web page.
I'm sure you will be able to find a lot of content on this web but inform and explain your studies to give you some solid support with this problem.
Everything you need to do is start making your objects that represent your data. So you will have a Kesnot object that includes the cassonot data. You will have a case note data container such as case note database, you can define logical operations and their properties such as real objects.
Then you will proceed to define your presenter or controller, which you want to support with the GUI. At the same time you should define an interface that will define for the presenter / controller who can perform operations on the GUI. Therefore, for example, your presenters can expose a method known as PhosseansNot, which takes a string parameter. Your visual interface will expose a method known as DisplaySynSnot. When a user clicks the search button, the viewer passes through the order, which will then call the model to get the data. The presenter can format the data at this point, i.e. converts the date time object into a string, and then lets view the data back through the interface definition method, called DisplaySyzNot.
You do not have to use the view interface, you can call directly in the scene, but having an interface means that you can have many different visual implementations.
The last thing is that I need to know where you make these different parts of your application. Everything should be done with the presenter / controller, so when you start the application, this presenter / controller creates an object which then displays and displays the view itself as a variable. The presenter / administrator can then either launch the model by loading them from the disk or they can search through dependency injection containers like unity. It is probably a better idea to use the unity to actually see the implementation of the implementation because it gives you the right separation between the view and the presenter / controller. When you come to another view, (ie open another window), then your presenter / administrator should display a method such as DisplayDetailPage which makes a call when a button is clicked. This will make the presenter / controller for the next scene which alternates make the scene and get the reference of the model.
Hope it helps.
Comments
Post a Comment