框架可重复使用的分层架构 [英] Frameworks for Layering reusable Architectures

查看:134
本文介绍了框架可重复使用的分层架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题很简单,我的目的是生成您的回答一个仓库,所以它可以起到社会时的选择开发企业一般用途框架。
这可能适用很好的通用语言,如 C ++,C#或Java

My question is very simple, my intention is to generate a repository with your responses so it could serve to the community when selecting frameworks for developing enterprise general purpose applications. This could apply very well for general purpose languages such as C++, C# or Java.


  • 请您推荐产生什么框架的分层体系结构

  • 根据您遇到你为什么preFER一些框架在使用与自己的架构

  • 多久你相信你的选择的框架将保持在软件开发行业中的preferred选项?

推荐答案

这的确是一个过于笼统的问题,尤其是因为有这个词这么多间pretations的框架的,并框架许多不同种类的不同任务的世界中。不过,我给它一个Java的拍摄。

This is indeed an overly general question, especially since there are so many interpretations of the very word framework, and within the world of frameworks many different kinds for different tasks. Nevertheless, I'll give it a shot for Java.

Java的默认企业整体框架称为Java EE的。 Java EE的强烈重视分层架构。这是一个相当大的框架和学习它的每一个方面,可能需要一些时间。它支持多种类型的应用程序。非常小而简单的人只能使用JSP文件与一些小脚本,而较大的可能用得多。

The default overall enterprise framework of Java is called Java EE. Java EE strongly emphasis a layered architecture. It's a quite large framework and learning every aspect of it can take some time. It supports several types of applications. Extremely small and simple ones may only use JSP files with some scriptlets, while larger ones may use much more.

的Java EE并没有真正强制你使用它的所有部分,但是你挑选你喜欢什么。

Java EE doesn't really enforce you to use all parts of it, but you pick and choose what you like.

自上而下它由以下几部分组成:

Top down it consists of the following parts:

对于Web层的Java EE主要定义组件和基于MVC Web框架名为 JSF - JavaServer Faces的。 JSF使用一种被称作Facelets的一个基于XML的视图描述语言(模板语言)。页面是通过定义模板和模板,让客户端创建为他们提供内容,包括其他的小面,最后放置元件和通用的标记在他们身上。

For the web layer Java EE primarily defines a component and MVC based Web Framework called JSF - JavaServer Faces. JSF utilizes an XML based view description language (templating language) called Facelets. Pages are created by defining templates and letting template clients provide content for them, including other facelets and finally placing components and general markup on them.

JSF提供了一个良好定义的生命cyle做一切,每一个Web应用程序应该做的事情:转换请求值,验证它们,呼唤业务逻辑(模型),最后委托给(Facelets的)视图中绘制

JSF provides a well defined life-cyle for doing all the things that every web app should do: converting request values, validating them, calling out to business logic (the model) and finally delegating to a (Facelets) view for rendering.

有关更详尽的描述查找一些文章通过BalusC这里,例如<一href=\"http://stackoverflow.com/questions/3623911/what-are-the-main-disadvantages-of-java-server-faces-2-0/3646940#3646940\">What是Java服务器的主要缺点面临2.0?

For a more elaborate description look up some of the articles by BalusC here, e.g. What are the main disadvantages of Java Server Faces 2.0?

在Java EE框架,业务层重新被称为 EJB 一个轻量级的业务组件框架psented $ P $ - 企业JavaBeans。的EJB都应该包含一个应用程序的纯业务逻辑。除其他EJB的照顾交易,并发并在需要时远程处理。

The business layer in the Java EE framework is represented by a light-weight business component framework called EJB - Enterprise JavaBeans. EJBs are supposed to contain the pure business logic of an application. Among others EJBs take care of transactions, concurrency and when needed remoting.

普通的Java类成为通过应用@Stateless注释的EJB。默认情况下,这个bean的每个方法,然后自动交易。这意味着,如果该方法被调用,没有交易活跃的一个开始,否则一个结合。如果需要此行为可以被调整,甚至禁用。在大多数情况下,交易将是透明的程序员,但如果需要的话没有在Java EE的一个明确的API来手动管理它们。这是 JTA API - Java事务API

An ordinary Java class becomes an EJB by applying the @Stateless annotation. By default, every method of that bean is then automatically transactional. Meaning, if the method is called and no transaction is active one is started, otherwise one is joined. If needed this behavior can be tuned or even disabled. In the majority of cases transactions will be transparent to the programmer, but if needed there is an explicit API in Java EE to manage them manually. This is the JTA API - Java Transaction API.

在一个EJB方法可以很容易地进行使用@Asynchronous注解来执行异步的。

Methods on an EJB can easily be made to execute asynchronous by using the @Asynchronous annotation.

Java EE的明确支持通过EJB的专门的独立模块的概念分层。这样可以隔离那些豆类和$ P $访问其高层pvents他们。看到这个<一个href=\"http://stackoverflow.com/questions/4441237/packaging-ejb-in-javaee-6-war-vs-ear/4539419#4539419\">Packaging EJB中的JavaEE 6 WAR VS更详尽的解释EAR 。

Java EE explicitly supports layering via the concept of a separate module specifically for EJBs. This isolates those beans and prevents them from accessing their higher layer. See this Packaging EJB in JavaEE 6 WAR vs EAR for a more elaborate explanation.

有关持久性的Java EE框架附带了一个名为 JPA 标准的ORM框架 - Java持久性API。这是基于注释的简单Java类与@Entity注释和@Id对他们的属性或字段。任选地(如果需要的话)的进一步信息可以通过注解指定如何对象和对象关系映射到关系数据库中。

For persistence the Java EE framework comes with a standard ORM framework called JPA - Java Persistence API. This is based on annotating plain java classes with the @Entity annotation and a property or field on them with @Id. Optionally (if needed) further information can be specified via annotations on how objects and object relations map to a relational database.

