To attain the highest grade in a recent piece of coursework I'm asked to 开发者_开发知识库develop a specific application using c++ and multi-tier programming.
I understand the theory behind multi-tier architecture and exactly which parts of this application belong to which layer but i have no experience actually implementing "n-tier" applications.
Do the tier have to be fully separated? for example one process running a database, one process running a UI and a third managing interactions between the two?
Or is it just as simple as separating the application into layers of code so that the GUI does not directly access the database etc..
Any tips you have for multi-tier programming in C++ will be greatly appreciated :)
Usually, when you hear "n-tier" application framework (in college), they are referring to logically grouped functionality. It can be in separate processes, but is not necessarily the case. The Model-Control-View architecture or MFC's Document-View architecture are both layered. You simply want to separate code that stores/reads data from business rules of your application from how that information is displayed.
NOTE: There are some that consider "n-tier" to be a client-server setup, but as this is coursework, I doubt seriously your professor wants that as his solution).
One method of communication between processes is to use pipes. Another is shared memory. Yet another is boost's IPC (pretty sure it has one anyway).
There's lots. IPC (interprocess communication) is the key search term.
College professors often have requirements that don't really match up with the real world. As your grade depends on it, I highly recommend asking your professor what he means.
In the real world, you don't have to physically separate the tiers into their own processes to call it a multitier architecture, but if it is ever required, it shouldn't be difficult to change it to do so. For example, if you change from using a local database to a remote database, only the database layer implementation should have to change.
精彩评论