88

I was wondering if anyone can compare/contrast the differences between frontend, backend, and middleware ("middle-end"?) succinctly.

Are there cases where they overlap? Are there cases where they MUST overlap, and frontend/backend cannot be separated? In terms of bottlenecks, which end is associated with which type of bottlenecks?

Braiam
  • 1
  • 11
  • 47
  • 78
mt3
  • 2,654
  • 4
  • 26
  • 29

7 Answers7

63

Here is one breakdown:

Front-end tier -> User Interface layer usually consisting of a mix of HTML, Javascript, CSS, Flash, and various server-side code like ASP.Net, classic ASP, PHP, etc. Think of this as being closest to the user in terms of code.

Middleware, middle-tier -> One tier back, generally referred to as the "plumbing" part of a system. Java and C# are common languages for writing this part that could be viewed as the glue between the UI and the data and can be webservices or WCF components or other SOA components possibly.

Back-end tier -> Databases and other data stores are generally at this level. Oracle, MS-SQL, MySQL, SAP, and various off-the-shelf pieces of software come to mind for this piece of software that is the final processing of the data.

Overlap can exist between any of these as you could have everything poured into one layer like an ASP.Net website that uses the built-in AJAX functionality that generates Javascript while the code behind may contain database commands making the code behind contain both middle and back-end tiers. Alternatively, one could use VBScript to act as all the layers using ADO objects and merging all three tiers into one.

Similarly, taking middleware and either front or back-end can be combined in some cases.

Bottlenecks generally have a few different levels to them:

1) Database or back-end processing -> This can vary from payroll or sales or other tasks where the throughput to the database is bogging things down.

2) Middleware bottlenecks -> This would be where some web service may be hitting capacity but the front and back ends have bandwidth to handle more traffic. Alternatively, there may be some server that is part of a system that isn't quite the UI part or the raw data that can be a bottleneck using something like Biztalk or MSMQ.

3) Front-end bottlenecks -> This could client or server-side issues. For example, if you took a low-end PC and had it load a web page that consisted of a lot of data being downloaded, the client could be where the bottleneck is. Similarly, the server could be queuing up requests if it is getting hammered with requests like what Amazon.com or other high-traffic websites may get at times.

Some of this is subject to interpretation, so it isn't perfect by any means and YMMV.


EDIT: Something to consider is that some systems can have multiple front-ends or back-ends. For example, a content management system will likely have a way for site visitors to view the content that is a front-end but what about how content editors are able to change the data on the site? The ability to pull up this data could be seen as front-end since it is a UI component or it could be seen as a back-end since it is used by internal users rather than the general public viewing the site. Thus, there is something to be said for context here.