JPA很大程度上强调苗条的实体。这意味着实体本身是尽可能的POJOs可以很容易地发送到其它层,甚至远程客户端。在Java EE中的实体通常不考虑自己的持续性照顾(即不抱到DB连接和等任何引用)。相反,一个单独的类名为的EntityManager 具备实体合作。

JPA heavily emphasizes slim entities. This means the entities themselves are as much as possible POJOs that can be easily send to other layers and even remote clients. An entity in Java EE typically does not take care of its own persistence (i.e. it does not hold any references to DB connections and such). Instead, a separate class called the EntityManager is provided to work with entities.

本的EntityManager工作的最简便的方法是从EJB豆,这使得获得一个实例和交易的处理变得轻而易举之内。然而,在任何其他层使用JPA,连外框架(例如在Java SE)的支持,以及。

The most convenient way of working with this EntityManager is from within an EJB bean, which makes obtaining an instance and the handling of transactions a breeze. However, using JPA in any other layer, even outside the framework (e.g. in Java SE) is supported as well.

这是一个典型的企业应用程序与传统的层最重要的服务,但Java EE框架支持了大量的附加服务。其中一些是:

These are the most important services related to the traditional layers in a typical enterprise app, but the Java EE framework supports a great many additional services. Some of which are:

消息直接支持通过 JMS API的Java EE的框架 - Java消息服务。这使得商业code将消息发送到所谓的队列和主题。该应用程序,甚至远程应用的各个部分可以听这样的队列或主题。

Messaging is directly supported in the Java EE framework via the JMS API - Java Messaging Service. This allows business code to send messages to so-called queues and topics. Various parts of the application or even remote applications can listen to such a queue or topic.

EJB组件框架,甚至有一种专门为短信定制豆;消息驱动bean里面有一个自动调用的的onMessage 方法时队列或主题的豆是听一个新的消息进来

The EJB component framework even has a type of bean that is specifically tailored for messaging; the message driven bean which has a onMessage method that is automatically invoked when a new message for the queue or topic that the bean is listening to comes in.

下一步JMS,Java EE的还提供了一个事件总线,这是一个简单的轻量的替代完全成熟的消息。这是通过 CDI API,它是一个COM prehensive的API,其中包括为网络层提供的范围和需要依赖注射护理提供。作为一个比较新的API,它目前有部分EJB和JSF从所谓的管理的bean重叠。

Next to JMS, Java EE also provides an event-bus, which is a simple light-weight alternative to full blown messaging. This is provided via the CDI API, which is a comprehensive API that among others provides scopes for the web layer and takes care of dependency injections. Being a rather new API it currently partially overlaps with EJB and the so-called managed beans from JSF.

的Java EE提供了大量的远程处理为开箱选项。 EJB可以接触到外部code愿意并且能够仅仅通过让他们实现一个远程接口,通过一个二进制协议进行通信。

Java EE provides a lot of options for remoting out of the box. EJBs can be exposed to external code willing and able to communicate via a binary protocol by merely letting them implement a remote interface.

如果二进制通信不是一个选项,Java EE的还提供各种Web服务实现。这是通过在其他JAX-WS(Web服务,用肥皂)和JAX-RS(REST)来完成。

If binary communication is not an option, Java EE also provides various web service implementations. This is done via among others JAX-WS (web services, soap) and JAX-RS (Rest).

有关安排定期或定时作业,Java EE的提供了一个简单的计时器API。这个API使用自然语言,以及为code的延迟执行定时器或跟进检查,支持类似cron的计时器。

For scheduling periodic or timed jobs, Java EE offers a simple timer API. This API supports CRON-like timers using natural language, as well as timers for delayed execution of code or follow up checks.

Java EE的这部分是可用的,但提到相当基础。

This part of Java EE is usable but as mentioned fairly basic.

有在Java EE中颇有些更多的东西,但我觉得这大概涵盖了最重要的东西。

There are quite some more things in Java EE, but I think this about covers the most important things.

用于Java的替代企业框架是春天。这是一个专有的,虽然完全开源框架。

An alternative enterprise framework for Java is Spring. This is a proprietary, though fully open source framework.

只是作为Java EE框架,Spring框架包含一个Web框架(称为Spring MVC的),一个业务组件框架(简称春,或Core Spring框架)和Web服务栈(所谓的Spring Web服务)。

Just as the Java EE framework, the Spring framework contains a web framework (called Spring MVC), a business component framework (simply called Spring, or Core Spring Framework) and a web services stack (called Spring Web Services).

尽管Java EE框架的很多部分可独立使用,春天更强调建立你自己的堆栈比Java EE的一样。

Although many parts of the Java EE framework can be used standalone, Spring puts more emphasis on building up your own stack than Java EE does.

的Java EE VS春天的选择往往是一个宗教的影响之一。从技术上讲这两个框架提供了类似的编程模型和功能相当的数量。 Java EE的可以被看作是稍微轻量(强调约定优于配置)和有类型安全注射的好处,而Spring可能提供更多的开发人员经常需要那些规模较小的便利方法。

The choice of Java EE vs Spring is often a religiously influenced one. Technically both frameworks offer a similar programming model and a comparable amount of features. Java EE may be seen as slightly more light-weight (emphasis convention over configuration) and having the benefit of type-safe injections, while Spring may offer more of those smaller convenience methods that developers often need.

此外Spring提供了更充分,直接使用安全API(称为春季安全),其中的Java EE叶开放(第三方)供应商有很多的安全细节。

Additionally Spring offers a more thoroughly and directly usable security API (called Spring Security), where Java EE leaves a lot of security details open to (third party) vendors.

这篇关于框架可重复使用的分层架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