A classic from 2007. This is a presentationthat I gave at SpringOne in Antwerp, Belgium. It describes show to improve application design by using a rich domain model
Apresentação sobre NestJS, framework Node.js e Typescript, com explicação do seu funcionamento e exemplos práticos de como utiliza-lo para criar aplicações do lado servidor.
Evento: OpenLabs 2019 - VI Conferência de Tecnologia da Região Serrana - 31/03/2019
Disponível também em: https://github.com/openlabsconf/openlabs-vi
Site do evento: http://openlabsconf.com.br/
Apresentação sobre NestJS, framework Node.js e Typescript, com explicação do seu funcionamento e exemplos práticos de como utiliza-lo para criar aplicações do lado servidor.
Evento: OpenLabs 2019 - VI Conferência de Tecnologia da Região Serrana - 31/03/2019
Disponível também em: https://github.com/openlabsconf/openlabs-vi
Site do evento: http://openlabsconf.com.br/
The Large Hadron Collider (LHC) is the world's largest and most powerful particle collider, most complex experimental facility ever built,
Largest single machine in the world.
It was built by the European Organization for Nuclear Research (CERN) between 1998 & 2008
10,000 scientists and engineers from over 100 countries,
Lies in a tunnel 27 kilometres (17 mi) in circumference, as deep as 175 metres (574 ft) beneath the France–Switzerland border near Geneva, Switzerland,
Μια βιβλιογραφική προσέγγιση του θέματος των ανυψωτικών μηχανημάτων, τα είδη και οι βασικές λειτουργίες του, καθώς και τα ζητήματα νομοθεσίας και ασφάλειας που διέπουν τον χειρισμό τους.
Xtext beyond the defaults - how to tackle performance problemsHolger Schill
Nearly every Eclipse user is aware what Xtext is and what it is useful for. It is always a pleasure to see in which kind of areas it is used.
One reason is clearly, that it is really easy to build a first working example in no time. The grammar alone is sufficient and the rest is done by a code generator. Xtext will generate stub classes, that are ready to fill in individual logic for different areas.
By doing that most of the things just work, because Xtext comes with a lot of defaults that suits in most of the cases.
But as projects get bigger and the amount of models grow, the defaults might not scale and you might need to tweak your language to make working smooth again.
Here it becomes more complicated and you need to understand what’s going on under the covers.
In this session I will go through typical problems and solutions, that we have seen in customer projects. Sometimes it’s a tradeoff to tackle those problems, but it’s important to understand the implications.
For some typical examples I will go into details and explain what’s going on under the covers.
After the session attendees should have an idea how to tweak their own languages and why it might be worth the effort to migrate to a newer version of Xtext.
The Large Hadron Collider (LHC) is the world's largest and most powerful particle collider, most complex experimental facility ever built,
Largest single machine in the world.
It was built by the European Organization for Nuclear Research (CERN) between 1998 & 2008
10,000 scientists and engineers from over 100 countries,
Lies in a tunnel 27 kilometres (17 mi) in circumference, as deep as 175 metres (574 ft) beneath the France–Switzerland border near Geneva, Switzerland,
Μια βιβλιογραφική προσέγγιση του θέματος των ανυψωτικών μηχανημάτων, τα είδη και οι βασικές λειτουργίες του, καθώς και τα ζητήματα νομοθεσίας και ασφάλειας που διέπουν τον χειρισμό τους.
Xtext beyond the defaults - how to tackle performance problemsHolger Schill
Nearly every Eclipse user is aware what Xtext is and what it is useful for. It is always a pleasure to see in which kind of areas it is used.
One reason is clearly, that it is really easy to build a first working example in no time. The grammar alone is sufficient and the rest is done by a code generator. Xtext will generate stub classes, that are ready to fill in individual logic for different areas.
By doing that most of the things just work, because Xtext comes with a lot of defaults that suits in most of the cases.
But as projects get bigger and the amount of models grow, the defaults might not scale and you might need to tweak your language to make working smooth again.
Here it becomes more complicated and you need to understand what’s going on under the covers.
In this session I will go through typical problems and solutions, that we have seen in customer projects. Sometimes it’s a tradeoff to tackle those problems, but it’s important to understand the implications.
For some typical examples I will go into details and explain what’s going on under the covers.
After the session attendees should have an idea how to tweak their own languages and why it might be worth the effort to migrate to a newer version of Xtext.
NoSQL databases such as Redis, MongoDB and Cassandra are emerging as a compelling choice for many applications. They can simplify the persistence of complex data models and offer significantly better scalability and performance. However, using a NoSQL database means giving up the benefits of the relational model such as SQL, constraints and ACID transactions. For some applications, the solution is polyglot persistence: using SQL and NoSQL databases together.
In this talk, you will learn about the benefits and drawbacks of polyglot persistence and how to design applications that use this approach. We will explore the architecture and implementation of an example application that uses MySQL as the system of record and Redis as a very high-performance database that handles queries from the front-end. You will learn about mechanisms for maintaining consistency across the various databases.
Polygot persistence for Java Developers - August 2011 / @OakjugChris Richardson
Relational databases have long been considered the one true way to persist enterprise data. But today, NoSQL databases are emerging as a viable alternative for many applications. They can simplify the persistence of complex data models and offer significantly better scalability, and performance. But NoSQL databases are very different than the ACID/SQL/JDBC/JPA world that we have become accustomed to. In this presentation, you will learn about our experience implementing a use case from POJOs in Action using popular NoSQL databases: Redis, MongoDB, and Cassandra. We will compare and contrast each database’s data model and Java API. You will learn about the benefits and drawbacks of using NoSQL.
Developing applications with Cloud Services (Devnexus 2013)Chris Richardson
Cloud computing isn’t just about application deployment. There are also a growing number of cloud-based web services that you can use to develop your application. One of the most well known is Amazon’s Simple Storage Service. But there are many others including web services for messaging, relational and NoSQL databases, email and telephony. Using these services allows you to build highly scalable applications without the pain and cost of having to develop and operate your own infrastructure.
In this presentation, you will learn about the benefits and drawbacks of these Web services; their typical use cases and how to use them. We will describe a location aware, telephony application that is built using cloud services. You will learn about strategies for building resilient, fault tolerant applications that consume cloud services.
Developing applications with Cloud Services #javaone 2012Chris Richardson
Cloud computing isn't just about application deployment. There are also a growing number of cloud-based web services that you can use to develop your application. One of the most well known is Amazon's Simple Storage Service. But there are many others including web services for messaging, relational and NoSQL databases, email and telephony. Using these services allows you to build highly scalable applications without the pain and cost of having to develop and operate your own infrastructure.
In this presentation, you will learn about the benefits and drawbacks of these Web services; their typical use cases and how to use them. We will describe a location aware, telephony application that is built using cloud services. You will learn about strategies for building resilient, fault tolerant applications that consume cloud services.
Developing polyglot applications on Cloud Foundry (#oredev 2012)Chris Richardson
Developing web applications used to be simple. Your single war-file web application served up HTML to a desktop browser and used a relational database. Today however, web applications are much more complex: the front-end uses HTML5 and NodeJS, the middle tier is decomposed into multiple services, and the back-end uses a mix of SQL and NoSQL databases. Developing these kind of applications can be challenging since there are so many moving parts that need to be correctly installed and configured. Deployment is even more difficult.
In this talk, you will learn why we need to build applications with this architectural style and how Cloud Foundry, which is modern, multi-lingual, multi-service, extensible open-source PaaS, can help. We will talk about how to develop modern applications that run on Cloud Foundry and cover what’s new and different about the cloud environment. You will learn how your application can consume the various services that are provided by Cloud Foundry. We will discuss the various ways of using Cloud Foundry including the Micro Cloud that runs on a laptop as well as the hosted CloudFoundry.com.
NoSQL databases such as Redis, MongoDB and Cassandra are emerging as a compelling choice for many applications. They can simplify the persistence of complex data models and offer significantly better scalability and performance. However, using a NoSQL database means giving up the benefits of the relational model such as SQL, constraints and ACID transactions. For some applications, the solution is polyglot persistence: using SQL and NoSQL databases together.
In this talk, you will learn about the benefits and drawbacks of polyglot persistence and how to design applications that use this approach. We will explore the architecture and implementation of an example application that uses MySQL as the system of record and Redis as a very high-performance database that handles queries from the front-end. You will learn about mechanisms for maintaining consistency across the various databases.
Decomposing applications for scalability and deployability - svcc sv_code_ca...Chris Richardson
Today, there are several trends that are forcing application architectures to evolve. Users expect a rich, interactive and dynamic user experience on a wide variety of clients including mobile devices. Applications must be highly scalable, highly available and run on cloud environments. Organizations often want to frequently roll out updates, even multiple times a day. Consequently, it’s no longer adequate to develop simple, monolithic web applications that serve up HTML to desktop browsers.
In this talk we describe the limitations of a monolithic architecture. You will learn how to use the scale cube to decompose your application into a set of narrowly focused, independently deployable back-end services and an HTML 5 client. We will also discuss the role of technologies such as NodeJS and AMQP brokers. You will learn how a modern PaaS such as Cloud Foundry simplifies the development and deployment of this style of application.
Decomposing applications for scalability and deployability (devnexus 2013)Chris Richardson
Today, there are several trends that are forcing application architectures to evolve. Users expect a rich, interactive and dynamic user experience on a wide variety of clients including mobile devices. Applications must be highly scalable, highly available and run on cloud environments. Organizations often want to frequently roll out updates, even multiple times a day. Consequently, it’s no longer adequate to develop simple, monolithic web applications that serve up HTML to desktop browsers.
In this talk we describe the limitations of a monolithic architecture. You will learn how to use the scale cube to decompose your application into a set of narrowly focused, independently deployable back-end services and an HTML 5 client. We will also discuss the role of technologies such as NodeJS and AMQP brokers. You will learn how a modern PaaS such as Cloud Foundry simplifies the development and deployment of this style of application.
This is 30 minute GlueCon 2013 version of a much longer talk. See http://plainoldobjects.com/presentations/developing-polyglot-persistence-applications/ for other versions and the example code.
NoSQL databases such as Redis, MongoDB and Cassandra are emerging as a compelling choice for many applications. They can simplify the persistence of complex data models and offer significantly better scalability and performance. However, using a NoSQL database means giving up the benefits of the relational model such as SQL, constraints and ACID transactions. For some applications, the solution is polyglot persistence: using SQL and NoSQL databases together.
In this talk, you will learn about the benefits and drawbacks of polyglot persistence and how to design applications that use this approach. We will explore the architecture and implementation of an example application that uses MySQL as the system of record and Redis as a very high-performance database that handles queries from the front-end. You will learn about mechanisms for maintaining consistency across the various databases.
NodeJS: the good parts? A skeptic’s view (jax jax2013)Chris Richardson
JavaScript used to be confined to the browser. But these days, it's becoming increasingly popular in server-side applications in the form of Node.js. Node.js provides event-driven, non-blocking I/O model that supposedly makes it easy to build scalable network application. In this talk you will learn about the consequences of combining the event-driven programming model with a prototype-based, weakly typed, dynamic language. We will share our perspective as a server-side Java developer who wasn’t entirely happy about JavaScript in the browser, let alone on the server. You will learn how to use Node.js effectively in modern, polyglot applications.
Watch the video: http://www.youtube.com/watch?v=CN0jTnSROsk&feature=youtu.be
Microservices pattern language (microxchg microxchg2016)Chris Richardson
My talk from http://microxchg.io/2016/index.html.
Here is the video - https://www.youtube.com/watch?v=1mcVQhbkA2U
When architecting an enterprise Java application, you need to choose between the traditional monolithic architecture consisting of a single large WAR file, or the more fashionable microservices architecture consisting of many smaller services. But rather than blindly picking the familiar or the fashionable, it’s important to remember what Fred Books said almost 30 years ago: there are no silver bullets in software. Every architectural decision has both benefits and drawbacks. Whether the benefits of one approach outweigh the drawbacks greatly depends upon the context of your particular project. Moreover, even if you adopt the microservices architecture, you must still make numerous other design decisions, each with their own trade-offs.
A software pattern is an ideal way of describing a solution to a problem in a given context along with its tradeoffs. In this presentation, we describe a pattern language for microservices. You will learn about patterns that will help you decide when and how to use microservices vs. a monolithic architecture. We will also describe patterns that solve various problems in a microservice architecture including inter-service communication, service registration and service discovery.
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Chris Richardson
Higher-order functions such as map(), flatmap(), filter() and reduce() have their origins in mathematics and ancient functional programming languages such as Lisp. But today they have entered the mainstream and are available in languages such as JavaScript, Scala and Java 8. They are well on their way to becoming an essential part of every developer’s toolbox.
In this talk you will learn how these and other higher-order functions enable you to write simple, expressive and concise code that solve problems in a diverse set of domains. We will describe how you use them to process collections in Java and Scala. You will learn how functional Futures and Rx (Reactive Extensions) Observables simplify concurrent code. We will even talk about how to write big data applications in a functional style using libraries such as Scalding.
The domain model is an abstraction of the problem domain that your system supports. It contains the objects and operations that are crucial to your system and its users. Therefore the design of the domain model deserves the utmost care and attention. In this session you will be introduced to Domain-Driven Design and you will learn how to put Domain-Driven Design (DDD) into practice. We will explore how to apply DDD on tactical level to design a rich domain model that encapsulates behaviour, protects its invariants and can be tested in isolation from its runtime environment
An Architectural Model for Adapting Domain-Specific AOM Applicationseduardomg23
An Adaptive Object Model (AOM) is a common architectural style for systems in which classes, attributes, relationships and behaviors of applications are represented as metadata consumed at runtime. This allows them to be very flexible and changeable at runtime not only by programmers, but also by end users, improving system time-to-market. Nevertheless, this flexibility comes with a cost of a greater complexity when developing the system, and therefore one usually uses a bottom-up approach, adding flexibility only when and where it is needed. As a consequence, many AOM applications are tied to the specific domain to which they were developed and this fact makes it difficult to develop and use generic and reusable AOM frameworks that properly handle specific requirements of the AOM architecture. This work presents an architectural model that aims to adapt domain-specific AOM core structures to a common core structure by identifying AOM roles played by each element through custom metadata configuration. By doing this, this model allows the integration of domain-specific AOM applications and AOM frameworks, making it feasible to develop reusable components for the AOM architecture. This model is evaluated by creating an AOM framework and performing a modularity analysis on a case study based on it.
Presentation of a paper published on SBCARS 2012 and available on http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=6394972&contentType=Conference+Publications&sortType%3Dasc_p_Sequence%26filter%3DAND%28p_IS_Number%3A6394968%29
"An introduction to object-oriented programming for those who have never done...Fwdays
Programmers have been using an approach they call “object-oriented programming” since the 1980s. That crowd had always been unable to accept that what they were actually doing was just “class-oriented programming,” or abstract data types. Object-oriented programming is a whole different story, and few design methods or programming languages ever evolved to support it. Winding back history’s clock to Alan Kay’s original notion of what objects were envisioned to be, Jim Coplien and Trygve Reenskaug have laid new foundations for real object-oriented programming. It’s called DCI: Data, Context, and Interaction. We see these principles exemplified in the trygve programming language.
This talk will overview why real object-oriented programming is important, will illustrate the principles of the DCI paradigm with concrete code, and will present formal research results showing the superiority of the DCI approach.
Valuable contributions to this topic have been made by:
James O. Coplien, Gertrud & Cope
Héctor Adrián Valdecantos, RIT
Mehdi Mirakhorli, RIT
“Program to an interface, not an implementation” they[1] say …
But when IMyInterface foo = new IMyInterface() is not valid code … how are you supposed to achieve that ? The answer is Dependency Injection.
In this talk, we’ll talk about Dependency injection, what it is and what it is not. We’ll see how it is a valuable set of practices and patterns that help design maintainable software built on top of the SOLID object-oriented principles.
We’ll see how, when used properly, it delivers many benefits such as extensibility and testability … We’ll also cover some anti-patterns, ways of using Dependency Injection that can lead to code that is painful to understand and maintain
This talk is not about DI/IOC containers per se, but focuses on the core concepts of Dependency Injection. Those concepts are essential to understand how to use those “magic-looking” tools (if they are needed at all …)
This talk is not only for .NET developers. It will contain code examples written in C#, but should be understandable by developers with knowledge in other statically-typed object-oriented languages such as Java, Vb.NET, C++ …
In Visual Studios C# console app using multiple class files create a.pdfsanjeevbansal1970
In Visual Studios C# console app using multiple class files create a checking account.
Objectives:
- Create an inheritance hierarchy that a bank might use to represent customers' bank accounts;
deposit, withdraw.
- Saving accounts earn money, checking accounts charge money for use.
- Validate the data coming in and throw exceptions if invalid.
Account class
- private decimal balance
+ public Account (decimal balance)
+ public Credit (decimal deposit)
+ public Debit (decimal withdraw)
+ public getBalance()
SavingsAccount extends Account
- private decimal interestRate
+ public SavingsAccount (decimal balance, decimal interestRate)
+ public decimal CalculateInterest()
CheckingAccount extends Account
- private decimal transactionFee
+ public CheckingAccount (decimal balance, decimal transactionFee)
* public Debit()
* public Credit()
Account class
- private decimal balance
+ public Account (decimal balance)
+ public Credit (decimal deposit)
+ public Debit (decimal withdraw)
+ public getBalance()
SavingsAccount extends Account
- private decimal interestRate
+ public SavingsAccount (decimal balance, decimal interestRate)
+ public decimal CalculateInterest()
CheckingAccount extends Account
- private decimal transactionFee
+ public CheckingAccount (decimal balance, decimal transactionFee)
* public Debit()
* public Credit().
Every software developer knows object oriented programming; in fact most use it every day. Using OOP enables code reuse and creates readable and maintainable code.
But there are places where object oriented is just not enough. There are features that cut across the entire system such as security, logging and transaction handling which are hard to implement efficiently using the OO paradigm.
Aspect Oriented Programming (AOP) helps us deal with these application-wide concerns by adding a high level of reuse to the traditional OOP framework.
In this session I'll explain what AOP is all about and how it can be implemented in .NET using simple methods and industrial grade frameworks to improve the developer's everyday work by using aspects.
This is a Introduction to Object Oriented (OO) Concepts, Java Programming Language and leveraging Eclipse (IBM WebSphere) to develop Java applications.
This is based on JDK 1.4 concepts/features. A newer version maybe provided at a future date.
Cooking your Ravioli "al dente" with Hexagonal ArchitectureJeroen Rosenberg
Hexagonal architecture (a.k.a. ports and adapters) is a fancy name for designing your application in a way that the core domain is separated from the outside world by input and output ports. With a little bit of imagination one can visualise this as a hexagon made up of domain objects, use cases that operate on them, and input and output ports that provide an interface to the outside world.
Many projects involve integration or communication with external software systems. Think of databases, 3rd party services, but also application platforms or SDKs. Such integrations and dependencies can quickly get in your way, clutter your core domain and reduce the testability of your core business logic. In this talk, I will demonstrate how a hexagonal architecture helps you to reduce dependencies on external software systems and enables you to apply standard software engineering best practices on the core domain of your application, such as testability, separation of concerns, and reusability.
Join this talk to learn the ins and outs (pun intended) of the hexagonal architecture paradigm and get practical advice and examples to apply to your software projects right away!
Real Object-Oriented Programming: Empirically Validated Benefits of the DCI P...James Coplien
"Real Object-Oriented Programming." Talk by James Coplien at nor(dev):con 2020 in Norwich. Based also on work by Héctor Adrián Valdecantos, and Mehdi Mirakhorli. 28 February 2020.
Chicago Coder Conference 2015
Speaker Biography: Wei Ru
Wei Ru has over 15 years of professional experience in design and development of Java enterprise applications across multiple industries. Currently he works as a technical architect at STA Group, LLC. He received a M.S. degree in Computer Science from Loyola University Chicago. As a software developer with an emphasis on Java, he strongly believes in software re-usability, open standards, and various best practices. He has successfully delivered many products using open source platforms and frameworks during his IT consultancies.
Speaker Biography: Vincent Lau
Vincent Lau has been Senior Architect at STA Group in Chicago for the last two years. He received a B.S. degree in Accounting and Finance from the University of Illinois at Chicago and worked on M.S. of Computer Science at DePaul University. He has over 15 years of software design, development, testing and project management experience on large enterprise distributed computing platforms. Most recently, he has worked on web based applications using Java, Spring, JavaScript, Angular.js, jQuery and web services. He previously had Senior Software Engineer and Lead positions in Royal Caribbean Cruises, Wells Fargo Bank, Cap Gemini America and Trans Union Corp.
Presentation: Practical AngularJS
AngularJS has been seen gaining momentum recently. Whether you want to develop a modern single-page application or to spice up only the view enabled by a traditional MVC web framework, AngularJS allows you to write cleaner, shorter code. AngularJS’ two-way data binding feature allows a declarative approach on views and controllers, and ultimately code modulization. With this strategic change and many features offered by AngularJS, learning AngularJS can be challenging. In this session, we will share some of the experiences we had in Angular UI development, we will cover:
AngularJS modules and common project setup
Communicating to a Restful service
Commonly used Angular functions, directives
UI Bootstrap, grid views and forms in AngularJS
Custom Angular directives
Asynchronous functions and event processing
Joining the Club: Using Spark to Accelerate Big Data at Dollar Shave ClubData Con LA
Abstract:-
Data engineering at Dollar Shave Club has grown significantly over the last year. In that time, it has expanded in scope from conventional web-analytics and business intelligence to include real-time, big data and machine learning applications. We have bootstrapped a dedicated data engineering team in parallel with developing a new category of capabilities. And the business value that we delivered early on has allowed us to forge new roles for our data products and services in developing and carrying out business strategy. This progress was made possible, in large part, by adopting Apache Spark as an application framework. This talk describes what we have been able to accomplish using Spark at Dollar Shave Club.
Bio:-
Brett Bevers, Ph.D. Brett is a backend engineer and leads the data engineering team at Dollar Shave Club. More importantly, he is an ex-academic who is driven to understand and tackle hard problems. His latest challenge has been to develop tools powerful enough to support data-driven decision making in high value projects.
Any structure expected to stand the test of time and change needs a strong foundation! Software is no exception. Engineering your code to grow in a stable and effective way is critical to your ability to rapidly meet the growing demands of users, new features, technologies, and platform capabilities. Join us to obtain architect-level design patterns for use in your Apex code to keep it well factored, easy to maintain, and in line with platform best practices. You'll follow a Force.com interpretation of Martin Fowler's Enterprise Architecture Application patterns, and the practice of Separation of Concerns.
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019Victor Rentea
Are you in a mood for a brainstorm? Join this critical review of the major decisions taken in a typical enterprise application architecture and learn to balance pragmatism with your design goals. Find out how to do just-in-time design to keep as much use-cases as simple as possible. The core purpose of this presentation is to learn to strike a **balance between pragmatism and maintainability** in your design. Without continuous refactoring, a simple design will inevitably degenerate into a Big Ball of Mud, under the assault of the new features and bugfixes. On the other hand, very highly-factored code can burden the take-off of the development and end up freezing the mindset in some rigid 'a-priori' design. The end goal of this talk is to challenge you to rethink critically the architecture of your own systems, and seek ways to simplify it to match your actual needs, with a pragmatic mindset. "Architecture is the art of postponing decisions", said Uncle Bob. This talk takes this idea further and explains an optimal mindset about designing enterprise applications: Evolving (Continuously Refactoring) a Pragmatic (Simple), Clean (aka Onion) Architecture, aiming to provide Developer Safety™️ and Comfort™️. It’s the philosophy that Victor distilled over the past 5 years, designing and implementing 9 applications as IBM Lead Architect, and delivering trainings and advises to many other companies. You’ll learn how to break data into pieces (Fit Entities, Value Objects, Data Transfer Objects), how to keep the logic simple (Facades, Domain Services, logic extraction patterns, Mappers, AOP), layering to enforce boundaries (keeping DTOs out of your logic, Dependency Inversion Principle), and many more, all in a dynamic, interactive and extremely entertaining session.
Dropwizard with MongoDB and Google CloudYun Zhi Lin
Latest source code for this project can be found here:
https://github.com/yunspace/dropwizard-mongodb-billapi
Original reveal.js slides here: http://slides.com/yunzhilin/dropwizard-mongodb
The sole purpose of sharing these slides are to educate the beginners of IT and Computer Science/Engineering. Credits should go to the referred material and also CICRA campus, Colombo 4, Sri Lanka where I taught these in 2017.
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...GITS Indonesia
Salah satu front-end developer GITS Indonesia, Warsono, mengisi workshop di universitas, mengenai Vue.js.
Ikuti kami di kanal berikut, agar tidak ketinggalan acara seru:
Instagram: @gitsindonesia
LinkedIn: GITS Indonesia
Website: gits.id
Building and deploying microservices with event sourcing, CQRS and Docker (QC...Chris Richardson
In this talk we share our experiences developing and deploying a microservices-based application. You will learn about the distributed data management challenges that arise in a microservices architecture. We will describe how we solved them using event sourcing to reliably publish events that drive eventually consistent workflows and pdate CQRS-based views. You will also learn how we build and deploy the application using a Jenkins-based deployment pipeline that creates Docker images that run on Amazon EC2.
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
A chat about some of the most important principles in software development. Discover or get a refresher on these tried and tested techniques for designing better code.
Code: https://github.com/neilcrookes/SoSOLIDFu/
Similar to Improving application design with a rich domain model (springone 2007) (20)
A common microservice architecture anti-pattern is more the merrier. It occurs when an organization team builds an excessively fine-grained architecture, e.g. one service-per-developer. In this talk, you will learn about the criteria that you should consider when deciding service granularity. I'll discuss the downsides of a fine-grained microservice architecture. You will learn how sometimes the solution to a design problem is simply a JAR file.
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...Chris Richardson
This is a talk I gave at YOW! London 2022.
Let's imagine that you are responsible for an aging monolithic application that's critical to your business. Sadly, getting changes into production is a painful ordeal that regularly causes outages. And to make matters worse, the application's technology stack is growing increasingly obsolete. Neither the business nor the developers are happy. You need to modernize your application and have read about the benefits of microservices. But is the microservice architecture a good choice for your application?
In this presentation, I describe the dark energy and dark matter forces (a.k.a. concerns) that you must consider when deciding between the monolithic and microservice architectural styles. You will learn about how well each architectural style resolves each of these forces. I describe how to evaluate the relative importance of each of these forces to your application. You will learn how to use the results of this evaluation to decide whether to migrate to the microservice architecture.
Dark Energy, Dark Matter and the Microservices Patterns?!Chris Richardson
Dark matter and dark energy are mysterious concepts from astrophysics that are used to explain observations of distant stars and galaxies. The Microservices pattern language - a collection of patterns that solve architecture, design, development, and operational problems — enables software developers to use the microservice architecture effectively. But how could there possibly be a connection between microservices and these esoteric concepts from astrophysics?
In this presentation, I describe how dark energy and dark matter are excellent metaphors for the competing forces (a.k.a. concerns) that must be resolved by the microservices pattern language. You will learn that dark energy, which is an anti-gravity, is a metaphor for the repulsive forces that encourage decomposition into services. I describe how dark matter, which is an invisible matter that has a gravitational effect, is a metaphor for the attractive forces that resist decomposition and encourage the use of a monolithic architecture. You will learn how to use the dark energy and dark matter forces as guide when designing services and operations.
Dark energy, dark matter and microservice architecture collaboration patternsChris Richardson
Dark energy and dark matter are useful metaphors for the repulsive forces, which encourage decomposition into services, and the attractive forces, which resist decomposition. You must balance these conflicting forces when defining a microservice architecture including when designing system operations (a.k.a. requests) that span services.
In this talk, I describe the dark energy and dark matter forces. You will learn how to design system operations that span services using microservice architecture collaboration patterns: Saga, Command-side replica, API composition, and CQRS patterns. I describe how each of these patterns resolve the dark energy and dark matter forces differently.
It sounds dull but good architecture documentation is essential. Especially when you are actively trying to improve your architecture.
For example, I spend a lot time helping clients modernize their software architecture. More often than I like, I’m presented with a vague and lifeless collection of boxes and lines. As a result, it’s sometimes difficult to discuss the architecture in a meaningful and productive way. In this presentation, I’ll describe techniques for creating minimal yet effective documentation for your application’s microservice architecture. In particular, you will learn how documenting scenarios can bring your architecture to life.
Using patterns and pattern languages to make better architectural decisions Chris Richardson
This is a presentation that gave at the O'Reilly Software Architecture Superstream: Software Architecture Patterns.
The talk's focus is the microservices pattern language.
However, it also shows how thinking with the pattern mindset - context/problem/forces/solution/consequences - leads to better technically decisions.
The microservices architecture offers tremendous benefits, but it’s not a silver bullet. It also has some significant drawbacks. The microservices pattern language—a collection of patterns that solve architecture, design, development, and operational problems—enables software developers to apply the microservices architecture effectively. I provide an overview of the microservices architecture and examines the motivations for the pattern language, then takes you through the key patterns in the pattern language.
Rapid, reliable, frequent and sustainable software development requires an architecture that is loosely coupled and modular.
Teams need to be able complete their work with minimal coordination and communication with other teams.
They also need to be able keep the software’s technology stack up to date.
However, the microservice architecture isn’t always the only way to satisfy these requirements.
Yet, neither is the monolithic architecture.
In this talk, I describe loose coupling and modularity and why they are is essential.
You will learn about three architectural patterns: traditional monolith, modular monolith and microservices.
I describe the benefits, drawbacks and issues of each pattern and how well it supports rapid, reliable, frequent and sustainable development.
You will learn some heuristics for selecting the appropriate pattern for your application.
Events to the rescue: solving distributed data problems in a microservice arc...Chris Richardson
To deliver a large complex application rapidly, frequently and reliably, you often must use the microservice architecture.
The microservice architecture is an architectural style that structures the application as a collection of loosely coupled services.
One challenge with using microservices is that in order to be loosely coupled each service has its own private database.
As a result, implementing transactions and queries that span services is no longer straightforward.
In this presentation, you will learn how event-driven microservices address this challenge.
I describe how to use sagas, which is an asynchronous messaging-based pattern, to implement transactions that span services.
You will learn how to implement queries that span services using the CQRS pattern, which maintain easily queryable replicas using events.
A pattern language for microservices - June 2021 Chris Richardson
The microservice architecture is growing in popularity. It is an architectural style that structures an application as a set of loosely coupled services that are organized around business capabilities. Its goal is to enable the continuous delivery of large, complex applications. However, the microservice architecture is not a silver bullet and it has some significant drawbacks.
The goal of the microservices pattern language is to enable software developers to apply the microservice architecture effectively. It is a collection of patterns that solve architecture, design, development and operational problems. In this talk, I’ll provide an overview of the microservice architecture and describe the motivations for the pattern language. You will learn about the key patterns in the pattern language.
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureChris Richardson
Delivering large, complex software rapidly, frequently and reliably requires a loosely coupled organization. DevOps teams should rarely need to communicate and coordinate in order to get work done. Conway's law states that an organization and the architecture that it develops mirror one another. Hence, a loosely coupled organization requires a loosely coupled architecture.
In this presentation, you will learn about design-time coupling in a microservice architecture and why it's essential to minimize it. I describe how to design service APIs to reduce coupling. You will learn how to minimize design-time coupling by applying a version of the DRY principle. I describe how key microservices patterns potentially result in tight design time coupling and how to avoid it.
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Chris Richardson
In order to explain certain astronomical observations, physicists created the mysterious concepts of dark energy and dark matter.
Dark energy is a repulsive force.
It’s an anti-gravity that is forcing matter apart and accelerating the expansion of the universe.
Dark matter has the opposite attraction effect.
Although it’s invisible, dark matter has a gravitational effect on stars and galaxies.
In this presentation, you will learn how these metaphors apply to the microservice architecture.
I describe how there are multiple repulsive forces that drive the decomposition of your application into services.
You will learn, however, that there are also multiple attractive forces that resist decomposition and bind software elements together.
I describe how as an architect you must find a way to balance these opposing forces.
Skillsmatter CloudNative eXchange 2020
The microservice architecture is a key part of cloud native.
An essential principle of the microservice architecture is loose coupling.
If you ignore this principle and develop tightly coupled services the result will mostly likely be yet another "microservices failure story”.
Your application will be brittle and have all of disadvantages of both the monolithic and microservice architectures.
In this talk you will learn about the different kinds of coupling and how to design loosely coupled microservices.
I describe how to minimize design time and increase the productivity of your DevOps teams.
You will learn how how to reduce runtime coupling and improve availability.
I describe how to improve availability by minimizing the coupling caused by your infrastructure.
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...Chris Richardson
This is a talk I gave at DDD SoCal.
1. Make the most of your monolith
2. Adopt microservices for the right reasons
3. It’s not just architecture
4. Get the support of the business
5. Migrate incrementally
6. Know your starting point
7. Begin with the end in mind
8. Migrate high-value modules first
9. Success is improved velocity and reliability
10. If it hurts, don’t do it
Decompose your monolith: Six principles for refactoring a monolith to microse...Chris Richardson
This was a talk I gave at the CTO virtual summit on July 28th. It describes 6 principles for refactoring to a microservice architecture.
1. Make the most of your monolith
2. Adopt microservices for the right reasons
3. Migrate incrementally
4. Begin with the end in mind
5. Migrate high-value modules first
6. Success is improved velocity and reliability
The microservice architecture is becoming increasingly important. But what is it exactly? Why should you care about microservices? And, what do you need to do to ensure that your organization uses the microservice architecture successfully? In this talk, I’ll answer these and other questions. You will learn about the motivations for the microservice architecture and why simply adopting microservices is insufficient. I describe essential characteristics of microservices, You will learn how a successful microservice architecture consists of loosely coupled services with stable APIs that communicate asynchronously.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
2. Improving Applications Design with a
Rich Domain Model
Chris Richardson
Author of POJOs in Action
www.chrisrichardson.net
3. About Chris
Grew up in England
Live in Oakland, CA
Twenty years of software
development experience
– Building object-oriented software
since 1986
– Using Java since 1996
– Using J2EE since 1999
Author of POJOs in Action
Speaker at JavaOne, JavaPolis,
NFJS, JUGs, ….
Chair of the eBIG Java SIG in
Oakland (www ebig org)
(www.ebig.org)
Run a consulting and training
company that helps organizations
build better software faster
4. Overall presentation goal
Learn how to improve application design
with truly object-oriented business logic
5. Agenda
The
Th ups and d
d downs of OO design
f d i
Overview of the Domain Model pattern
Domain model building blocks
Common code smells
Refactoring existing code
6. Designing business logic
Spring promotes good design practices:
– Dependency injection for loose coupling
– AOP for handling cross cutting concerns
But you must decide how to structure your
business logic:
– Domain Model pattern – object-oriented
– Transaction Script pattern – procedural
Choice of pattern impacts ease of:
– Development testing maintainability ….
Development, testing, maintainability,
7. Lots of procedural Java code
Java is an object oriented language
object-oriented
AND
Object-oriented design is a better way to tackle complexity
YET
Many complex enterprise Java applications are written in a
procedural style
10. Example procedural code
public class MoneyTransferServiceProceduralImpl implements MoneyTransferService { public class Account {
p
public BankingTransaction transfer(String fromAccountId, String toAccountId,
g ( g , g , p
public static final int NEVER = 1;
;
double amount) throws MoneyTransferException { public static final int ALLOWED = 2;
Account fromAccount = accountDAO.findAccount(fromAccountId);
Account toAccount = accountDAO.findAccount(toAccountId); private int id;
assert amount > 0; private double balance;
double newBalance = fromAccount.getBalance() - amount; private int overdraftPolicy;
switch (fromAccount.getOverdraftPolicy()) { private String accountId;
case Account.NEVER: private Date dateOpened;
if (newBalance < 0) private double requiredYearsOpen;
throw new MoneyTransferException("In sufficient funds"); private double limit;
break;
case Account.ALLOWED: Account() {}
Calendar then = Calendar.getInstance();
then.setTime(fromAccount.getDateOpened());
Calendar now = Calendar.getInstance(); public Account(String accountId, double balance, int
overdraftPolicy,
double yearsOpened = now.get(Calendar.YEAR) - then.get(Calendar.YEAR); Date dateOpened, double requiredYearsOpen,
int monthsOpened = now.get(Calendar.MONTH) - then.get(Calendar.MONTH); double limit)
if (monthsOpened < 0) { {….. }
yearsOpened--;
O d
monthsOpened += 12; public int getId() {return id;}
}
yearsOpened = yearsOpened + (monthsOpened / 12.0); public String getAccountId() {return accountId;}
if (yearsOpened < fromAccount.getRequiredYearsOpen()
|| newBalance < fromAccount.getLimit()) public void setBalance(double balance) { this.balance = balance; }
throw new MoneyTransferException("Limit exceeded");
break; public double getBalance() { return balance; }
default:
throw new MoneyTransferException( Unknown overdraft type: "
MoneyTransferException("Unknown public int getOverdraftPolicy() { return overdraftPolicy; }
+ fromAccount.getOverdraftPolicy());
public Date getDateOpened() { return dateOpened; }
}
fromAccount.setBalance(newBalance); public double getRequiredYearsOpen() {
toAccount.setBalance(toAccount.getBalance() + amount); return requiredYearsOpen; }
TransferTransaction txn = new TransferTransaction(fromAccount, toAccount,
amount, new Date()); public double getLimit() {return limit; }
bankingTransactionDAO.addTransaction(txn); }
return txn;
}
11. A seductive programming style
Implementing new f
I l ti functionality i easy
ti lit is
– Add a new transaction script
– Add code to a new transaction script
No need to do any real design, e.g.
– Create new classes
– Determine responsibilities
p
12. Unable to handle complexity
Works well for simple business logic
– E.g. the example wasn’t that bad
But with complex business logic:
– Large transaction scripts: 100s/1000s LOC
– Difficult/impossible to understand, test, and maintain
What’s worse: business logic has a habit of
growing
– New requirements ⇒ Add a few more lines to the
transaction script
– Many new requirements ⇒ big mess
13. Today – OO is growing in popularity
POJOs
– Plain Old Java Objects
– Leverage OO features of Java
O/R mapping frameworks for
persisting POJO
i ti POJOs:
– Hibernate
– Java Persistence API
– …
Spring AOP and AspectJ for
handling cross-cutting
concerns:
– Transaction management
– Security
– Logging
– Auditing
– …
14. Agenda
The
Th ups and d
d downs of OO design
f d i
Overview of the Domain Model pattern
Domain model building blocks
Common code smells
Refactoring existing code
15. Using the Domain Model Pattern
Business l i spread amongst a collection of
B i logic d t ll ti f
classes
Many classes correspond to real world concepts:
Order, Customer, …
Many classes are true objects having both:
– State – fields
– Behavior – methods that act on the state
19. Benefits of the Domain Model Pattern
Improved maintainability
– The design reflects reality
– The design is more modular
Improved testability
– Small classes that can be tested in isolation
Improved reusability
– Classes can be used in other applications
Building a domain model
g
– Creates shared understanding
– Develops an ubiquitous language
21. Drawbacks of the Domain Model pattern
Requires object-oriented d i skills
R i bj t i t d design kill
Requires domain model to be
transparently “mappable” to the data
– E.g. nice database schema
– Ugly schemas and data stored in other
applications is a challenge
22. When to use it
The b i
Th business l i i reasonably complex
logic is bl l
or you anticipate that it will be
You have the skills to design one
You can use an ORM framework
23. Agenda
The
Th ups and d
d downs of OO design
f d i
Overview of the Domain Model pattern
Domain model building blocks
Common code smells
Refactoring existing code
24. Domain model building blocks
Roles k
R l aka
stereotypes
Benefits of roles:
– Guide design
– Help name objects
– Aid understanding
Roles (from Domain-
Domain
Driven Design)
25. Entity
public class Account {
Objects ith di ti t
Obj t with a distinct private int id;
identity private double balance;
private OverdraftPolicy overdraftPolicy;
Typically correspond private String accountId;
private CalendarDate dateOpened;
to real world concepts Account() {
}
Almost always public void debit(double amount) throws MoneyTransferException {
assert amount > 0;
double originalBalance = balance;
persistent double newBalance = balance - amount;
overdraftPolicy.beforeDebitCheck(this, originalBalance, newBalance);
balance = newBalance;
overdraftPolicy.afterDebitAction(this, originalBalance, newBalance);
}
public void credit(double amount) {
assert amount > 0;
balance += amount;
}
26. Value Objects
Objects that are public class CalendarDate {
private Date date;
defined by the values CalendarDate() {
}
of their attributes public CalendarDate(Date date) {
this.date = date;
Two instances with }
public Date getDate() {
identical values can }
return date;
be
b used d public double getYearsOpen() {
Calendar then = Calendar.getInstance();
then.setTime(date);
interchangeably Calendar now = Calendar.getInstance();
int yearsOpened = now.get(Calendar.YEAR) –
Often immutable and then.get(Calendar.YEAR);
int monthsOpened = now.get(Calendar.MONTH) -
then.get(Calendar.MONTH);
persistent if (monthsOpened < 0) {
yearsOpened--;
monthsOpened += 12;
}
Part of an entityy return yearsOpened + (monthsOpened/12.0);
}
}
27. Aggregates
A cluster of related
entities and values
Behaves as a unit
Has a root
Has a bou da y
as boundary
Objects outside the
aggregate can only
reference the root
f
Deleting the root
removes everything
28. Repositories
public interface AccountRepository {
Manages a collection of Account findAccount(String accountId);
objects void addAccount(Account account);
Provides methods for: }
Adding an object
public class HibernateAccountRepository implements AccountRepository {
Finding object or objects
private HibernateTemplate hibernateTemplate;
Deleting objects public HibernateAccountRepository(HibernateTemplate template) {
hibernateTemplate = template;
p p
Consists of an interface and an }
implementation class public void addAccount(Account account) {
hibernateTemplate.save(account);
Encapsulates database access }
mechanism public Account findAccount(final String accountId) {
return (Account) DataAccessUtils.uniqueResult(hibernateTemplate
.findByNamedQueryAndNamedParam(
Keeps the ORM framework out "Account.findAccountByAccountId", "accountId",
accountId));
of the domain model }
Similar to a DAO }
29. Services
public interface MoneyTransferService {
Implements logic that cannot BankingTransaction transfer(String fromAccountId,
be put in a single entity String toAccountId, double amount)
throws MoneyTransferException;
Not persistent }
Consists of an interface and an
implementation class public class MoneyTransferServiceImpl implements MoneyTransferService
{
Service method usually: private final AccountRepository accountRepository;
Invoked (indirectly) by p
private final BankingTransactionRepository
g p
bankingTransactionRepository;
y
presentation tier public MoneyTransferServiceImpl(AccountRepository accountRepository,
BankingTransactionRepository bankingTransactionRepository) {
Invokes one or more this.accountRepository = accountRepository;
this.bankingTransactionRepository = bankingTransactionRepository;
repositories }
Invokes one or more entities public BankingTransaction transfer(String fromAccountId,
String toAccountId, double amount) {
…
Keep them thin }
}
30. Factories
Use when a constructor is insufficient
– Encapsulates complex object creation logic
– Varying products
Different kinds of factories
–F t
Factory classes
l
– Factory methods
Example: O d F t
E l OrderFactory
– Creates Order from a shopping cart
– Add li it
Adds line items
31. Role of Spring 1
Use the
U th POJO programming model
i d l
– Minimize dependencies on infrastructure frameworks:
your domain model might outlive them
– Avoid @DoThisAnnotations: e.g. @Transactional
Spring instantiates and wires together
– Services, factories and repositories
Dependency injection into entities
p y j
– One option is @Configurable but it’s not POJO
– Hibernate Interceptor/Manual injection is preferable
32. Role of Spring 2
Spring
S i AOP for service-level crosscutting
f i l l tti
concerns:
– E g transaction management, security logging etc
E.g. management security, etc.
AspectJ for entity and value object crosscutting
concerns
– E.g. tracking changes to fields
– AJC/Load-time weaving has a cost
g
Use Spring ORM in the repository
implementation classes
33. Agenda
The
Th ups and d
d downs of OO design
f d i
Overview of the Domain Model pattern
Domain model building blocks
Common code smells
Refactoring existing code
34. Overview of code smells
Code
C d smell = something about th code
ll thi b t the d
that does not seem right
Impacts ease of development and testing
Some are non-OOD
Some are the consequences of non-OOD
35. Long method
Methods should be short p
public class MoneyTransferServiceProceduralImpl implements MoneyTransferService {
y p p y
public BankingTransaction transfer(String fromAccountId, String toAccountId,
double amount) throws MoneyTransferException {
Account fromAccount = accountDAO.findAccount(fromAccountId);
But business logic is Account toAccount = accountDAO.findAccount(toAccountId);
assert amount > 0;
double newBalance = fromAccount.getBalance() - amount;
concentrated in the switch (fromAccount.getOverdraftPolicy()) {
case Account.NEVER:
if (newBalance < 0)
services ⇒ l
throw new MoneyTransferException( In sufficient funds");
MoneyTransferException("In funds );
i long methods
th d break;
case Account.ALLOWED:
Calendar then = Calendar.getInstance();
then.setTime(fromAccount.getDateOpened());
Long methods are difficult Calendar now = Calendar.getInstance();
double yearsOpened = now.get(Calendar.YEAR) - then.get(Calendar.YEAR);
int monthsOpened = now.get(Calendar.MONTH) - then.get(Calendar.MONTH);
to: if (monthsOpened < 0) {
yearsOpened--;
monthsOpened += 12
th O d + 12;
}
– Read and understand yearsOpened = yearsOpened + (monthsOpened / 12.0);
if (yearsOpened < fromAccount.getRequiredYearsOpen()
|| newBalance < fromAccount.getLimit())
throw new MoneyTransferException("Limit exceeded");
– Maintain break;
default:
throw new MoneyTransferException("Unknown overdraft type: "
– Test }
+ fromAccount.getOverdraftPolicy());
fromAccount.setBalance(newBalance);
Fix: toAccount.setBalance(toAccount.getBalance() + amount);
TransferTransaction txn = new TransferTransaction(fromAccount, toAccount,
amount, new Date());
bankingTransactionDAO.addTransaction(txn);
return txn;
– Splitting into smaller }
methods
36. Feature Envy
Methods that are far p
public class MoneyTransferServiceProceduralImpl implements MoneyTransferService {
y p p y
public BankingTransaction transfer(String fromAccountId, String toAccountId, double amount) throws
MoneyTransferException {
Account fromAccount = accountDAO.findAccount(fromAccountId);
too interested in data Account toAccount = accountDAO.findAccount(toAccountId);
assert amount > 0;
double newBalance = fromAccount.getBalance() - amount;
switch (fromAccount.getOverdraftPolicy()) {
belonging to other
g g case Account.NEVER:
if (newBalance < 0)
throw new MoneyTransferException( In sufficient funds");
break;
MoneyTransferException("In funds );
classes case Account.ALLOWED:
Calendar then = Calendar.getInstance();
then.setTime(fromAccount.getDateOpened());
Calendar now = Calendar.getInstance();
Results in: double yearsOpened = now.get(Calendar.YEAR) - then.get(Calendar.YEAR);
int monthsOpened = now.get(Calendar.MONTH) - then.get(Calendar.MONTH);
if (monthsOpened < 0) {
yearsOpened--;
monthsOpened += 12
th O d + 12;
– Poor encapsulation }
yearsOpened = yearsOpened + (monthsOpened / 12.0);
if (yearsOpened < fromAccount.getRequiredYearsOpen()
|| newBalance < fromAccount.getLimit())
– Long methods throw new MoneyTransferException("Limit exceeded");
break;
default:
throw new MoneyTransferException("Unknown overdraft type: "
+ fromAccount.getOverdraftPolicy());
Fix by moving }
fromAccount.setBalance(newBalance);
toAccount.setBalance(toAccount.getBalance() + amount);
methods to the class TransferTransaction txn = new TransferTransaction(fromAccount, toAccount,
amount, new Date());
bankingTransactionDAO.addTransaction(txn);
return txn;
that has the data
}
37. Data class
public class Account {
Classes that are j t
Cl th t just public static final int NEVER = 1;
public static final int ALLOWED = 2;
getters and setters private
private
int id;
double balance;
private int overdraftPolicy;
No business logic - private
private
private
String accountId;
Date dateOpened;
double requiredYearsOpen;
private double limit;
it’s in the service Account() {}
Leads to: public Account(String accountId, double balance, int overdraftPolicy,
{….. }
Date dateOpened, double requiredYearsOpen, double limit)
– Feature envy public int getId() {return id;}
public String getAccountId() {return accountId;}
Fix by moving public void setBalance(double balance) { this.balance = balance; }
public double getBalance() { return balance; }
methods that act on public int getOverdraftPolicy() { return overdraftPolicy; }
public Date getDateOpened() { return dateOpened; }
data into class public double getRequiredYearsOpen() { return requiredYearsOpen; }
public double getLimit() {return limit; }
}
38. Primitive Obsession
public class Account {
private Date dateOpened;
Code uses built in
built-in }
types instead of public class Account {
private Date dateOpened;
application classes }
public class MoneyTransferServiceProceduralImpl implements
Consequences:
C MoneyTransferService {
public BankingTransaction transfer(String fromAccountId, String
– Reduces toAccountId,
double amount) throws MoneyTransferException {
understandability Account fromAccount = accountDAO.findAccount(fromAccountId);
Account toAccount = accountDAO findAccount(toAccountId);
accountDAO.findAccount(toAccountId);
– L
Long methods
h d …
Calendar then = Calendar.getInstance();
– Code duplication then.setTime(fromAccount.getDateOpened());
Calendar now = Calendar.getInstance();
– Added complexity double yearsOpened = now.get(Calendar.YEAR) -
then.get(Calendar.YEAR);
int monthsOpened = now.get(Calendar.MONTH) –
Fix by moving data then.get(Calendar.MONTH);
if (monthsOpened < 0) {
and code into new yearsOpened--;
monthsOpened += 12;
class }
yea sOpe ed
yearsOpened = yea sOpe ed + (monthsOpened / 12.0);
yearsOpened ( o t sOpe ed 0);
if (yearsOpened < fromAccount.getRequiredYearsOpen()
|| newBalance < fromAccount.getLimit())
…
}
39. Switch Statements
public class Account {
Use of type codes and public static final int NEVER = 1;
switch statements instead public static final int ALLOWED = 2;
…
of polymorphism
Consequences:
C public class MoneyTransferServiceProceduralImpl
implements MoneyTransferService {
– Longer methods
public BankingTransaction transfer(String
– Poor maintainability caused fromAccountId, String toAccountId,
, g ,
by d duplication
b code d li i double amount) throws MoneyTransferException {
…
– Increased code complexity switch (fromAccount.getOverdraftPolicy()) {
case Account.NEVER:
Fix by introducing class …
break;
b k
hierarchy and moving case Account.ALLOWED:
…
each part of switch default:
…
statement into a }
overriding method }
…
40. Data clumps
Multiple fields or public class A
bli l Account {
t
method parameters public static final int NEVER = 1;
that belong together
g g public static final int ALLOWED = 2;
Consequences: private int id;
private double balance;
– Long methods private String accountId;
private
p i ate Date dateOpened
dateOpened;
– Duplication
private int overdraftPolicy;
Fix by: private double requiredYearsOpen;
– Moving fields into their private double limit;
own class Account() {}
– Eliminate resulting
}
Feature Envy
41. Agenda
The
Th ups and d
d downs of OO design
f d i
Overview of the Domain Model pattern
Domain model b ildi bl k
D i d l building blocks
Common code smells
Refactoring existing code
42. Transforming procedural code
Inside
I id every procedural d i i a
d l design is
domain model just trying to get out
Incrementally transform a procedural
design into an OO design
– Small, localized changes
– Something to do on Monday morning!
43. Refactoring to an OO design
Transform a
procedural design to
an OO design by
g y
applying refactorings
Refactoring:
– Restructure the code
– Without changing
behavior
Essential cleanups for
decaying code
44. Basic refactorings
Extract Method
– Eliminates long methods
Move Method
– Move a method to a
different class (field or
parameter)
– Moves method to where
the data i
th d t is
Push Down
– Move a method into
subclasses
– Optionally leave an
abstract method behind
– Part of eliminating
g
conditional logic
…
45. Compound refactorings
A sequence of simpler refactorings
Compose method
– Apply Extract Method repeatedly
– Use to replace long method with more readable shorter methods
Replace Type Code With Strategy
– Define GOF Strategy class for each type code
gy yp
Replace Conditional With Polymorphism
– Turn into part of a switch statement into an overriding method in
a subclass
Replace Data Value with Object
– Move field into it’s own class
– Eliminates Primitive Obsession
47. Summary
Organizes the business logic as classes
with state AND behavior
Improves maintainability and testability
Enabled by POJOs and non-invasive
frameworks
Incrementally apply by refactoring
Use It!
48. For more information
Buy my book ☺
– Go to manning.com
Send email:
chris@chrisrichardson.net
Visit my website:
http://www.chrisrichardson.net
http://www chrisrichardson net
Talk to me about consulting
and training