JB King
  • 11,860
  • 4
  • 38
  • 49
  • 3
    php is front-end? this didn't match my expectations, so I looked it up and I found different opinions – Oriesok Vlassky Jan 11 '13 at 13:36
  • @OriesokVlassky what expectations did you have? – JB King Jan 11 '13 at 15:11
  • I'd guess middle-tier.. I admit I am not much sure about the ranking, but I have also found some other similar opinions, like 'For web development this includes the middle tier development (perhaps using php or java)' in http://itknowledgeexchange.techtarget.com/itanswers/front-end-vs-back-end-development/ .. or somewhere I found that php can be either front-end or middle-tier. – Oriesok Vlassky Jan 14 '13 at 10:58
  • Don't forget that the answer also contains the point, "front-end development creates the visual presentation to the end user." which can be a use of PHP. If you want to call PHP the middle-tier, what is the front-end in this case if there is no JavaScript on the site? – JB King Jan 14 '13 at 16:43
  • 2
    @JBKing i got confuse, middle-tier is the one interacting with the Front end(UI) and also with Backend(DB) na ??? In this case my website is having HTML , JS Frontend and MySQL Backend ... Php is Middle-tier na ? – asvignesh Oct 10 '13 at 05:44
  • Middle-tier is the stuff between the front-end and back-end, if applicable. Often this would be enterprise service bus or web services that contain no UI and allows one to tie systems together. If PHP is generating the HTML for the user, then it is part of the UI, isn't it? – JB King Oct 10 '13 at 15:16
  • You have used the terms [middle-tier](https://stackoverflow.com/questions/312187/what-is-n-tier-architecture) and [middleware](https://azure.microsoft.com/en-in/overview/what-is-middleware/) interchangeably. Are they the same? Is it that the responsibilities of middle-tier are taken care of tools called middleware? – RBT Jun 08 '17 at 07:24
8

Generally speaking, people refer to an application's presentation layer as its front end, its persistence layer (database, usually) as the back end, and anything between as middle tier. This set of ideas is often referred to as 3-tier architecture. They let you separate your application into more easily comprehensible (and testable!) chunks; you can also reuse lower-tier code more easily in higher tiers.

Which code is part of which tier is somewhat subjective; graphic designers tend to think of everything that isn't presentation as the back end, database people think of everything in front of the database as the front end, and so on.

Not all applications need to be separated out this way, though. It's certainly more work to have 3 separate sub-projects than it is to just open index.php and get cracking; depending on (1) how long you expect to have to maintain the app (2) how complex you expect the app to get, you may want to forgo the complexity.

Dan Davies Brackett
  • 9,811
  • 2
  • 32
  • 54
6

There are in fact 3 questions in your question :

  • Define frontend, middle and back end
  • How and when do they overlap ?
  • Their associated usual bottlenecks.

What JB King has described is correct, but it is a particular, simple version, where in fact he mapped front, middle and bacn to an MVC layer. He mapped M to the back, V to the front, and C to the middle.

For many people, it is just fine, since they come from the ugly world where even MVC was not applied, and you could have direct DB calls in a view.

However in real, complex web applications, you indeed have two or three different layers, called front, middle and back. Each of them may have an associated database and a controller.

The front-end will be visible by the end-user. It should not be confused with the front-office, which is the UI for parameters and administration of the front. The front-end will usually be some kind of CMS or e-commerce Platform (Magento, etc.)

The middle-end is not compulsory and is where the business logics is. It will be based on a PIM, a MDM tool, or some kind of custom database where you enrich your produts or your articles (for CMS). It'll also be the place where you code business functions that need to be shared between differents frontends (for instance between the PC frontend and the API-based mobile application). Sometimes, an ESB or tool like ActiveMQ will be your middle-end

The back-end will be a 3rd layer, surrouding your source database or your ERP. It may be jsut the API wrting to and reading from your ERP. It may be your supplier DB, if you are doing e-commerce. In fact, it really depends on web projects, but it is always a central repository. It'll be accessed either through a DB call, through an API, or an Hibernate layer, or a full-featured back-end application

This description means that answering the other 2 questions is not possible in this thread, as bottlenecks really depend on what your 3 ends contain : what JB King wrote remains true for simple MVC architectures

at the time the question was asked (5 years ago), maybe the MVC pattern was not yet so widely adopted. Now, there is absolutely no reason why the MVC pattern would not be followed and a view would be tied to DB calls. If you read the question "Are there cases where they MUST overlap, and frontend/backend cannot be separated?" in a broader sense, with 3 different components, then there times when the 3 layers architecture is useless of course. Think of a simple personal blog, you'll not need to pull external data or poll RabbitMQ queues.

spiritoo
  • 451
  • 5
  • 15
  • Dude, It is not at all accurate to say that JB King currently has described correspond to the layers of an MVC pattern. According to King's definitions, both the View and the Controller would be in the "Middleware, middle-tier". – Amos Long Dec 17 '19 at 03:52
3

Here is a real world example which shows front/mid/back end.

General description:

  • Frontend is responsible for presenting data to user. Please note interesting quirk that you may have two different front ends associated with single backend
  • Backend provides business logic/data persistence.
  • Middleware (activemq in the picture) is responsible for system to system. integration between backends. Usually it is installed as separate application enter image description here

Overlapping:

It is possible to have overlapping between frontend and backend. This usually leaads to long-term issues with application maintenance and scalability. Fairly common in legacy applications.

Most modern technology stacks encourage developers to have strict separation. For example in the picture you can see that backend of the first system has rest web service which is a clear separation line.

Bottlenecks

Most bottlenecks in large are caused by database/network. Databases are located in backend. As for network issues every connection goes through netowrk, so every connection has potential for being slow. With good application design these issues are avoidable to large extend.

Marcin Szymczak
  • 11,199
  • 5
  • 55
  • 63
0

Frontend refers to the client-side, whereas backend refers to the server-side of the application. Both are crucial to web development, but their roles, responsibilities and the environments they work in are totally different. Frontend is basically what users see whereas backend is how everything works

Olusegun
  • 11
  • 1
0

In terms of networking and security, the Backend is by far the most (should be) secure node.

The middle-end portion, usually being a web server, will be somewhat in the wild and cut off in many respects from a company's network. The middle-end node is usually placed in the DMZ and segmented from the network with firewall settings. Most of the server-side code parsing of web pages is handled on the middle-end web server.

Getting to the backend means going through the middle-end, which has a carefully crafted set of rules allowing/disallowing access to the vital nummies which are stored on the database (backend) server.

OldBuildingAndLoan
  • 2,801
  • 4
  • 32
  • 40
  • I hesitated about clarifying that myself. – OldBuildingAndLoan Mar 12 '09 at 00:36
  • @Luke you missed the closing parenthesis in your link. No big deal but I had to click twice [shock-horror!] to get to the article :o [DMZ Wiki][1] [1]: http://en.wikipedia.org/wiki/Demilitarized_zone_(computing) – Etzeitet Jul 14 '09 at 21:46
  • Ok my bad, seems the site kills the link. Also Markdown doesn't work in comments :/ *sits in naughty corner* – Etzeitet Jul 14 '09 at 21:47
0

Frontend -> these are the client side of a website from where a user can interact with the server through User Interface. generally built using Html and CSS.

Middleware -> Middleware are the software or service which is responsible for the system to communicate and manage the data. it handles the communication between components and input/output

Backend -> Backend are the server side of any application which consist of all functioning and operations performed on data. this part is considered to be most essential part of any application. Only the server admin have access to this. it mainly consist of database and servers.

Anonymous Coder
  • 556
  • 2
  • 16