The document discusses various design patterns including the Abstract Factory, Adapter, and Chain of Responsibility patterns. It provides code examples to illustrate how each pattern can be implemented using functional programming principles and techniques like lambdas and streams. The Chain of Responsibility section shows how the pattern can be modeled as a linked list of handlers represented as a Stream.
Pragmatic functional refactoring with java 8 (1)RichardWarburton
You may be hearing a lot of buzz around functional programming. For example, Java 8 recently introduced new features (lambda expressions and method references) and APIs (Streams, Optional and CompletableFutures) inspired from functional ideas such as first-class functions, composition and immutability.
However, what does this mean for my existing codebase?
In this talk we show how you can refactor your traditional object-oriented Java to using FP features and APIs from Java 8 in a beneficial manner.
We will discuss:
* How to adapt to requirement changes using first-class functions
* How you can enhance code reusability using currying
* How you can make your code more robust by favouring immutability over mutability
* How you can design better APIs and reduce unintended null pointer exceptions using an optional data type
A draft of the DI talk. I think that concepts are Ok but the format must be changed. In any case the content is the most important here and that it is ok.
Why Testing your code?
Test your PHP code Using PhpUnit, learn the basics to write tests, mock your objects and perform both Unit and Functional testing, and learn about TDD.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Dat testing - An introduction to Java and Android TestingSaúl Díaz González
Testing is a part of software engineering process. You wouldn't promote a code you haven't tested to production, so why don't you use automated testing and actually reduce costs and increase the efficiency?
You can also learn how doing testing can put pressure on your code to improve your architecture.
4Developers 2015: Be pragmatic, be SOLID - Krzysztof MenżykPROIDEA
Krzysztof Menżyk
Language: Polish
Wiemy jak projektować dobry kod obiektowy? Ilu z nas zna 5 zasad SOLID? Ilu z nas przestrzega ich w codziennej pracy z kodem? Nie tylko wyjaśnię co to SOLID, ale również pokażę, że to nie sucha teoria a praktyczne rady, które warto aplikować w naszych projektach.
Podczas prezentacji szczegółowo omówię każdą z pięciu zasad. Pokażę konkretne przykłady, które naruszają ww. zasady. Zaprezentuję przykładowe rozwiązania i techniki refaktorowania kodu. Omówię również, w jakich sytuacjach można pominąć niektóre z zasad oraz jaki może to mieć wpływ na projekt.
Pragmatic Functional Refactoring with Java 8Codemotion
by Raoul-Gabriel Urma - You may be hearing a lot of buzz around functional programming. For example, Java 8 recently introduced new features and APIs inspired from functional ideas such as first-class functions, composition and immutability. In this talk we show how you can refactor your traditional object-oriented Java to using FP features and APIs from Java 8 in a beneficial manner. - How to adapt to requirement changes using first-class functions - How you can enhance code reusability using currying - How you can make your code more robust by favouring immutability over mutability - and more!
Pragmatic functional refactoring with java 8 (1)RichardWarburton
You may be hearing a lot of buzz around functional programming. For example, Java 8 recently introduced new features (lambda expressions and method references) and APIs (Streams, Optional and CompletableFutures) inspired from functional ideas such as first-class functions, composition and immutability.
However, what does this mean for my existing codebase?
In this talk we show how you can refactor your traditional object-oriented Java to using FP features and APIs from Java 8 in a beneficial manner.
We will discuss:
* How to adapt to requirement changes using first-class functions
* How you can enhance code reusability using currying
* How you can make your code more robust by favouring immutability over mutability
* How you can design better APIs and reduce unintended null pointer exceptions using an optional data type
A draft of the DI talk. I think that concepts are Ok but the format must be changed. In any case the content is the most important here and that it is ok.
Why Testing your code?
Test your PHP code Using PhpUnit, learn the basics to write tests, mock your objects and perform both Unit and Functional testing, and learn about TDD.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Dat testing - An introduction to Java and Android TestingSaúl Díaz González
Testing is a part of software engineering process. You wouldn't promote a code you haven't tested to production, so why don't you use automated testing and actually reduce costs and increase the efficiency?
You can also learn how doing testing can put pressure on your code to improve your architecture.
4Developers 2015: Be pragmatic, be SOLID - Krzysztof MenżykPROIDEA
Krzysztof Menżyk
Language: Polish
Wiemy jak projektować dobry kod obiektowy? Ilu z nas zna 5 zasad SOLID? Ilu z nas przestrzega ich w codziennej pracy z kodem? Nie tylko wyjaśnię co to SOLID, ale również pokażę, że to nie sucha teoria a praktyczne rady, które warto aplikować w naszych projektach.
Podczas prezentacji szczegółowo omówię każdą z pięciu zasad. Pokażę konkretne przykłady, które naruszają ww. zasady. Zaprezentuję przykładowe rozwiązania i techniki refaktorowania kodu. Omówię również, w jakich sytuacjach można pominąć niektóre z zasad oraz jaki może to mieć wpływ na projekt.
Pragmatic Functional Refactoring with Java 8Codemotion
by Raoul-Gabriel Urma - You may be hearing a lot of buzz around functional programming. For example, Java 8 recently introduced new features and APIs inspired from functional ideas such as first-class functions, composition and immutability. In this talk we show how you can refactor your traditional object-oriented Java to using FP features and APIs from Java 8 in a beneficial manner. - How to adapt to requirement changes using first-class functions - How you can enhance code reusability using currying - How you can make your code more robust by favouring immutability over mutability - and more!
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...SkillCertProExams
• For a full set of 760+ questions. Go to
https://skillcertpro.com/product/databricks-certified-data-engineer-associate-exam-questions/
• SkillCertPro offers detailed explanations to each question which helps to understand the concepts better.
• It is recommended to score above 85% in SkillCertPro exams before attempting a real exam.
• SkillCertPro updates exam questions every 2 weeks.
• You will get life time access and life time free updates
• SkillCertPro assures 100% pass guarantee in first attempt.
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij
This is a workshop about communication and collaboration. We will experience how we can analyze the reasons for resistance to change (exercise 1) and practice how to improve our conversation style and be more in control and effective in the way we communicate (exercise 2).
This session will use Dave Gray’s Empathy Mapping, Argyris’ Ladder of Inference and The Four Rs from Agile Conversations (Squirrel and Fredrick).
Abstract:
Let’s talk about powerful conversations! We all know how to lead a constructive conversation, right? Then why is it so difficult to have those conversations with people at work, especially those in powerful positions that show resistance to change?
Learning to control and direct conversations takes understanding and practice.
We can combine our innate empathy with our analytical skills to gain a deeper understanding of complex situations at work. Join this session to learn how to prepare for difficult conversations and how to improve our agile conversations in order to be more influential without power. We will use Dave Gray’s Empathy Mapping, Argyris’ Ladder of Inference and The Four Rs from Agile Conversations (Squirrel and Fredrick).
In the session you will experience how preparing and reflecting on your conversation can help you be more influential at work. You will learn how to communicate more effectively with the people needed to achieve positive change. You will leave with a self-revised version of a difficult conversation and a practical model to use when you get back to work.
Come learn more on how to become a real influencer!
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsRosie Wells
Insight: In a landscape where traditional narrative structures are giving way to fragmented and non-linear forms of storytelling, there lies immense potential for creativity and exploration.
'Collapsing Narratives: Exploring Non-Linearity' is a micro report from Rosie Wells.
Rosie Wells is an Arts & Cultural Strategist uniquely positioned at the intersection of grassroots and mainstream storytelling.
Their work is focused on developing meaningful and lasting connections that can drive social change.
Please download this presentation to enjoy the hyperlinks!
This presentation, created by Syed Faiz ul Hassan, explores the profound influence of media on public perception and behavior. It delves into the evolution of media from oral traditions to modern digital and social media platforms. Key topics include the role of media in information propagation, socialization, crisis awareness, globalization, and education. The presentation also examines media influence through agenda setting, propaganda, and manipulative techniques used by advertisers and marketers. Furthermore, it highlights the impact of surveillance enabled by media technologies on personal behavior and preferences. Through this comprehensive overview, the presentation aims to shed light on how media shapes collective consciousness and public opinion.
2. What do you want
from me?
I want you to stop using design patterns.
3. What do you want
from me?
I want you to stop using design patterns…
like it’s 1999.
4.
5. The elements of this language are entities
called patterns. Each pattern describes a
problem that occurs over and over again in our
environment, and then describes the core of the
solution to that problem, in such a way that you
can use this solution a million times over,
without ever doing it the same way twice.
– Christopher Alexander
14. public interface Bakery {
Pastry bakePastry(Topping topping);
Cake bakeCake();
}
public class DanishBakery implements Bakery {
@Override
public Pastry bakePastry(Topping topping) {
return new DanishPastry(topping);
}
@Override
public Cake bakeCake() {
return new Æblekage(); // mmmm, apple cake…
}
}
Abstract Factory
15.
16. public interface Bakery {
Pastry bakePastry(Topping topping);
}
public class DanishBakery implements Bakery {
@Override
public Pastry bakePastry(Topping topping) {
return new DanishPastry(topping);
}
}
Abstract Factory
17. Abstract Factory
public class DanishBakery implements Bakery {
@Override
public Pastry bakePastry(Topping topping) {
return new DanishPastry(topping);
}
}
Bakery danishBakery = topping ->
new DanishPastry(topping);
Bakery danishBakery = DanishPastry::new;
18. package java.util.function;
/**
* Represents a function that
* accepts one argument and produces a result.
*
* @since 1.8
*/
@FunctionalInterface
public interface Function<T, R> {
/**
* Applies this function to the given
argument.
*/
R apply(T t);
...
}
Abstract Factory
19. public class DanishBakery
implements Function<Topping, Pastry> {
@Override
public Pastry apply(Topping topping) {
return new DanishPastry(topping);
}
}
Function<Topping, Pastry> danishBakery
= topping ->
new DanishPastry(topping);
Function<Topping, Pastry> danishBakery
= DanishPastry::new;
Abstract Factory
37. @Test public void whoAteMyPie() {
PieEater alice = PieEater.whoLoves(APPLE);
PieEater bob = PieEater.whoLoves(BLUEBERRY);
PieEater carol = PieEater.whoLoves(CHERRY);
alice.setNext(bob);
bob.setNext(carol);
alice.give(blueberryPie);
assertThat(bob, ate(blueberryPie));
}
Chain of
Responsibility
38. public final class HitCounterFilter implements Filter {
private FilterConfig filterConfig = null;
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
public void destroy() {
this.filterConfig = null;
}
public void doFilter
(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (filterConfig == null)
return;
Counter counter =
(Counter)filterConfig.getServletContext().getAttribute("hitCounter");
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
writer.println("The number of hits is: " + counter.incCounter());
writer.flush();
filterConfig.getServletContext().log(sw.getBuffer().toString());
chain.doFilter(request, response);
}
}
Chain of
Responsibility
39. public final class HitCounterFilter
implements Filter {
// init and destroy
public void doFilter(
ServletRequest request,
ServletResponse response,
FilterChain chain) {
int hits = getCounter().incCounter();
log(“The number of hits is ” + hits);
chain.doFilter(request, response);
}
}
Chain of
Responsibility
40. public final class SwitchEncodingFilter
implements Filter {
// init and destroy
public void doFilter(
ServletRequest request,
ServletResponse response,
FilterChain chain) {
request.setEncoding(“UTF-8”);
chain.doFilter(request, response);
}
}
Chain of
Responsibility
41. public final class AuthorizationFilter
implements Filter {
// init and destroy
public void doFilter(
ServletRequest request,
ServletResponse response,
FilterChain chain) {
if (!user().canAccess(request))
throw new AuthException(user);
chain.doFilter(request, response);
}
}
Chain of
Responsibility
44. @Test public void whoAteMyPie() {
PieEater alice = PieEater.whoLoves(APPLE);
PieEater bob = PieEater.whoLoves(BLUEBERRY);
PieEater carol = PieEater.whoLoves(CHERRY);
alice.setNext(bob);
bob.setNext(carol);
alice.give(blueberryPie);
assertThat(bob, ate(blueberryPie));
}
Chain of
Responsibility
45. @Test public void whoAteMyPie() {
PieEater carol = PieEater.atTheEnd()
.whoLoves(CHERRY);
PieEater bob = PieEater.before(carol)
.whoLoves(BLUEBERRY);
PieEater alice = PieEater.before(bob)
.whoLoves(APPLE);
alice.give(blueberryPie);
assertThat(bob, ate(blueberryPie));
}
Chain of
Responsibility
46. @Test public void whoAteMyPie() {
Chain<PieEater> carol =
Chain.endingWith(PieEater.whoLoves(CHERRY));
Chain<PieEater> bob =
Chain.from(PieEater.whoLoves(BLUEBERRY))
.to(carol);
Chain<PieEater> alice =
Chain.from(PieEater.whoLoves(APPLE))
.to(bob);
alice.give(blueberryPie);
assertThat(bob, ate(blueberryPie));
}
Chain of
Responsibility
47. @Test public void whoAteMyPie() {
PieEater alice = PieEater.whoLoves(APPLE);
PieEater bob = PieEater.whoLoves(BLUEBERRY);
PieEater carol = PieEater.whoLoves(CHERRY);
Chain<PieEater> pieEaters =
Chain.from(alice)
.to(Chain.from(bob)
.to(Chain.endingWith(carol)));
pieEaters.find(person -> person.loves(BLUEBERRY))
.give(blueberryPie);
assertThat(bob, ate(blueberryPie));
}
Chain of
Responsibility
48. Chain<PieEater> pieEaters =
Chain.from(alice)
.to(Chain.from(bob)
Chain of
Responsibility
.to(Chain.endingWith(carol)));
(cons alice (cons bob (cons carol nil)))
58. Credits
Bakery, by Boris Bartels
Just baked, by Sergio Russo
cherry pie with crumble topping, by Ginny
This presentation is licensed under
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)