At what point will architecture become multi-layered?

Obviously, "Hello World" does not require a separate, modular interface and external interface. But any Enterprise-grade project does.

Assuming some kind of spectrum between these points, at what stage should the application (conceptually or at the design level) be multilayer? When is a database or some external resource introduced? When will you find yourself expecting spaghetti code in your methods / functions?

+4
source share
9 answers

when a database or some external resource is entered.

but also:

always (with the exception of the most trivial applications) a separate LE LEVER level and application level

cm

http://en.wikipedia.org/wiki/Multitier_architecture

+7
source

Layers - this means that the design is loosely coupled and very smooth. .

When you start to have several classes (either implemented or simply sketched using UML), they can be grouped logically, in layers - or, more generally, packages or modules. This is called the art of sharing problems .

The sooner the better: if you do not start the stratification early enough, then you run the risk of never doing this, as this may be too important.

+3
source

Here are some criteria for when ...

  • Each time you expect to replace one part of it with another part.
  • Each time you find you need to split the work among a parallel team.
+2
source

There is no real answer to this question. It depends a lot on your application needs and many other factors. I would suggest reading some books on design patterns and enterprise application architecture. These two are priceless:

Design Patterns: Elements of Reusable Object-Oriented Software

Enterprise Application Architecture Templates

Some other books that I highly recommend:

Pragmatic Programmer: From Journeyman to Master

Refactoring: Improving the Design of Existing Code

Regardless of your skill level, reading these books will truly open your eyes to a world of possibilities.

+2
source

I would say that in most cases involving several different levels of abstraction in the concepts that your code is associated with, there will be a strong signal to reflect this with levels of abstraction in your implementation.

This does not override scripts that are already highlighted by others.

+1
source

I think, as soon as you ask yourself: "Hmm, if I lay it down," the answer is yes.

I worked on too many projects, which probably started as proof of concept / prototype, which ended up being complete projects used in production, which are horribly written and just “fast”, we will fix it later. “Believe me, you don't fix it later.

The pragmatic programmer lists this as a theory of broken windows.

Try it and always do it from the very beginning. Separate your concerns. Build it with modularity in mind.

And, of course, try to think of a bad programmer who can take responsibility when you are done!

+1
source

Thinking about this in terms of layers is a bit limited. This is what you see in the product docs, but this is not how the products really work. They have “boxes” that depend on each other in different ways, and you can make them look like they fit into layers, but you can do this in several different configurations, depending on what information you leave on chart.

And in a really well-designed application, the boxes become very small. They reach the level of individual interfaces and classes.

This is important because whenever you change a line of code, you need to have some idea of ​​what impact your change will affect, which means that you must understand exactly what this code is doing at the moment, what are its responsibilities, which means that this should be a small piece that bears one responsibility, implementing an interface that does not make customers depend on what they do not need (S and I SOLID).

You may find that your application may look like it has two or three simple layers if you narrow your eyes, but it may not be so. It's not a problem. Of course, a catastrophically poorly designed application may look like it has level levels if you squint as hard as you can. Thus, these "high-level" diagrams of "architecture" can hide many sins.

+1
source

My general rule is to at least separate the problem down to the model and presentation level and drop the controller if there is more than one way to process the model or pipeline data in a view.

(Or as the first answer, at least the presentation level and application level).

0
source

Loose communication is to minimize dependencies, so I would say “layer” when a dependency is introduced. i.e. databases, third-party applications, etc.

Although the "layer" is probably the wrong term these days. Most of the time I use Injection Dependency (DI) through an Inversion of Control container like Castle Windsor. This means that I can encode one part of my system without worrying about the rest. It has a side effect that provides free grip.

I would recommend DI as a general programming principle all the time so that you have a choice of how to "fold" your application later.

Look at him.

R

0
source

All Articles