I've recently created my first c# desktop application. It simulates data exchange. The application stores and reads data from two text files. When using this application, user must first login by entering username and password. The application then reads the first text file whic开发者_如何学Pythonh contains all usernames and passwords. Login is successful if that username and password is found in the first text file. After the login, user can enter data in the text box. That data is saved in the other text file. My question is can I define this software architecture as MVC?
The problem with the definition that you've given is that it defines WHAT your application does but not necessarily how it's structured. The concept behind MVC is developing code that isolates different interests.
- Your presentation layer is concerned with displaying information to the user.
- Your model is concerned with handling data.
- Your controller is concerned with handling the plumbing between the other two.
The reasons for this are primarily to aid in testing and maintenance of the code. For some information on what MVC is, you might want to look at the Wikipedia page on MVC.
I'm not sure I understand the question.
If you meant: "Does this conform to the MVC pattern?" then the answer is we can't tell you because you haven't defined how the code is laid out.
If you meant: "Can I implement the MVC pattern for this software application?" then the answer is yes. You can if you want to if you haven't already. But if you have it working already, why change it unless you're going to be releasing it as a production system that you're going to be maintaining for a long period of time?
You can structure your architecture as MVP by following this series of blogs @ http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx if you're building a winforms desktop app
精彩评论