Click here to Skip to main content
15,887,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project(desktop application), I separate business logic and presentation layer but run in the same machine. So here are the composition:
A. Presentation layer and business layer run on the client side(user).
It is consist of 2 project/assembly: the UI(presentation) and class library(bussines layer). At least this is what I know about layering an application.
B. Data layer(the database server).

After reading a lot of articles about 3 and n tier architecture, and they said each tier mean one machine or run in one computer. I wonder how each tier communicate?
For example i want to bind data from data access layer to the UI. How can we do this if they run on different machine?
In my current project i just simply add the class library who act as the data access layer as project reference.

Is web service is the (only) answer to make it possible? And if the answer is yes, is this how SOA and N tier is related?

What I have tried:

Reading a lot of article and tried to implementing SOA
Posted
Updated 4-Jan-17 3:54am
Comments
[no name] 4-Jan-17 8:36am    
"they said each tier mean one machine or run in one computer.", I doubt that. Can you show links to these "articles" that say this? Some layers may run on other computers but all layers can run on the same computer. If you are making a distributed architecture then you could use WCF to allow your components to communicate with each other.
Mang Irpan 4-Jan-17 9:11am    
Here is an example if I dont miss understood abouy it:
https://www.codeproject.com/Articles/430014/N-Tier-Architecture-and-Tips

I believe that tier and layer are different. And also I know many layers can run in one tier(or computer). I want to do the right implementation of n-tier architecture.

Actually I don't want to talk about these terms, I just want to know in more spesific question that: is it possible If we separate the layers into different computer and we don't use web service/or wcf to connect between layers (you said that I could use wcf to do this). Or is it the only one to make the components communicate, such as consuming data, declaring instances and use its entities?

But if you want to clarify my understanding about n tier, please give me some advise. Thank you.
[no name] 4-Jan-17 10:01am    
I think you are terribly confused and you did not understand then article you referenced if you got that each tier runs on a separate computer. If you do not use some sort of communications medium to enable your components running on separate computers to communicate with each other, then how on earth would you expect them to communicate? You MUST enable them to communicate somehow. If you don't want to use web service or WCF use raw TCP/IP.
Mang Irpan 4-Jan-17 10:20am    
There are 3 possibilities:
1. My english is bad
2. I am terribly confused as you said. Haha
3. 1 and 2

But it is reflecting my understanding so far.
Raw tcp/ip? I am going to google it.
Thank you

1 solution

Don't get hung up on terminology or what people call tiers or layers. All that is important is what is right for your solution. Splitting your code onto physical machines is usually done if you need to scale the solution, or have certain services behind certain firewalls etc.

In terms of communicating, a lot of apps split their solutions into code that all runs on the same machine, even same process, and communication is handled by standard intra-DLL communication...ie your business layer loads the data layer assembly into its space and calls methods on its objects.

If you want the option to split the code across servers or processes then that's not going to work so you'll need to use the likes of WCF. Note that WCF isn't "web services" though. http communication is simply one option open to WCF when it comes to communication between client and server. Think of WCF communication as being a black box...your code creates a client object and calls a method on that client. Ultimately the same method is executed on the server and how the bit in the middle works isn't relevant...WCF just handles it for you and it is down to configuration. So you might configure this to use http as your business layer is hosted externally somewhere, and later on you decide you want better performance so bring your app layer into your local network and want to use TCP rather than HTTP. To do this simply means re-configuring WCF to use TCP rather than HTTP, you don't have to change your code, your code doesn't know and doesn't care how WCF is transmitting your requests. Also you can still host all tiers on the same machine if you want to, then split to different machines later and again it's simply down to how you configure WCF, no code changes needed.
 
Share this answer
 
Comments
Mang Irpan 4-Jan-17 10:12am    
Thank you for your detailed explanation. And also for the short explanation of wcf.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900