Ok so lets see if i can explain what im going to do. I'm creating a webservice and am planning on having 4 tiers. DAL, BLL, Presentation, & Model. Im sort of basing it on the ms petshop. I plan on having 5 Namespaces MyProject.DAL - For the data stuff... MyProject.BLL
- ... MyProject.Presentation - ... MyProject.Model - Class to be passed around that hold data MyProject.Utilities - Generic Functions Does that much sound ok? Ok and here is where i get confused.......... MyProject.BLL.Users.AddNew() calls a function in the
DAL which passes an object from the Model, what do i call the types to make them different?? • MyProject.BLL.Users • MyProject.DAL.UsersDB • MyProject.Model.UsersInfo Would that be an appropriate naming scheme?
::MyProject.DAL - For the data stuff... Skip this. Do ONE dal that you reuse across all projects. ::MyProject.BLL - ... Ok. ::MyProject.Presentation - ... Ok. I would never name it presentation, though. ::MyProject.Model - Class to be passed around that hold
data Hm. Now - what do they do here? This is part of the BLL. ::MyProject.Utilities - Generic Functions Hm. If these are generic functions, they have nothing to do in this particular project - maintain them outside of the current project, so that you can reuse
them. ::MyProject.BLL.Users.AddNew() calls a function in the DAL which passes an object from the ::model, what do i call the types to make them different?? ::• MyProject.BLL.Users Users? SHould a class not represent one user? ::• MyProject.DAL.UsersDB Hm.
If the DAL needs a class to handle users, your prorgamming is bad. This is like having a separate Filestream CLASS for every file on your hard disc. I suggest oyu sit down and spend an evening planning a DAL class that can take the layout of the data and how
to get it from a configuration file. ::• MyProject.Model.UsersInfo Whatfor? Isn't a generic data container, part of the DAL API, good enough? ::Would that be an appropriate naming scheme? Depends. My naming scheme would be this: GenericDAL (separate project)
MyProject (this is the business logic - the logic IS the application) MyProject.Web (this coul be the website). Now, MyProejct would have classes like User, Account etc., and communicates ONLY with the DAL, which is 100% independent and has no class that is
specific to the user - requires some serious programming, but pays back.
I based my approach on the MS Petshop, what makes your approch better? Why is it better to pass around datasets/readers then UserInfo Objects? ::If the DAL needs a class to handle users, your programming is bad. Does that mean the using the objects defined
in the model for the PetShop (AccountInfo, AddressInfo, etc. ) are examples of bad programming? Im confused!
::I based my approach on the MS Petshop, what makes your approch better? Less code? If yo ucode ONE dal that you can reuse over different projects then - guess what: you are more efficient inthe second and futher projects. I never found the MS petshiop to be
elegant. ::Does that mean the using the objects defined in the model for the PetShop (AccountInfo, ::AddressInfo, etc. ) are examples of bad programming? I would say they are an example for non-resssourceful programming. If you look at them you will find theat
the DAL code is pretty repetitice. I would call any programmer taht writes repetiticve code not up to his job. See, when I make a select from a table, then the code is really 99% identical for every table, just the table name is different. Why not red the
table name from a condiguration and have ONE class to handle the selects? You can extend this to clalling SP's, too. THe MS DAAB (not used in petshop) is a start, but not going far enough. You dont have to go the full way of having an O/R mapper (like we do,
as a product) which basically also incorporates a generic DAL, but you can save a lot of time by doing a proper job. See, in my normal architectures, the solution looks like this: * Logic project (with the BLL in cluded, no UI). * Frontend project (with all
the UI), usitilising a Foundation library with UI related and other high level application functionality. * An O/R mapper that handles all the interaction of the domain objects (User, Account, Address) with the database. My BLL code (the business objects)
only ever communicates with the O/R mapper, and all SQL is auto-generated. I have not written a line of SQL in a program in the last two years, about, (with the exception of a serach system that was VERY tricky to get scalable in a SP here and a very special
case). I dont have any "Info" classes - this is al done automatically under the hood. I stand up, start an editor, create a table, define an object with fields and realation, press "Generate Code" to have empty shells and a little binding coe generated (nothing
too fancy, really) and then I can just add my logic and work with the objects. Way less code to maintain for every project.
> * Logic project (with the BLL in cluded, no UI). > * Frontend project (with all the UI), usitilising a Foundation library with UI related and other > high level application functionality. > * An O/R mapper that handles all the interaction of the domain objects
(User, Account, > Address) with the database. id be interested to know.. what do you do when you want, for example, all User domain objects with a username like "thona"? i mean from an architecture point of view... obviously your o/r mapper does the db work..
but it needs your Query object populated... what does the populating? your frontend? your domain objects? or do you have a seperate business logic class, which would have a function like GetUsersLike(string username) and return an IList containing the relevant
users?
::id be interested to know.. what do you do when you want, for example, all User domain ::objects with a username like "thona"? i mean from an architecture point of view... Simple. I ask a broker to give me these objects. Given: Class user, property "Name",
mapped to a field in the database. Given: I am in a transaction, and thus have a manager that I use to get objects etc. THis is in a variable em. Query q = em.CreateQuery (typeof(User), new Condition ("Name", Expression.Like, "thona"); EntityObjectList eol
= em.Find (q); foreach (User u in eol) { here we go. } Note that I define the query based on the OBJECT - I dont even know what table this goes to, etc. EntityObjectList is, btw., just an IList, well, actually - an IBindingList. Naturally, the BLL and the
framework has to provide a way to query for objects. Now, as you can see - this is again basically a generic method. It is, btw., much easier to use than SQL - as the "name" of the expresison can contain a dot separated path :-) This is, btw., where things
start to get interesting - in your BLL you want to work with objects, so you ahve to provide an object based query system. From an architecture point of view, the query is parameterised either in the business logic, or in the frontend (why not - this can be
frontend specific logic: give me a particular business object that I need now).
thona: you seem very knowledgable on OO theory and you denounce the architectures presented in MS sample apps. can you release a sample data-driven app to demonstrate your way of thinking to the .net community. i think everyone benefits from examples.
::you seem very knowledgable on OO theory and you denounce the architectures presented ::in MS sample apps. This comes basically because I maintain one of the better O/R mappers :-) When you think about OO all day long, in a framework context, then - well -
you get good at it. ::can you release a sample data-driven app to demonstrate your way of thinking to the .net ::community. i think everyone benefits from examples We seriously think of it. We have a lot of compiled code for wdownload, plus some trivial samples,
but a nontrivial sample of an O/R mapper based application could be nice. Let's see. Maybe we really should do this.
freakytard
Member
125 Points
25 Posts
My First Attempt at nTiered Architecture, what ya think?
Sep 22, 2003 08:15 PM|LINK
thona
Member
20 Points
2923 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 22, 2003 09:39 PM|LINK
freakytard
Member
125 Points
25 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 22, 2003 10:18 PM|LINK
freakytard
Member
125 Points
25 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 22, 2003 10:35 PM|LINK
thona
Member
20 Points
2923 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 23, 2003 05:02 AM|LINK
freakytard
Member
125 Points
25 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 23, 2003 06:24 AM|LINK
m7
Contributor
4225 Points
843 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 23, 2003 08:58 AM|LINK
thona
Member
20 Points
2923 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 23, 2003 09:04 AM|LINK
phishstick40
Member
600 Points
120 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 24, 2003 08:14 PM|LINK
thona
Member
20 Points
2923 Posts
Re: My First Attempt at nTiered Architecture, what ya think?
Sep 24, 2003 08:37 PM|LINK