Refactoring is a technique for restructuring existing code without changing its external behavior. It involves reorganizing code to improve factors like design, readability, and maintainability. Some reasons to refactor include removing duplication, improving design, reducing complexity, and decreasing technical debt. Refactoring should be done incrementally with unit tests to ensure changes don't introduce bugs. It involves techniques like extracting methods, simplifying conditionals, and improving names. Refactoring helps keep code healthy and manageable as a project evolves over time.
Effective Java with Groovy - How Language Influences Adoption of Good PracticesNaresha K
Slides from my APACHECON@HOME 2020 talk - "Effective Java with Groovy - How Language Influences Adoption of Good Practices".
'Effective Java' presents the most effective ways of using language. However, the adoption of these practices among Java developers is less than satisfactory. In my observation, the effort required to implement them can be a barrier to the adoption of these practices. Since Groovy runs on JVM, most of the suggestions from Effective Java are equally relevant for Groovy developers. Groovy provides out of the box constructs for many of the recommended practices which can boost developer productivity. In this talk, I walk you through code examples that follow these good practices, highlighting the Groovy way of implementing the 'Effective Java' suggestions. As a participant, you walk away, appreciating the simplicity with which Groovy empowers the developers. The talk also provides food for thought - how a language can influence its users to adopt good practices. Java users learn the techniques a language can use to reduce the friction to adoption of good practices, instead of coming up with a prescription on how to implement good practices. Developers familiar with Groovy understand the reason behind the design of their favourite language features.
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
In this session we will demonstrate how to design DSLs in C# that expose both typed and dynamic API. The advantage of such hybrid APIs is that they can take advantage of dynamic C# features, but offer a fallback for .NET platforms that lack DLR support and developers not willing to abandon the convenience of compile-time code validation. We will show how to ensure code sharing between typed and dynamic versions, and how to package and publish library files so they can be consumed on variety of .NET platforms, including iOS and Android.
API first with Swagger and Scala by Slava SchmidtJavaDayUA
How does one scale the development of a service landscape in a corporate enterprise environment utilizing Typesafe's Play and Akka software stack? How does one achieve API uniformity and coherence accross dozens of development teams, getting them and their subsequently developed subsystems to play together nicely? At Zalando we believe firmly in an API first approach, founded an API guild that ratifies and supports the development of APIs, and define them in a formal manner employing the Swagger API representation language.
Functions being first-class citizens in JavaScript offers developers a tremendous amount power and
flexibilty. However, what good is all this power if you don't know how to harness it?
This talk will provide a thorough examination of JavaScript functions. Topics
that will be covered in this talk are:
* Functions are objects
* Execution Context and the Scope Chain
* Closures
* Modifying Context
* The Various Forms of Functions.
Attendees will leave this talk understanding the power of JavaScript functions and the knowledge to apply new
techiques that will make their JavaScript cleaner, leaner and more maintainable.
Effective Java with Groovy - How Language Influences Adoption of Good PracticesNaresha K
Slides from my APACHECON@HOME 2020 talk - "Effective Java with Groovy - How Language Influences Adoption of Good Practices".
'Effective Java' presents the most effective ways of using language. However, the adoption of these practices among Java developers is less than satisfactory. In my observation, the effort required to implement them can be a barrier to the adoption of these practices. Since Groovy runs on JVM, most of the suggestions from Effective Java are equally relevant for Groovy developers. Groovy provides out of the box constructs for many of the recommended practices which can boost developer productivity. In this talk, I walk you through code examples that follow these good practices, highlighting the Groovy way of implementing the 'Effective Java' suggestions. As a participant, you walk away, appreciating the simplicity with which Groovy empowers the developers. The talk also provides food for thought - how a language can influence its users to adopt good practices. Java users learn the techniques a language can use to reduce the friction to adoption of good practices, instead of coming up with a prescription on how to implement good practices. Developers familiar with Groovy understand the reason behind the design of their favourite language features.
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
In this session we will demonstrate how to design DSLs in C# that expose both typed and dynamic API. The advantage of such hybrid APIs is that they can take advantage of dynamic C# features, but offer a fallback for .NET platforms that lack DLR support and developers not willing to abandon the convenience of compile-time code validation. We will show how to ensure code sharing between typed and dynamic versions, and how to package and publish library files so they can be consumed on variety of .NET platforms, including iOS and Android.
API first with Swagger and Scala by Slava SchmidtJavaDayUA
How does one scale the development of a service landscape in a corporate enterprise environment utilizing Typesafe's Play and Akka software stack? How does one achieve API uniformity and coherence accross dozens of development teams, getting them and their subsequently developed subsystems to play together nicely? At Zalando we believe firmly in an API first approach, founded an API guild that ratifies and supports the development of APIs, and define them in a formal manner employing the Swagger API representation language.
Functions being first-class citizens in JavaScript offers developers a tremendous amount power and
flexibilty. However, what good is all this power if you don't know how to harness it?
This talk will provide a thorough examination of JavaScript functions. Topics
that will be covered in this talk are:
* Functions are objects
* Execution Context and the Scope Chain
* Closures
* Modifying Context
* The Various Forms of Functions.
Attendees will leave this talk understanding the power of JavaScript functions and the knowledge to apply new
techiques that will make their JavaScript cleaner, leaner and more maintainable.
Building a microservices architecture means making a lot of decisions, about tools, about frameworks. In this talk I share the decisions that we made at Measurence during our journey for building a microservices architecture based on Scala technologies.
We're going to talk about Spray, Akka, Swagger, Sbt, Docker, Jenkins, Mesos and Marathon.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
5.12.15 QA Lab: тестирование ПО.
Upcoming events: goo.gl/I2gJ4H
Доклад о популярных и/или лучших практиках в веб-автоматизации с точки зрения принципа KISS. Мы быстро пробежимся и оставим след в следующих темах и технологиях: Selenium, обертки вокруг Selenium, xUnit, BDD, длинные и не очень - End to End сценарии, маленькие независимые тесты Unit стиля, простые или красивые репорты, Allure репортинг, PageObject, виджеты-элементы, парадигмы программирования для автоматизации - ООП, процедурное и модульное.
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...GeeksLab Odessa
5.12.15 QA Lab: тестирование программного обеспечения.
Upcoming events: goo.gl/I2gJ4H
Доклад о Play-Swagger, проекте с открытым исходным кодом, разрабатываемом в Zalando с использованием Scala и Play Framework. О том, как использование API First и Swagger позволяет ускорить процесс разработки, упростить взаимодействие команд и повысить качество продукта.
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
The challenges of developing applications recently have increased. With the popularity of cloud environments, the scalability required by new architectures and the need to support more load efficiently, there has been an increase in attention that we need to pay to concurrency and efficiency.
One strategy to achieve that efficiency consists of distributing the modules of your application in several different smaller components running concurrently. But one of the problems that arise from such distribution of running modules comes when you need to send a request (and wait for the response) to several different modules. How do you design that request(s)-response(s) to be as efficient as possible?
CompletableFutures was introduced with Java 8 but has evolved over the years with every new version of Java released. In this talk, we will take a look at it, to:
understand how to use CompletableFutures,
how they can help us to split our workload into different request and coordinate them asynchronously and concurrently
How you can chain behavior to the responses.
How you can use CompletableFuture in your design to create APIs that enable your users to get the most of your Component/library/module.
Refactoring can either completely disrupt your project or make you go faster. This presentation will help you to avoid some pitfalls.
It also demonstrates refactorings that you could apply straight away to make your code better.
In 2010, I told everyone how to start unit testing Zend Framework applications. In 2011, let’s take this a step further by testing services, work flows and performance. Looking to raise the bar on quality? Let this talk be the push you need to improve your Zend Framework projects.
"Inside The AngularJS Directive Compiler" by Tero ParviainenFwdays
Directives are Angular's most powerful and unique feature. They are also Angular's most underused feature and notoriously difficult to learn. A lot of this has to do with the convoluted directive API and the various ways in which you can use and misuse it.
However, behind the scenes of the directive API there is a relatively simple core, which takes your web page's DOM and transforms it to a living, breathing JavaScript application. This talk goes behind the scenes of Angular's directive compiler and shows what it actually does. You will come out of the talk with a renewed understanding of Angular's inner mechanics, which will help you use it more effectively.
Building a microservices architecture means making a lot of decisions, about tools, about frameworks. In this talk I share the decisions that we made at Measurence during our journey for building a microservices architecture based on Scala technologies.
We're going to talk about Spray, Akka, Swagger, Sbt, Docker, Jenkins, Mesos and Marathon.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
5.12.15 QA Lab: тестирование ПО.
Upcoming events: goo.gl/I2gJ4H
Доклад о популярных и/или лучших практиках в веб-автоматизации с точки зрения принципа KISS. Мы быстро пробежимся и оставим след в следующих темах и технологиях: Selenium, обертки вокруг Selenium, xUnit, BDD, длинные и не очень - End to End сценарии, маленькие независимые тесты Unit стиля, простые или красивые репорты, Allure репортинг, PageObject, виджеты-элементы, парадигмы программирования для автоматизации - ООП, процедурное и модульное.
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...GeeksLab Odessa
5.12.15 QA Lab: тестирование программного обеспечения.
Upcoming events: goo.gl/I2gJ4H
Доклад о Play-Swagger, проекте с открытым исходным кодом, разрабатываемом в Zalando с использованием Scala и Play Framework. О том, как использование API First и Swagger позволяет ускорить процесс разработки, упростить взаимодействие команд и повысить качество продукта.
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
The challenges of developing applications recently have increased. With the popularity of cloud environments, the scalability required by new architectures and the need to support more load efficiently, there has been an increase in attention that we need to pay to concurrency and efficiency.
One strategy to achieve that efficiency consists of distributing the modules of your application in several different smaller components running concurrently. But one of the problems that arise from such distribution of running modules comes when you need to send a request (and wait for the response) to several different modules. How do you design that request(s)-response(s) to be as efficient as possible?
CompletableFutures was introduced with Java 8 but has evolved over the years with every new version of Java released. In this talk, we will take a look at it, to:
understand how to use CompletableFutures,
how they can help us to split our workload into different request and coordinate them asynchronously and concurrently
How you can chain behavior to the responses.
How you can use CompletableFuture in your design to create APIs that enable your users to get the most of your Component/library/module.
Refactoring can either completely disrupt your project or make you go faster. This presentation will help you to avoid some pitfalls.
It also demonstrates refactorings that you could apply straight away to make your code better.
In 2010, I told everyone how to start unit testing Zend Framework applications. In 2011, let’s take this a step further by testing services, work flows and performance. Looking to raise the bar on quality? Let this talk be the push you need to improve your Zend Framework projects.
"Inside The AngularJS Directive Compiler" by Tero ParviainenFwdays
Directives are Angular's most powerful and unique feature. They are also Angular's most underused feature and notoriously difficult to learn. A lot of this has to do with the convoluted directive API and the various ways in which you can use and misuse it.
However, behind the scenes of the directive API there is a relatively simple core, which takes your web page's DOM and transforms it to a living, breathing JavaScript application. This talk goes behind the scenes of Angular's directive compiler and shows what it actually does. You will come out of the talk with a renewed understanding of Angular's inner mechanics, which will help you use it more effectively.
Slides from talk given at Ithaca Web Group and GORGES on CoffeeScript.
The focus is on explaining to people who haven't tried it yet that it's more than syntactic sugar. There are several real life code examples but they were explained verbally so they may not be super helpful if you don't know CoffeeScript yet.
It's an overview, not a tutorial.
This is an introductory SCALA workshop for a JAVA developer. Hence, we're going to explore 'functional' side of the language. SCALA is 50% OOP (Object-Oriented-Programming) and 50% FP (Functional-Programming). Main principles of FP are discussed, such as: tail-recursion, currying, pure-functions, lazy evaluation etc.) along with some examples in code.
We look at the basic keywords and constructs in SCALA.
In the end SCALA tools which are helpful for developers are listed.
From object oriented to functional domain modelingCodemotion
"From object oriented to functional domain modeling" by Mario Fusco
Malgrado l'introduzione delle lambda, la gran parte degli sviluppatori Java non è ancora abituata agli idiomi della programmazione funzionale e quindi non è pronta a sfruttare a pieno le potenzialità di Java 8. In particolare non è ancora comune vedere dati e funzioni usate insieme quando si modella un dominio di business. Lo scopo del talk è mostrare come alcuni principi di programmazione funzionale quali l'impiego di oggetti e strutture dati immutabili, l'uso di funzioni senza side-effect e il loro reuso mediante composizione, possono anche essere validi strumenti di domain modelling.
A brief overview about how to write human readable and meaningful code. Here is described why and how to write meaningful names of variables or method, what to follow about writing a function for SRP / Open-Closed principle rule, when to write comments and rules of Code Formatting. Advantages of clean code is also described here.
Crossing the Bridge: Connecting Rails and your Front-end FrameworkDaniel Spector
Presented at Railsconf 2015 by Daniel Spector, @danielspecs.
Crossing the Bridge explores tools, patterns and best practices to connect your Javascript MVC framework to Rails in the most seamless way possible. The talk progresses from demonstrating the standard API request cycle to preloading data to your client-side framework to rendering your javascript on the server. It explores Isomorphic Javascript and ways of implementing it with Rails.
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptGuy Royse
Long ago, in the late days of the first Internet boom, before jQuery, before Underscore, before Angular, there was a web application built by a large corporation. This application was written as a server-side application using server-side technology like Java or PHP. A tiny seed of JavaScript was added to some of the pages of this application to give it a little sizzle.
Over the ages, this tiny bit of JavaScript grew like kudzu. Most of it was embedded in the HTML in
Clojure is a new dialect of LISP that runs on the Java Virtual Machine (JVM). As a functional language, it offers great benefits in terms of programmer productivity; as a language that runs on the JVM, it also offers the opportunity to reuse existing Java libraries. Simon’s interest is in using Clojure to build desktop applications with the Java Swing GUI library. In this presentation Simon discusses how the power of Clojure can be applied to Swing, and whether it hits the sweet spot.
I present four design patterns that make your development easier and better. Design patterns are a fantastic way to make more readable code, as they make use of common ideas that many developers know and use. These patterns are tried and tested in the enterprise world.
The first one is dependency injection. This covers putting the variables that a class needs to function preferably inside a constructor.
The second one is the factory pattern. A factory moves the responsibility of instantiating an object to a third-party class.
The third one is dependency injection. This allows us to place a class' dependencies at one time, making it easy to come back and see what the class needs to survive.
Finally, we discuss the chain of responsibility. This allows complex operations to be handled by a chain of classes. Each class in the chain determines whether it is capable of handling the request and, if so, it returns the result.
Estimating software projects, features and tasks is not easy. This presentation shows a way to change the focus from "how long is going to take" to "what can I build in xx days"
Coderetreat hosting training slides for future hosts of coderetreat. It covers the basic components of hosting a coderetreat. From finding a location, to getting sponsors and what can go wrong.
For the video please go to https://youtu.be/QhDpq5hrRM8
There's no charge for (functional) awesomenessAmir Barylko
Presentation about adopting functional programming as a way of thinking and solving problems by embracing functional traits of languages like Haskell, F#, Scala and Clojure.
Presentation done in Jan at the Winnipeg Agile User Group about how to make your team more productive and communicate better developers, managers and business analysts.
From coach to owner - What I learned from the other sideAmir Barylko
I have been working in the software industry for more than twenty years and for the past ten years I have been a fervent advocate of high quality software, test-first development, lean practices and agile methodologies.
I worked as a developer, architect, business analyst, manager and agile coach, and two years ago the unthinkable happened. I became an owner. I decided to build my own product for lean project management called SmartView and doing so presented a set of challenges that I never encountered before.
I used to put always methodology first and never budge before a deadline. Now that the money was my own and the timelines seem more daunting I had to grab Agile by the horns and make decisions and sacrifices in order to stay on budget and hit the desired dates.
My journey gave me a new perspective on what is key to succeed and what agile means to owners and decision makers.
Let me share with you what I learned so far that can help you reach your goals, how to fight the fear of never releasing; and make sure that Agile works for you and not the other way around.
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/
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/
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
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
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
"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.
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.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
3. Refactoring is a disciplined
technique for restructuring
an existing body of code,
altering its internal
structure without changing
its external behavior.
Martin Fowler
Refactoring, improving design of existing code
61. C#
public double SomeMethod()
{
var result = 0d;
if (_firstGuard)
{
result = FirstCalculation();
if (_secondGuard)
{
result = SecondCalculation();
}
}
return result;
}
62. C#
RE
public double BetterMethod()
{
if (!_firstGuard)
{
return 0;
}
if (!_secondGuard)
{
return FirstCalculation();
}
return SecondCalculation();
}
FAC
TO
R
ED
72. Java
public Iterable<String> deploy(
Iterable<String> collection) {
Collection<String> result = new ArrayList<>...;
Iterator<String> cursor = collection.iterator();
while(cursor.hasNext()) {
result.add("Deployed to " + cursor.next());
}
return result;
}
73. Java
public Iterable<String> betterDeploy(
Iterable<String> environments) {
RE
FAC
TO
R
return with(environments)
.convert(new DeployConverter());
}
class DeployConverter
implements Converter<String, String> {
public String convert(String env) {
return "Deployed to " + env;
}
}
ED
75. Java
public class Movie {
private String title;
private int review;
public Movie(String title, int review) {
this.title = title;
this.review = review;
}
public String getTitle() {...}
public int getReview() {...}
}
76. Java
@Test
public void whereAreMyPostIt() {
RE
FAC
TO
R
ED
// arrange
Iterable<Movie> movies = asList(
new Movie("Blazing Saddles", 5), new Movie("Terminator"),
new Movie("Canadian Bacon", 8)
);
// act
Iterable<Movie> reviewed =
filter(having(on(Movie.class).getReview(), greaterThan(-1))
, movies);
// assert
assertThat(joinFrom(reviewed).getTitle(),
equalTo("Blazing Saddles, Canadian Bacon"));
}
77. Java
@Test
public void wheresMyGanttChart() {
RE
FAC
TO
R
ED
// arrange
Iterable<Movie> movies = asList(new Movie("Blazing Saddles"),
new Movie("Terminator"), new Movie("Curator"));
// act
Matcher<Movie> endsWithAtor = new Predicate<Movie>() {
public boolean apply(Movie item) {
return item.getTitle().endsWith("ator");
}
};
Iterable<Movie> actual = filter(endsWithAtor, movies);
// assert
assertThat(joinFrom(actual).getTitle(),
equalTo("Terminator, Curator"));
}
99. Photo Credit
•
Under http://creativecommons.org/licenses/by/2.5/
•
•
Bill Ward, Derek Schin's Trucks 1, http://flic.kr/p/m5L5S
•
Jeremy Keith, Roast beef, http://flic.kr/p/TKUz
•
Rob Campbell, Field of daisies, http://flic.kr/p/6QJjU4
•
•
Joe Cheng, DSC_7820-01, http://flic.kr/p/2Zt2u
Karin Dalziel, The Thinker, http://flic.kr/p/4UYArc
Under http://creativecommons.org/licenses/by-sa/3.0/us/
•
Derick Bailey, SOLID Motivational Posters, http://bit.ly/17aVaHg
100. Photo Credit 2
•
•
How to write good code, http://xkcd.com/844/
Understanding flow charts, http://lifehacker.com/5909501/how-tochoose-the-best-chart-for-your-data