•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Computer Science and Software Design section within the Software Development category of DaniWeb, a massive community of 456,527 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,801 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Computer Science and Software Design advertiser: Programming Forums
Views: 1829 | Replies: 11
![]() |
•
•
Join Date: Aug 2007
Location: South Africa
Posts: 164
Reputation:
Rep Power: 2
Solved Threads: 1
Hi.
Can anyone give me some advice on designing a layered architecture for a software project i am working on?
since i always develop my programs in modules they come out in some form of layered architechture but this is always by accident. i want to develop it layered from the start.
i have thought of the following layers. database access layer, screen layer, processing the data from the database layer, do calculations and deal with the user layer.
these layers should explain themselves. i would appreciate it if someone can tell me if this is good or whether i should put in more or fewer layers or whether i have to change the layers. basically is there some template or blueprint from which a good layered architecture can be derived.
I would also appreciate it if someone could point me to good web sites which deals with this.
Thank you.
Can anyone give me some advice on designing a layered architecture for a software project i am working on?
since i always develop my programs in modules they come out in some form of layered architechture but this is always by accident. i want to develop it layered from the start.
i have thought of the following layers. database access layer, screen layer, processing the data from the database layer, do calculations and deal with the user layer.
these layers should explain themselves. i would appreciate it if someone can tell me if this is good or whether i should put in more or fewer layers or whether i have to change the layers. basically is there some template or blueprint from which a good layered architecture can be derived.
I would also appreciate it if someone could point me to good web sites which deals with this.
Thank you.
Last edited by Ravenous Wolf : Oct 1st, 2007 at 4:14 am.
... what society overwhelmingly asks for is snake oil. Of course, the snake oil has the most impressive names —otherwise you would be selling nothing— like "Structured Analysis and Design", "Software Engineering", "Maturity Models", "IPSE", "MIS", "OO", "BPRE".... by Edsger W. Dijkstra
Draw diagrams - UML seems to be the thing to use nowadays.
There are some good tools (and some free ones) which help with the maintenance. Though if you're only planning a few diagrams, paper and/or a whiteboard with post-it notes makes a great substitute.
Although UML has 13 different diagram types, some of them are rather specialised. Don't feel too weird if you can't think of a good reason to use them. UML aims to span from designing the garden shed to designing a skyscraper. There's just some stuff you don't need at the lower end of the scale.
Roughly speaking, you start with a single box representing your entire system, and you surround it with all the interactions with the outside world. Say, users, sensors, display devices, remote machines etc etc.
You then break your system into between 4 and 6 sub-components representing the "big" ideas within your program. These will interact with the outside world (see your first diagram) and will create new interactions between the entities you created.
Keep doing that until you start to create very small components which seem trivial to implement in code.
Oh, and before you rush to start coding, walk the diagrams through with someone (anyone) just to make sure it all hangs together properly. A quick diagram fiddle may represent a saving of several weeks of coding effort.
There are some good tools (and some free ones) which help with the maintenance. Though if you're only planning a few diagrams, paper and/or a whiteboard with post-it notes makes a great substitute.
Although UML has 13 different diagram types, some of them are rather specialised. Don't feel too weird if you can't think of a good reason to use them. UML aims to span from designing the garden shed to designing a skyscraper. There's just some stuff you don't need at the lower end of the scale.
Roughly speaking, you start with a single box representing your entire system, and you surround it with all the interactions with the outside world. Say, users, sensors, display devices, remote machines etc etc.
You then break your system into between 4 and 6 sub-components representing the "big" ideas within your program. These will interact with the outside world (see your first diagram) and will create new interactions between the entities you created.
Keep doing that until you start to create very small components which seem trivial to implement in code.
Oh, and before you rush to start coding, walk the diagrams through with someone (anyone) just to make sure it all hangs together properly. A quick diagram fiddle may represent a saving of several weeks of coding effort.
•
•
Join Date: Aug 2007
Location: South Africa
Posts: 164
Reputation:
Rep Power: 2
Solved Threads: 1
thanks salem. it does not exactly answer the question i asked but it is usefull non the less.
it touches upon a subject which i have thought of often. so far i have created smaller systems and i spend very little time designing before i start to code. but my current project is much bigger and i am going to follow your directions when i design it.
and i suppose that sooner or later i am going to have to learn UML. actually i have a C++ textbook which explains it in detail. but love to make the excuse of not enough time so i have only glanced at it so far.
it touches upon a subject which i have thought of often. so far i have created smaller systems and i spend very little time designing before i start to code. but my current project is much bigger and i am going to follow your directions when i design it.
and i suppose that sooner or later i am going to have to learn UML. actually i have a C++ textbook which explains it in detail. but love to make the excuse of not enough time so i have only glanced at it so far.
... what society overwhelmingly asks for is snake oil. Of course, the snake oil has the most impressive names —otherwise you would be selling nothing— like "Structured Analysis and Design", "Software Engineering", "Maturity Models", "IPSE", "MIS", "OO", "BPRE".... by Edsger W. Dijkstra
you layers is nice you don't need more!
any basic business project should have UI Layer, Business Logic Layer, and Data Access Layer.
what about if you need security on all the layers?
you should add layer cross cut on your layers (AOP)
what about you areee using Distrbutied database?
you should add after Data Access Layer a Layer called Communication Layer.
I think your architecture seems to be good you don't need more layers
any basic business project should have UI Layer, Business Logic Layer, and Data Access Layer.
what about if you need security on all the layers?
you should add layer cross cut on your layers (AOP)
what about you areee using Distrbutied database?
you should add after Data Access Layer a Layer called Communication Layer.
I think your architecture seems to be good you don't need more layers
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Creating "layers" only really makes sense if you plan to create several different projects with a shared theme. In other words, the extra effort you put into say your "display" layer to make it generally more useful (over and above what is strictly necessary for a given project) needs to have some payback down the line in making future projects a lot easier.
The problem is, unless you're exceedingly familiar with the solution domain (you've done the same thing several times already, and you're getting bored with it), is coming up with the API for your layer which is useful to you.
The danger is that the API will bloat, will have an ad-hoc interface and will suck in resources just to maintain itself rather than being in any kind of "finished" state where you can make use of it.
The problem is, unless you're exceedingly familiar with the solution domain (you've done the same thing several times already, and you're getting bored with it), is coming up with the API for your layer which is useful to you.
The danger is that the API will bloat, will have an ad-hoc interface and will suck in resources just to maintain itself rather than being in any kind of "finished" state where you can make use of it.
•
•
Join Date: Aug 2007
Location: South Africa
Posts: 164
Reputation:
Rep Power: 2
Solved Threads: 1
>...several different topics with a sgared theme..
yes that is exactly what this is. it is going to be three projects. that is what promted me to go for the layered architecture in the first place.
one more thing salem. are you saying that a layered architecture is more difficult or troublesome for very little reward other then multiple projects?
i have only read one book on layered architecture some years back when i was in tech. i cant remember that much of the book and at the time i did not take much note but the book was full of praise for layered architecture.
it said that it makes both debugging and maintenance easier. apparently the extra effort one spends before starting to design the detailed solution soon repays itself.
yes that is exactly what this is. it is going to be three projects. that is what promted me to go for the layered architecture in the first place.
one more thing salem. are you saying that a layered architecture is more difficult or troublesome for very little reward other then multiple projects?
i have only read one book on layered architecture some years back when i was in tech. i cant remember that much of the book and at the time i did not take much note but the book was full of praise for layered architecture.
it said that it makes both debugging and maintenance easier. apparently the extra effort one spends before starting to design the detailed solution soon repays itself.
... what society overwhelmingly asks for is snake oil. Of course, the snake oil has the most impressive names —otherwise you would be selling nothing— like "Structured Analysis and Design", "Software Engineering", "Maturity Models", "IPSE", "MIS", "OO", "BPRE".... by Edsger W. Dijkstra
> it said that it makes both debugging and maintenance easier.
So does working from a nice design with well defined functions and interfaces.
> are you saying that a layered architecture is more difficult or troublesome
> for very little reward other then multiple projects?
Not at all. Sometimes a few simple decisions can have an immediate and huge payoff. The danger is getting sucked into the "must have layers" mentality and spending way too much time creating something which isn't all that useful. If you can see a layer and how to use it then fine, but don't spend the time trying to force it.
Also, continually review progress as you go, as things do become clearer later on (like spotting a new opportunity for a new or better layer).
So does working from a nice design with well defined functions and interfaces.
> are you saying that a layered architecture is more difficult or troublesome
> for very little reward other then multiple projects?
Not at all. Sometimes a few simple decisions can have an immediate and huge payoff. The danger is getting sucked into the "must have layers" mentality and spending way too much time creating something which isn't all that useful. If you can see a layer and how to use it then fine, but don't spend the time trying to force it.
Also, continually review progress as you go, as things do become clearer later on (like spotting a new opportunity for a new or better layer).
•
•
Join Date: Aug 2007
Location: South Africa
Posts: 164
Reputation:
Rep Power: 2
Solved Threads: 1
>must have layers mentality
>dont spend time trying to force it
i hear you.
>dont spend time trying to force it
i hear you.
... what society overwhelmingly asks for is snake oil. Of course, the snake oil has the most impressive names —otherwise you would be selling nothing— like "Structured Analysis and Design", "Software Engineering", "Maturity Models", "IPSE", "MIS", "OO", "BPRE".... by Edsger W. Dijkstra
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
An interesting summary of layered architecture is in Eric Evans' "Domain-Driven Design Quickly" starting on p. 29. It describes four layers -- UI (presentation), Application, Domain (business logic) and Infrastructure.
It's a mini-book PDF file you can download from http://www.infoq.com/minibooks/domai...design-quickly
It's a mini-book PDF file you can download from http://www.infoq.com/minibooks/domai...design-quickly
•
•
Join Date: Aug 2007
Location: South Africa
Posts: 164
Reputation:
Rep Power: 2
Solved Threads: 1
@salem or anyone else that gets his point
>>start with a single box taht represents the entire system. etc etc.
i am only now beginning to appreciate the value of this reply and the next one is very usefull too. especiallyin addition to what infarctation, i think, said about the value of object orientated becomming obvious once you start working on bigger projects.
can you suggest any good books which center on this very method that you suggest here.
i am not as such talking about uml, although it is no problem if it is included in the book. rather i am talking about the steps which say that i must start with a single box which represents the entire system and from there divide the system etc. if it could be about object oriented then it would be even better.
>>start with a single box taht represents the entire system. etc etc.
i am only now beginning to appreciate the value of this reply and the next one is very usefull too. especiallyin addition to what infarctation, i think, said about the value of object orientated becomming obvious once you start working on bigger projects.
can you suggest any good books which center on this very method that you suggest here.
i am not as such talking about uml, although it is no problem if it is included in the book. rather i am talking about the steps which say that i must start with a single box which represents the entire system and from there divide the system etc. if it could be about object oriented then it would be even better.
Last edited by Ravenous Wolf : Jan 29th, 2008 at 4:59 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Computer Science and Software Design Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax asp blog business software computer dell design developer development erp systems experiment firefox howto india intel internet it java linux media microsoft mmorpg msdn networking news office open open-source operating programming project management rss science security software software selection source sql sun super system technology evaluation toread vista warez web wiki windows xp
- Computer Architecture Reference (Computer Science and Software Design)
- SOA Service Oriented Architecture Forum (Legacy and Other Languages)
- layered hidden window (Windows NT / 2000 / XP / 2003)
- Architect / Senior Programmer : Asp.net / C# (Web Development Job Offers)
- SONET architecture as it relates to Voice over IP (ASP.NET)
- A new Enterprise Architecture online user group (Web Developers' Lounge)
- Icons layered on top of original desktop icons (Viruses, Spyware and other Nasties)
- Computer Architecture (Computer Science and Software Design)
- Network Neighborhood (OS X)
Other Threads in the Computer Science and Software Design Forum
- Previous Thread: Structure for low memory, 'seen' queries.
- Next Thread: HELP with MIPS



Linear Mode