Scala и Spring: совмещаем лучшее из обоих миров.

Urs Peter, “Scala & Spring: Combine the best of both worlds”, public translation into Russian from English More about this translation.

See also 8 similar translations

Translate into another language.

Participants

Night1188 points
nLord39 points
folone9 points
And others...
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8 9 10 11

Scala & Spring: Combine the best of both worlds

Scala и Spring: совмещаем лучшее из обоих миров.

History of edits (Latest: folone 1 year, 10 months ago) §

Introduction

Введение

History of edits (Latest: folone 1 year, 10 months ago) §

Scala is a great programming language combining a concise and legible syntax with a seamless fusion of the object-oriented and functional programming paradigm that is fully compatible with Java. The latter makes it possible to combine Scala with Java APIs and frameworks that Java developers are familiar with. By doing so, the usage of existing Java frameworks can be improved and simplified. In addition to that, the threshold to learn Scala is also lowered because it can easily easily be integrated with the “well-known world of Java”.

Scala – значительный по своим масштабам язык программирования, сочетающий в себе краткость и понятную синтаксическую структуру, с цельным сплавом объектно-ориентированной и функциональной парадигмы программирования, которая, в свою очередь, полностью совместима с Java. Свойства же последнего позволяют комбинировать Scala с Java APIs, а также объектные структуры, с которыми так хорошо знакомы разработчики Java. Подобное комбинирование может улучшить и упростить существующие ныне объектные структуры Java. Вместе с тем будут опущены и границы изучения данного языка, потому как он может с легкостью интегрироваться со «всем известным миром Java».

History of edits (Latest: ziftech 1 year, 6 months ago) §

In this article I will show how Spring, one of the most popular frameworks, can be leveraged by means of Scala. Spring not only offers effective programming paradigms such as Dependency Injection (DI) and Aspect Oriented Programming (AOP) but also provides lots of handy glue code to interface with popular frameworks such as Hibernate, Toplink and the like, as well as the JEE environment. Especially the latter grants Scala smooth access to the enterprise, which is the place its success will inevitably depend on.

В данной статье я расскажу Вам, как один из самых популярных JAVA фреймворков Spring может быть использован совместно с языком Scala. Spring реализует не только эффективные парадигмы программирования, такие как Dependency Injection (DI) и Aspect Oriented Programming (AOP), но и предоставляет интерфейсы к таким популярным фреймворкам как Hibernate, Toplink и тому подобным, равно как и к окружению Java Enterprise Edition (JEE). Последнее обеспечивает Scala возможностями кооперативной разработки, от чего неизбежно будет зависеть будущий успех проекта.

History of edits (Latest: nLord 1 year, 9 months ago) §

In order to demonstrate how Scala compliments Spring this article is based on a simple sample application. This application uses a Scala, Spring and Hibernate/JPA stack with the following domain model:

Чтобы продемонстрировать, как Scala дополняет Spring, в данной статье рассмотрен пример простого приложения. Это приложение использует Scala, Spring и Hibernate/JPA со следующей моделью:

History of edits (Latest: nLord 1 year, 9 months ago) §

The domain model resembles a mini version of a social networking application. Simply put, it lets persons be linked to other persons.

Модель предметной области имеет сходство с мини версией социального сетевого приложения. Не имеющее сложностей для внесения, оно позволяет людям общаться.

History of edits (Latest: Night 1 year, 9 months ago) §

Step 1

Шаг 1

History of edits (Latest: Night 1 year, 9 months ago) §

Based on this domain model, first of all, this article shows how to implement a generic Data Access Object (DAO) and a concrete DAO for the Person entity in Scala making use of Hibernate/JPA. The result will be a PersonDao on which CRUD operations can be executed. For example:

Данная статья на примере этой модели показывает, как реализовать общий интерфейс DAO (Data Access Object) и определенный DAO для сущности "Person" в Scala, применяя Hibernate/JPA. Результатом станет интерфейс PersonDao, на котором могут быть исполнены 4 базовых функции управления данными CRUD. Например:

History of edits (Latest: nLord 1 year, 9 months ago) §

val p1 = new Person(“Rod Johnson”)

val p1 = new Person(“Rod Johnson”)

History of edits (Latest: Night 1 year, 9 months ago) §

val p2 = dao.findByName(“Martin Odersky”)

val p2 = dao.findByName(“Martin Odersky”)

History of edits (Latest: Night 1 year, 9 months ago) §

p1.link(p2)

p1.link(p2)

History of edits (Latest: Night 1 year, 9 months ago) §

personDao.save(p1)

personDao.save(p1)

History of edits (Latest: Night 1 year, 9 months ago) §

Step 2

Шаг 2

History of edits (Latest: Night 1 year, 9 months ago) §

Then the article outlines what it takes to transform the Person entity into a “rich” domain object, which internally uses a NotificationService to perform additional logic when the link method is called. This service will be ‘magically’ injected on demand. At this point the following can be achieved:

Далее в общих чертах будет описано, что необходимо, чтобы трансформировать сущность "Person" в объект предметной области с широкими возможностями, использующий NotificationService для реализации дополнительной логической схемы при обращении к цепному методу. Данный сервис будет волшебным образом внедряться по запросу. На этой стадии может быть достигнуто следующее:

History of edits (Latest: Night 1 year, 9 months ago) §
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8 9 10 11