Code generation has always been something of a controversial topic, with many engineers not liking the idea of a codebase that relies too much on this topic. Yet, when used appropriately, this tool is a great help to minimise boilerplate code.
In many iOS projects, the testing targets are definitely places that tend to be cluttered with boilerplate and duplicated code.
Sourcery is a code-generation tool for Swift that, when applied appropriately, can dramatically reduce the amount of boilerplate.
In this talk I’m going to show you how it can be leveraged for quick win, such as making sure that your dependencies are correctly registered and injected. But also to create building blocks for more involved tests scenarios, such as mocks that keep track of how many times methods get called, along with the provided arguments. And, of course, if your app uses an architecture that relies on a set of well defined components (like base classes of ViewControllers, ViewModels, Providers, etc. with pre-defined methods), Sourcery can definitely be applied to generate a testing suite that will assert that those components behave as expected.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
This document contains Swift code for testing a HTTP request to an API using the Alamofire and Mockingjay libraries. It defines a test spec class with a describe block for "hoge" and a context block for "fuga". Within the "fuga" context, a beforeEach stub is set up to mock API responses from the "hogefugapiyo.com" domain. The single "piyo" test makes a request, asserts the response is not nil, and prints the results.
This document provides an overview of Spock, a testing framework for Java and Groovy. It describes how to include Spock tests in a project, run Spock tests, debug Spock tests, view test coverage, and integrate Spock tests with Sonar. It also explains Spock specifications, feature methods, blocks like setup, when/then, expect, and cleanup. It demonstrates how to write conditions, handle exceptions, create helper methods, mocks, stubs, and spies in Spock tests.
The document discusses Groovy, a dynamic language for the Java Virtual Machine. It has features from Python, Ruby, and Smalltalk, but uses Java-like syntax. Examples show Hello World programs in Java and Groovy. Later sections discuss Grails, a web framework for Groovy, and G*Magazine, a publication about Groovy. The document contains code samples for defining a Book domain class in Grails, implementing services with Spring Security annotations, writing Spock specifications, and Geb tests using the Page Object pattern.
Spock Testing Framework - The Next GenerationBTI360
You may be asking, "Do we really need another testing framework?" In this presentation Spencer says "Yes!" and will share some reasons why the Spock testing framework is gaining in popularity compared to other testing frameworks.
We aren't sure about you, but working with Java 8 made one of the speakers lose all of his hair and the other lose his sleep (or was it the jetlag?). If you still haven't reached the level of Brian Goetz in mastering lambdas and strings, this talk is for you. And if you think you have, we have some bad news for you, you should attend as well.
Kotlin is a statically typed programming language that runs on the JVM and is fully interoperable with Java. The document discusses some key reasons why Java engineers should consider Kotlin, including that it is more concise, safe, and versatile compared to Java. It also provides examples showing how Kotlin code can be more concise than equivalent Java code through features like data classes, default values, named arguments, and standard library functions.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
This document contains Swift code for testing a HTTP request to an API using the Alamofire and Mockingjay libraries. It defines a test spec class with a describe block for "hoge" and a context block for "fuga". Within the "fuga" context, a beforeEach stub is set up to mock API responses from the "hogefugapiyo.com" domain. The single "piyo" test makes a request, asserts the response is not nil, and prints the results.
This document provides an overview of Spock, a testing framework for Java and Groovy. It describes how to include Spock tests in a project, run Spock tests, debug Spock tests, view test coverage, and integrate Spock tests with Sonar. It also explains Spock specifications, feature methods, blocks like setup, when/then, expect, and cleanup. It demonstrates how to write conditions, handle exceptions, create helper methods, mocks, stubs, and spies in Spock tests.
The document discusses Groovy, a dynamic language for the Java Virtual Machine. It has features from Python, Ruby, and Smalltalk, but uses Java-like syntax. Examples show Hello World programs in Java and Groovy. Later sections discuss Grails, a web framework for Groovy, and G*Magazine, a publication about Groovy. The document contains code samples for defining a Book domain class in Grails, implementing services with Spring Security annotations, writing Spock specifications, and Geb tests using the Page Object pattern.
Spock Testing Framework - The Next GenerationBTI360
You may be asking, "Do we really need another testing framework?" In this presentation Spencer says "Yes!" and will share some reasons why the Spock testing framework is gaining in popularity compared to other testing frameworks.
We aren't sure about you, but working with Java 8 made one of the speakers lose all of his hair and the other lose his sleep (or was it the jetlag?). If you still haven't reached the level of Brian Goetz in mastering lambdas and strings, this talk is for you. And if you think you have, we have some bad news for you, you should attend as well.
Kotlin is a statically typed programming language that runs on the JVM and is fully interoperable with Java. The document discusses some key reasons why Java engineers should consider Kotlin, including that it is more concise, safe, and versatile compared to Java. It also provides examples showing how Kotlin code can be more concise than equivalent Java code through features like data classes, default values, named arguments, and standard library functions.
This document provides an overview of Spock, a testing and specification framework for Java and Groovy applications. It discusses the key features of Spock including state based testing, data driven testing, interaction based testing using mocking, and extensions. Examples are provided to demonstrate state based testing with given/when/then blocks, data driven testing using the where clause, and interaction based testing using mocks.
Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer. Java bytecode is the form of instructions that Java virtual machine executes. This knowledge is crucial when debugging and doing performance and memory usage tuning. The presenter will share his knowledge on what bytecode means for your platform and how to create compiler while using some awesome tools.
This document provides an overview of various programming concepts in Groovy including Eclipse IDE basics, assertions, closures, I/O, and functions. It discusses how to set up an Eclipse workspace and Groovy project. It explains that assertions can be used to check code validity and provides examples using assertions. It describes what closures are and provides examples of using closures on lists and maps. It discusses how to perform I/O operations like reading from standard input and files. Finally, it covers functions in Groovy including overloaded functions, default parameter values, and dynamic dispatch based on argument types.
My JSConf.eu talk about next-gen JavaScript metaprogramming features, starting with ES5's new Object APIs and then focusing on the forthcoming Proxy object, approved for the next ECMA-262 Edition. This is beautiful work from Tom Van Cutsem and Mark Miller, with Andreas Gal helping on the implementation front -- proxies are already shipping in Firefox 4 betas.
The document discusses issues with testing business logic in Orleans grains that access grain state. Specifically, the business logic code is duplicated across grain methods and calling the logic directly in tests fails because the grain state is null. The solution is to use Orleans' declarative persistence by defining a grain state interface and inheriting from Grain, which allows the state to be initialized for tests.
Google Guava - Core libraries for Java & AndroidJordi Gerona
Talk at GDG DevFest Barcelona 2013.
The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.
Twisted is an event-driven networking engine written in Python. It provides tools for developing asynchronous network applications and services. Some key features of Twisted include an asynchronous reactor framework, support for deferreds/promises, common network protocols and services implemented, and application framework for building services.
sizeof(Object): how much memory objects take on JVMs and when this may matterDawid Weiss
The object header contains metadata such as the identity hash, mark, and klass. Hexdumping the memory of a simple object before and after getting the identity hash shows the hash being written to the header. On 64-bit JVMs, the header is 8 bytes, containing unused space, hash, and mark fields. On 32-bit JVMs, the header is 4 bytes, with the hash overwriting unused space after being set.
This document discusses exceptions and errors in Java. It provides examples of different types of exceptions like ArrayIndexOutOfBoundsException, NullPointerException, and ClassCastException. It explains exception handling using try-catch blocks and the finally block. It also covers multi-catch, try-with-resources, exception propagation, checked vs unchecked exceptions, and creating custom exceptions. The key aspects of exception handling in Java are to not swallow exceptions, use checked exceptions for recoverable conditions, and use runtime exceptions to indicate programming errors.
The document provides an overview of Groovy and Java code examples for performing common tasks like printing "Hello World", reading files, making web requests, using strings, importing packages, and using Swing/SwingBuilder for GUIs. It also shows examples of using Groovy with Java libraries for Excel files, Ant, and JSON. Additional sections cover parallel processing with GPars, contract programming with GContracts, method chaining, Grails basics, and Gaelyk controllers and views.
Java Universal super class java.lang.Object is discussed comprehensively with code snippets.
Also covers:
a) Why we need inheritance and dynamic method dispatch
b) Need of a universal parent
c) Delegation and proxies
d) toString(), clone(), equals(), notify()
Spock is a testing framework written in Groovy that allows developers to write tests in a business readable domain specific language. It combines the benefits of specification-based testing and mock-based testing. Some key features of Spock include the ability to write feature methods with given, when, and then blocks; use fixtures for setup and cleanup; parameterize tests with data tables in where blocks; make assertions about interactions with mock objects; and write tests in a BDD style with descriptive language. Spock's tests are themselves a good source of documentation on how to write and use Spock tests.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
This presentation explains parameterized tests, theory tests, and generative testing. It also explains single mode faults and double mode faults and shows how to reduce the number of test cases when there's an combinatorial explosion. Lot's of JUnit examples.
The document discusses some of the features and benefits of CoffeeScript, a programming language that compiles to JavaScript. It covers how CoffeeScript works by compiling CoffeeScript files to JavaScript, its easier syntax compared to JavaScript, built-in protections from common JavaScript issues, and how it results in less code. Specific features highlighted include object definitions, functions, operators, string interpolation, conditionals, scoping, and pattern matching.
The Guava project contains several of Google’s core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth. There will be the slides presenting most useful and interesting features of Guava (v.12) that makes stuff simpler, better and code cleaner. We will cover most of the com.google.common.base.* classes and basic use of functions in collection and Google collections and few other features that are part of Guava and I find them very useful. Some of you will think that there is an overlap with Apache commons – and it’s true, but Guava is built with expectation that there is a Function and a Predicate class as well as various builders which makes it really cool and simple for many use cases.
The document provides an overview of new features introduced in C# 6.0, including static using, string interpolation, dictionary initializers, auto-property initializers, nameof expression, await in catch/finally blocks, null conditional operator, expression-bodied members, and extension methods used with static using. Code examples are provided to demonstrate the usage of each new feature.
This document provides an introduction and overview of the Google Guava libraries. It describes what Guava is, why developers would use it, how it compares to Apache Commons libraries, its design principles and release cycles. It provides descriptions of some key Guava packages and classes for common Java utilities, including Preconditions, Optional, Objects, Strings, Charsets, CaseFormat, CharMatcher, Joiner and Splitter. The document aims to explain the purpose and usage of important Guava functionality.
This document discusses using functional programming techniques in Java to improve KPIs like quality, performance, and developer productivity. It outlines issues with imperative Java like shared mutability and verbosity. Functional approaches can reduce bugs, duplicated code, and complexity. Techniques like immutable collections, streams, and lambdas improve performance by reducing memory usage and garbage collection. Functional Java allows writing more concise, testable code while leveraging the existing Java ecosystem.
This document provides an overview of Spock, a testing and specification framework for Java and Groovy applications. It discusses the key features of Spock including state based testing, data driven testing, interaction based testing using mocking, and extensions. Examples are provided to demonstrate state based testing with given/when/then blocks, data driven testing using the where clause, and interaction based testing using mocks.
Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer. Java bytecode is the form of instructions that Java virtual machine executes. This knowledge is crucial when debugging and doing performance and memory usage tuning. The presenter will share his knowledge on what bytecode means for your platform and how to create compiler while using some awesome tools.
This document provides an overview of various programming concepts in Groovy including Eclipse IDE basics, assertions, closures, I/O, and functions. It discusses how to set up an Eclipse workspace and Groovy project. It explains that assertions can be used to check code validity and provides examples using assertions. It describes what closures are and provides examples of using closures on lists and maps. It discusses how to perform I/O operations like reading from standard input and files. Finally, it covers functions in Groovy including overloaded functions, default parameter values, and dynamic dispatch based on argument types.
My JSConf.eu talk about next-gen JavaScript metaprogramming features, starting with ES5's new Object APIs and then focusing on the forthcoming Proxy object, approved for the next ECMA-262 Edition. This is beautiful work from Tom Van Cutsem and Mark Miller, with Andreas Gal helping on the implementation front -- proxies are already shipping in Firefox 4 betas.
The document discusses issues with testing business logic in Orleans grains that access grain state. Specifically, the business logic code is duplicated across grain methods and calling the logic directly in tests fails because the grain state is null. The solution is to use Orleans' declarative persistence by defining a grain state interface and inheriting from Grain, which allows the state to be initialized for tests.
Google Guava - Core libraries for Java & AndroidJordi Gerona
Talk at GDG DevFest Barcelona 2013.
The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.
Twisted is an event-driven networking engine written in Python. It provides tools for developing asynchronous network applications and services. Some key features of Twisted include an asynchronous reactor framework, support for deferreds/promises, common network protocols and services implemented, and application framework for building services.
sizeof(Object): how much memory objects take on JVMs and when this may matterDawid Weiss
The object header contains metadata such as the identity hash, mark, and klass. Hexdumping the memory of a simple object before and after getting the identity hash shows the hash being written to the header. On 64-bit JVMs, the header is 8 bytes, containing unused space, hash, and mark fields. On 32-bit JVMs, the header is 4 bytes, with the hash overwriting unused space after being set.
This document discusses exceptions and errors in Java. It provides examples of different types of exceptions like ArrayIndexOutOfBoundsException, NullPointerException, and ClassCastException. It explains exception handling using try-catch blocks and the finally block. It also covers multi-catch, try-with-resources, exception propagation, checked vs unchecked exceptions, and creating custom exceptions. The key aspects of exception handling in Java are to not swallow exceptions, use checked exceptions for recoverable conditions, and use runtime exceptions to indicate programming errors.
The document provides an overview of Groovy and Java code examples for performing common tasks like printing "Hello World", reading files, making web requests, using strings, importing packages, and using Swing/SwingBuilder for GUIs. It also shows examples of using Groovy with Java libraries for Excel files, Ant, and JSON. Additional sections cover parallel processing with GPars, contract programming with GContracts, method chaining, Grails basics, and Gaelyk controllers and views.
Java Universal super class java.lang.Object is discussed comprehensively with code snippets.
Also covers:
a) Why we need inheritance and dynamic method dispatch
b) Need of a universal parent
c) Delegation and proxies
d) toString(), clone(), equals(), notify()
Spock is a testing framework written in Groovy that allows developers to write tests in a business readable domain specific language. It combines the benefits of specification-based testing and mock-based testing. Some key features of Spock include the ability to write feature methods with given, when, and then blocks; use fixtures for setup and cleanup; parameterize tests with data tables in where blocks; make assertions about interactions with mock objects; and write tests in a BDD style with descriptive language. Spock's tests are themselves a good source of documentation on how to write and use Spock tests.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
This presentation explains parameterized tests, theory tests, and generative testing. It also explains single mode faults and double mode faults and shows how to reduce the number of test cases when there's an combinatorial explosion. Lot's of JUnit examples.
The document discusses some of the features and benefits of CoffeeScript, a programming language that compiles to JavaScript. It covers how CoffeeScript works by compiling CoffeeScript files to JavaScript, its easier syntax compared to JavaScript, built-in protections from common JavaScript issues, and how it results in less code. Specific features highlighted include object definitions, functions, operators, string interpolation, conditionals, scoping, and pattern matching.
The Guava project contains several of Google’s core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth. There will be the slides presenting most useful and interesting features of Guava (v.12) that makes stuff simpler, better and code cleaner. We will cover most of the com.google.common.base.* classes and basic use of functions in collection and Google collections and few other features that are part of Guava and I find them very useful. Some of you will think that there is an overlap with Apache commons – and it’s true, but Guava is built with expectation that there is a Function and a Predicate class as well as various builders which makes it really cool and simple for many use cases.
The document provides an overview of new features introduced in C# 6.0, including static using, string interpolation, dictionary initializers, auto-property initializers, nameof expression, await in catch/finally blocks, null conditional operator, expression-bodied members, and extension methods used with static using. Code examples are provided to demonstrate the usage of each new feature.
This document provides an introduction and overview of the Google Guava libraries. It describes what Guava is, why developers would use it, how it compares to Apache Commons libraries, its design principles and release cycles. It provides descriptions of some key Guava packages and classes for common Java utilities, including Preconditions, Optional, Objects, Strings, Charsets, CaseFormat, CharMatcher, Joiner and Splitter. The document aims to explain the purpose and usage of important Guava functionality.
This document discusses using functional programming techniques in Java to improve KPIs like quality, performance, and developer productivity. It outlines issues with imperative Java like shared mutability and verbosity. Functional approaches can reduce bugs, duplicated code, and complexity. Techniques like immutable collections, streams, and lambdas improve performance by reducing memory usage and garbage collection. Functional Java allows writing more concise, testable code while leveraging the existing Java ecosystem.
CoffeeScript is a simple and elegant language that keeps the "good" parts of Javascript and discards those that cause confusion and consequently bugs. Going through this presentation, you can get a quick introduction to CoffeeScript. I hope you enjoy it!
Spock is a Groovy-based testing framework that provides features for writing tests in a clear, expressive, and highly readable manner. Some key features highlighted in the document include:
- Spock tests are structured into blocks like "given", "when", "then" that give tests a clear structure and meaning.
- Spock includes powerful and easy to read assertion methods as well as the ability to display diffs when expectations are not met.
- Spock supports mocking and stubbing of dependencies in a simple way.
- Data-driven testing is first-class in Spock through features like the "where" block that allows input test data to be specified in a table.
Spock is a Groovy-based testing framework that provides a powerful and concise specification testing language. Some key features highlighted in the document include:
- Spock tests are structured into blocks like "given", "when", "then" that define meaning.
- Spock includes simple and detailed assertions as well as support for mocking, stubbing, data-driven testing, and property-based testing.
- Data-driven tests in Spock can use a table-like structure to define input test data in a readable way.
- The document discusses how machine learning can be seen as automated test-driven development, and how property-based testing is a good specification for automated code generation
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.
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionSchalk Cronjé
This document summarizes a presentation about cool JVM tools for testing. It introduces the presenter and discusses tools like Spock and Geb for writing readable tests in Groovy. It also covers Ratpack for HTTP testing, Betamax for recording external API responses, and Gradle for running and integrating tests. The presentation provides code examples and outlines how these tools can help write effective tests more efficiently.
Ruby is a dynamic, open source object-oriented scripting language that is interpreted, not compiled. It supports features like garbage collection, exception handling, operator overloading, and just-in-time compilation. Ruby can be used for web development, system scripting, database programming, and GUI development. It uses classes and modules to support object-oriented programming concepts like inheritance, polymorphism, and mixins.
The document discusses unit testing and provides examples of writing unit tests in PHP using the PHPUnit framework. It explains what unit tests are, why they are useful for finding and preventing bugs, and different types of tests. It also demonstrates how to write tests for a "slugify" string method, use data providers to reduce duplicated code, and mock objects to test code in isolation without external dependencies like databases. The document advocates for test-driven development by writing tests before code. It also mentions how to integrate tests with version control using hooks and generate code coverage reports.
The document discusses the lifecycle of code under test, including defining inputs and outputs, initial testing with positive and negative cases, handling bugs, refactoring code, adding abstraction, how future work may affect tests, and handling legacy code. It provides an example of a function to add two strings, injecting a bug, and walking through testing the code at different stages of the lifecycle from initial testing to refactoring and abstraction.
Short introduction to the basics of Perl testing and some resources for further reading. Includes basics of Test::Simple, Test::More, using Inline for multi-language testing, testing coverage, testing tests.
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
This document discusses using CoffeeScript, Backbone.js, and Jasmine BDD to build single page web applications. It begins by explaining why CoffeeScript is useful for cleaning up JavaScript code and avoiding errors. It then discusses how Backbone.js provides structure for single page apps by defining models, collections, views and routers. It notes that Backbone works well with CoffeeScript. Finally, it mentions that Jasmine BDD can be used for writing professional tests.
A look at the future of JVM languages including Kotlin, Scala, Groovy, and latest Java.
Which language to use ? what are the benefits of higher level abstractions ? and what are the benefits of programming on the JVM ?
Vous subissez les régressions à chaque livraison ? Vous ne voyez pas l’intérêt des tests unitaires car ils ne servent qu’à tester des additions ? Les tests ne sont pas applicables à votre projet car il est trop complexe ? Si c’est le cas, suivez David dans la quête du Test Driven Development. Vous rencontrerez pléthore d’ennemies contre lesquels vous aurez à combattre : bugs, complexité, code statique, couplage fort. Ils essaieront de vous barrer la route, mais heureusement, vous pourrez compter sur vos alliés jUnit, Mockito, refactoring et injection/dépendance.
David finira la soirée par une démonstration pratique sur un exercice de refactoring.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/254wkpw.
Aaron Bedra focuses on describing a system as a series of models that can be used to systematically and automatically generate input data and ensure that a code is behaving as expected. Bedra discusses property based testing and how it can help one build more resilient systems and even reduce the time needed to maintain a test suite. Filmed at qconlondon.com.
Aaron Bedra is Chief Security Officer at eligible.com. He is the creator of Repsheet, an open source threat intelligence framework. Bedra is the co-author of Programming Clojure, 2nd Edition and a frequent contributor to open source software.
This document provides an introduction to Scala for Java developers. It discusses that Scala is a hybrid object-oriented and functional language that runs on the JVM and interoperates well with Java. It highlights several features of Scala that allow for more concise code compared to Java, such as type inference, expressions instead of statements, higher-order functions, and case classes.
The next version of JavaScript, ES6, is starting to arrive. Many of its features are simple enhancements to the language we already have: things like arrow functions, class syntax, and destructuring. But other features will change the way we program JavaScript, fundamentally expanding the capabilities of the language and reshaping our future codebases. In this talk we'll focus on two of these, discovering the the myriad possibilities of generators and the many tricks you can pull of with template strings.
Similar to Taking the boilerplate out of your tests with Sourcery (20)
iOS projects are increasingly complex while development teams also keep getting bigger.
On-boarding junior engineers onto such teams is a real challenge.
In this talk I want to share with you the process we put in place at my company, along with some best practices we learned on the way.
Swift 4 introduced KeyPaths, a literal syntax that allows developers to reference a property, in order to evaluate it later. Yet, for some reason, their addition went quite under the radar, and as of today they remain something of a hidden gem within the language.
In this talk, I aim to show you how KeyPaths can be used to implement simple yet useful patterns, like the Builder, but also how they can be the building foundation for more complex pieces of code, like a library to manipulate data in a very declarative SQL-like manner.
Solving callback hell with good old function compositionVincent Pradeilles
When we implement complex scenarios involving asynchronous code, for instance when chaining network calls, we quickly end up with a code filled closures nested into one another. This kind of code is often dubbed « callback hell », because of how hard it is to maintain and reason about.
In the last years, many libraries, such as RxSwift or PromiseKit have been released, with the purpose of tackling this issue. While they work like a charm, it’s actually possible to solve a callback hell situation with a much simpler trick: a good old function composition.
While we are accustomed to function composition in the realm of synchronous functions, we tend to forget this operation is also possible with asynchronous ones, which is a shame because it can really help in simplifying complex code.
Did you know that there is a function in the Objective-C runtime that gives you exactly this list of classes in your app?
With this tool, you can easily build a debug view which will enable you to instantiate any of your ViewControllers, and save you a lot of development time.
When you write unit tests for your projects, there’s a fair chance that you do so by following the classical « Given-When-Then » paradigm, in which you set some input data, execute the code you’re testing, and finally assert that its outcome is indeed the one you expected.
While this approach is perfectly sound, it does suffer one downside: your program will only be tested on the static input data defined in your tests, and there is no real guarantee that this data does cover all edge cases. This can be especially problematic for SDK developers, who, by definition, have a very hard time anticipating all the different situations in which their code will be used.
To improve on this issue, another approach exists, and it is called property-based testing. The idea behind it is very simple: you write your tests by defining properties that must always be true for your program. For example, « an array reversed twice is always equal to itself ». The testing framework will then generate random input values and test wether the property holds or not. And, as you can imagine, this approach is extremely good at narrowing down on overlooked edge cases.
In Swift, we are lucky enough to already have a full-fledged implementation called SwiftCheck, that enables property-based testing (https://github.com/typelift/SwiftCheck). The goal of this talk is thus to explain how property-based testing can be a powerful addition to a testing suite, and give actual and actionable examples of how it can be added to a project using SwiftCheck.
Implementing pseudo-keywords through Functional ProgramingVincent Pradeilles
The document discusses implementing asynchronous code in a more functional way using pseudo-keywords. It introduces a weakify function that takes a function and returns a function that wraps it to avoid retain cycles when referencing self. This approach is expanded to other common patterns like debouncing. The document then shows how property wrappers can be used to implement these pseudo-keywords more declaratively. This allows patterns like asynchronous code and debouncing to be written in a cleaner way without extra boilerplate.
Swift 5.1 brought a new construct to the language: Property Wrappers. SwiftUI, for instance, relies heavily on it to provide its system of data-binding through annotations like @State, @EnvironmentObjects, etc.
Unlike other language improvements, Codable for instance, Apple hasn’t restricted the use of this new feature to its own frameworks: any codebase is free to leverage it to implement custom property attributes that will suit its own specific needs.
While this is a great opportunity to factorise common behaviours throughout a project, one can still wonder: won’t it hurt code readability and predictability on the long run? Keeping code short is good, but if it’s achieved through a collection of arcane annotations, it might end up defying the original intent.
In this talk, I want to introduce what Property Wrappers are, give some example of how they can be leveraged, and try to provide some guidelines on when we they should or shouldn’t be use.
This document discusses monads in functional programming. It provides examples of optionals, arrays, and functions in Swift that exhibit monadic properties. It then defines monads more formally and describes some common monad types like the writer, reader, and IO monads. It shows how monads allow encapsulating effects like logging or environment variables while preserving referential transparency. The document concludes by discussing potential applications of monads to mobile apps.
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
WhatsApp offers simple, reliable, and private messaging and calling services for free worldwide. With end-to-end encryption, your personal messages and calls are secure, ensuring only you and the recipient can access them. Enjoy voice and video calls to stay connected with loved ones or colleagues. Express yourself using stickers, GIFs, or by sharing moments on Status. WhatsApp Business enables global customer outreach, facilitating sales growth and relationship building through showcasing products and services. Stay connected effortlessly with group chats for planning outings with friends or staying updated on family conversations.
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
DDS Security Version 1.2 was adopted in 2024. This revision strengthens support for long runnings systems adding new cryptographic algorithms, certificate revocation, and hardness against DoS attacks.
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Most important New features of Oracle 23c for DBAs and Developers. You can get more idea from my youtube channel video from https://youtu.be/XvL5WtaC20A
What is Master Data Management by PiLog Groupaymanquadri279
PiLog Group's Master Data Record Manager (MDRM) is a sophisticated enterprise solution designed to ensure data accuracy, consistency, and governance across various business functions. MDRM integrates advanced data management technologies to cleanse, classify, and standardize master data, thereby enhancing data quality and operational efficiency.
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
E-commerce Application Development Company.pdfHornet Dynamics
Your business can reach new heights with our assistance as we design solutions that are specifically appropriate for your goals and vision. Our eCommerce application solutions can digitally coordinate all retail operations processes to meet the demands of the marketplace while maintaining business continuity.
Zoom is a comprehensive platform designed to connect individuals and teams efficiently. With its user-friendly interface and powerful features, Zoom has become a go-to solution for virtual communication and collaboration. It offers a range of tools, including virtual meetings, team chat, VoIP phone systems, online whiteboards, and AI companions, to streamline workflows and enhance productivity.
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfUndress Baby
The quest for the best AI face swap solution is marked by an amalgamation of technological prowess and artistic finesse, where cutting-edge algorithms seamlessly replace faces in images or videos with striking realism. Leveraging advanced deep learning techniques, the best AI face swap tools meticulously analyze facial features, lighting conditions, and expressions to execute flawless transformations, ensuring natural-looking results that blur the line between reality and illusion, captivating users with their ingenuity and sophistication.
Web:- https://undressbaby.com/
4. import XCTest
class MyTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
4
9. What is Sourcery?
"Sourcery is a code generator for the Swift language,
built on top of Apple's own SourceKit. It extends the
language abstractions to allow you to generate
boilerplate code automatically."1
1
https://github.com/krzysztofzablocki/Sourcery/blob/master/README.md
9
11. What can we do with Sourcery?
enum Direction {
case up
case right
case down
case left
}
Direction.allCases // [.up, .right, .down, .left]
11
12. What can we do with Sourcery?
Since Swift 4.2, this can be achieved through the
CaseIterable protocol.
But before, generating .allCases was a great use case
to illustrate how Sourcery works.
12
26. To Sum Up
→ Sourcery parses your source code
→ It then uses it to execute templates
→ Those templates generate new source code
→ Your project can use this generated code
26
59. No more boilerplate
Now we only focus on writing tests for the business logic
Of course, there's a lot more features we could add:
→ variables to store arguments
→ calling completion handlers
→ dealing with throwing functions
→ etc.
59
60. No more boilerplate
Sourcery actually ships with a template that takes
care of all those needs: AutoMockable
(But beware, it is MUCH harder to understand )
60
61. We are now able to generate tools for testing...
61
71. How do we test those injections?
Let's reason about the situation:
→ The dependencies follow a tree structure
→ The view controllers are the roots of those trees
→ By instantiating them, we trigger the whole
injection process
71
72. How do we test those injections?
Conclusion: we need to write tests that attempt to
instantiate all the controllers.
72
76. That's it!
As new controllers are added to the factory, the
corresponding tests will be written automatically
No more room for mistakes, pretty cool!
76
78. Recap
→ Sourcery is really easy to set up, don't feel scared to try it!
→ (It's also easy to take it out of a project, should you need)
→ It's a great tool to avoid writing boilerplate code by hand
→ Tests are a perfect place to use Sourcery, because they
involve lots of boilerplate
→ Every time a "one-size-fits-all" approach makes sense,
there's a good chance Sourcery can help
78
82. Be careful!
Sourcery lets us manipulate familiar concepts
(types, protocols, etc.) in an unfamiliar manner.
We get to look at our code the same way that Xcode
does.
This is not an approach we are used to, and it is very
easy to fail to consider some edge cases
82
84. First, ask Google
Templates tend to be much more complicated than
initially thought (remember AutoMockable).
A little Google search might just save you a lot of
time by pointing you in the right direction.
84
86. Should I commit generated files?
We might initially think that generated code should not be
versionned.
However, you should seriously consider versionning it.
This way, changes to generated files will appear during code review,
providing the opportunity to check that everything still works fine.
If you don't version generated files, it becomes really easy to forget
that they even exist...
86