Objective-C is an object-oriented programming language that adds Smalltalk-style messaging to C. It allows programmers to define classes and objects that send and receive messages. Key features include classes and objects, memory management through retain counts, categories to add methods to classes, and protocols to define method requirements. Objective-C code uses square brackets [] to send messages between objects and uses dot syntax as a shorthand. Recommended resources for learning more about Objective-C include Apple's documentation and books focused on Cocoa and Objective-C.
10 - Scala. Co-product type (sum type)Roman Brovko
1. The document discusses sum types (coproducts) in type theory, which allow combining multiple types into a single type using constructors like inl and inr.
2. Sum types have formation rules for constructing a sum of two types A and B, and eliminators for pattern matching on a sum.
3. Examples are given of implementing sum types in Haskell, Scala, Java, and using ProvingGround's built-in and custom sum types.
This document provides an introduction to MATLAB by covering key topics like the command window, inputs and outputs, M files, and basic programming structures in MATLAB such as conditionals and loops. Some key points covered include how to enter and manipulate matrices in the command window, perform basic math operations, load and save data, plot graphs, write M files to organize commands and create functions, and use conditional statements and loops in M files.
- Typeclasses in Scala allow defining common behavior (like printing) for unrelated types through implicit parameters and resolution. This avoids needing to modify types to add functionality.
- They work by defining typeclass traits that take a type parameter (like Show[T]), providing implicit values that implement traits for specific types, and having methods use implicit parameters of the typeclass.
- While powerful, typeclasses can cause issues like ambiguous implicits and lack consistency when multiple instances are defined. The Shapeless library addresses some limitations by allowing automatic typeclass instance derivation based on a type's structure.
Domain-Driven Design (DDD) and Functional Programming (FP) have a lot of good things in common: DDD has borrowed many ideas from the FP community, and both share a common inspiration on established formalisms like maths.
Even in non functional languages like Java or C#, this combined set of practices from DDD, OO and FP helps craft simple and powerful code that reads well, that is very easy to test, that composes well and that can somehow describe itself.
We will have a closer look at some of these ideas, in the context of domain models inspired from real-world projects. From value objects and DSL to abstract algebra creatures like monoids and friends, we will show how all that translates into beautiful code that may influence your coding style!
This document discusses using a tagless final embedded domain specific language (eDSL) approach to build a functional API for the imperative WebGL graphics library. It describes wrapping WebGL calls in IO as one solution but notes issues with separation of concerns and testing. The document then introduces tagless final as a way to define algebras that model WebGL operations and can have multiple interpreters. It provides examples of defining console, key-value store, and prompt algebras and combining them. The document concludes that tagless final allows defining interactions through algebras that can be composed, layered and have multiple interpreters for flexibility and testability while working at an extra level of abstraction.
The Essence of the Iterator pattern treats iterating over collections as two problems, which exhibit traversal of collections (and modifying the content) and accumulating values based on the contents. Jeremy Gibbons and Bruno C.d.S. Oliveira show how Applicative Functors and related type classes can be used in functional programming to solve these problems.
Paper: http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf
The paper "Essence of the iterator pattern" is widely quoted amongst the functional programming community and illustrates nicely how recent acadamic research (Applicative Functors, McBride, 2008) finds its way into language design and application of functional programming languages such as Scala or Haskell.
The slides give a brief introduction and were presented at the "Papers We Love" Meetup in Hamburg.
The document discusses Arrow, a generalization of functions in Scala. Arrows can represent computations with multiple inputs through tuples. The document defines Arrow traits and shows examples of Arrow combinators like first, second, split, and combine. It also compares Arrows to Applicatives and Monads. Arrows provide building blocks for functional reactive programming but have clumsy syntax. The document further discusses Arrow extensions like ArrowChoice and ArrowLoop, which enables feedback loops through lazy evaluation. It concludes with Comonads, which consume context, and MonadFix, which enables stackless recursion.
Objective-C is an object-oriented programming language that adds Smalltalk-style messaging to C. It allows programmers to define classes and objects that send and receive messages. Key features include classes and objects, memory management through retain counts, categories to add methods to classes, and protocols to define method requirements. Objective-C code uses square brackets [] to send messages between objects and uses dot syntax as a shorthand. Recommended resources for learning more about Objective-C include Apple's documentation and books focused on Cocoa and Objective-C.
10 - Scala. Co-product type (sum type)Roman Brovko
1. The document discusses sum types (coproducts) in type theory, which allow combining multiple types into a single type using constructors like inl and inr.
2. Sum types have formation rules for constructing a sum of two types A and B, and eliminators for pattern matching on a sum.
3. Examples are given of implementing sum types in Haskell, Scala, Java, and using ProvingGround's built-in and custom sum types.
This document provides an introduction to MATLAB by covering key topics like the command window, inputs and outputs, M files, and basic programming structures in MATLAB such as conditionals and loops. Some key points covered include how to enter and manipulate matrices in the command window, perform basic math operations, load and save data, plot graphs, write M files to organize commands and create functions, and use conditional statements and loops in M files.
- Typeclasses in Scala allow defining common behavior (like printing) for unrelated types through implicit parameters and resolution. This avoids needing to modify types to add functionality.
- They work by defining typeclass traits that take a type parameter (like Show[T]), providing implicit values that implement traits for specific types, and having methods use implicit parameters of the typeclass.
- While powerful, typeclasses can cause issues like ambiguous implicits and lack consistency when multiple instances are defined. The Shapeless library addresses some limitations by allowing automatic typeclass instance derivation based on a type's structure.
Domain-Driven Design (DDD) and Functional Programming (FP) have a lot of good things in common: DDD has borrowed many ideas from the FP community, and both share a common inspiration on established formalisms like maths.
Even in non functional languages like Java or C#, this combined set of practices from DDD, OO and FP helps craft simple and powerful code that reads well, that is very easy to test, that composes well and that can somehow describe itself.
We will have a closer look at some of these ideas, in the context of domain models inspired from real-world projects. From value objects and DSL to abstract algebra creatures like monoids and friends, we will show how all that translates into beautiful code that may influence your coding style!
This document discusses using a tagless final embedded domain specific language (eDSL) approach to build a functional API for the imperative WebGL graphics library. It describes wrapping WebGL calls in IO as one solution but notes issues with separation of concerns and testing. The document then introduces tagless final as a way to define algebras that model WebGL operations and can have multiple interpreters. It provides examples of defining console, key-value store, and prompt algebras and combining them. The document concludes that tagless final allows defining interactions through algebras that can be composed, layered and have multiple interpreters for flexibility and testability while working at an extra level of abstraction.
The Essence of the Iterator pattern treats iterating over collections as two problems, which exhibit traversal of collections (and modifying the content) and accumulating values based on the contents. Jeremy Gibbons and Bruno C.d.S. Oliveira show how Applicative Functors and related type classes can be used in functional programming to solve these problems.
Paper: http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf
The paper "Essence of the iterator pattern" is widely quoted amongst the functional programming community and illustrates nicely how recent acadamic research (Applicative Functors, McBride, 2008) finds its way into language design and application of functional programming languages such as Scala or Haskell.
The slides give a brief introduction and were presented at the "Papers We Love" Meetup in Hamburg.
The document discusses Arrow, a generalization of functions in Scala. Arrows can represent computations with multiple inputs through tuples. The document defines Arrow traits and shows examples of Arrow combinators like first, second, split, and combine. It also compares Arrows to Applicatives and Monads. Arrows provide building blocks for functional reactive programming but have clumsy syntax. The document further discusses Arrow extensions like ArrowChoice and ArrowLoop, which enables feedback loops through lazy evaluation. It concludes with Comonads, which consume context, and MonadFix, which enables stackless recursion.
The document discusses copy constructors in C++. It explains that a copy constructor is used to initialize an object from another object of the same class. It takes the other object as a reference parameter. The document provides an example class with a copy constructor that copies the member variables of one object to another. It also shows sample code that uses the copy constructor to make a copy of an object.
Download for flawless quality (slides viewed online look a bit grainy and out of focus).
Equivalence of nested flatMaps and chained flatMaps for Kleisli arrow composition.
Function Programming in Scala.
A lot of my examples here comes from the book
Functional programming in Scala By Paul Chiusano and Rúnar Bjarnason, It is a good book, buy it.
This is going to be a discussion about design patterns. But I promise it’s going to be very different from the Gang of Four patterns that we all have used and loved in Java.
It doesn’t have any mathematics or category theory - it’s about developing an insight that lets u identify code structures that u think may be improved with a beautiful transformation of an algebraic pattern.
In earlier days of Java coding we used to feel proud when we could locate a piece of code that could be transformed into an abstract factory and the factory bean could be injected using Spring DI. The result was we ended up maintaining not only Java code, but quite a bit of XML too, untyped and unsafe. This was the DI pattern in full glory. In this session we will discuss patterns that don’t look like external artifacts, they are part of the language, they have some mathematical foundations in the sense that they have an algebra that actually compose and compose organically to evolve larger abstractions.
The document discusses Applicative Functors, Monads, Foldables and Traversables in Scala. Some key points:
1. Applicative Functors allow applying functions to values inside data structures in a point-free style, while preserving the structure.
2. Monads are more powerful than Applicative Functors as they can flatten nested structures and change behavior through chaining of functions.
3. Foldables allow aggregating values inside a data structure using a Monoid. Traversables generalize Foldables by keeping the structure intact using an Applicative instead of a Monoid.
4. Composition of Applicative Functors is possible generically, but composition of
DataStax Accelerate - "Extending Gremlin with Foundational Steps" - Discusses Gremlin the graph traversal language of Apache TinkerPop and its functional, data-flow style. Examines how Gremlin can be extended to a Domain Specific Language (DSL) to encapsulate foundational and domain specific logic for better code organization and reusability.
Deck is a library for clients to make scalable presentations, using a standard markup language. Clients read deck files into the Deck structure, and traverse the structure for display, publication, etc. Clients may be interactive or produce standard formats such as SVG or PDF.
Also included is a REST API for listing content, uploading, stopping, starting and removing decks, generating tables, and playing video.
All layout in done in terms of percentages, using a coordinate system with the origin (0%, 0%) at the lower left. The x (horizontal) direction increases to the right, with the y (vertical) direction increasing to upwards. For example, to place an element in the middle of the canvas, specify xp="50" yp="50". To place an element one-third from the top, and one-third from the bottom: xp="66.6" yp="33.3".
The size of text is also scaled to the width of the canvas. For example sp="3" is a typical size for slide headings. The dimensions of graphical elements (width, height, stroke width) are also scaled to the canvas width.
The content of the slides are automatically scaled based on the specified canvas size (sane defaults are should be set the clients, if dimensions not specified)
Deck is a Go package for creating presentations using a single markup language. It allows elements for text, lists, code, images and graphics with all layout and sizes expressed as percentages. Clients can interactively view presentations or export to formats like PDF and SVG. Servers use a RESTful API for uploading, listing, starting, stopping and removing presentations.
I was a developer at Microsoft from 2004 to 2017 where I worked on various projects including corefx and OleDb. An example code shows initializing a Guid id, converting it to a string, and conditionally assigning an instance of class Foo to a variable or null depending on a boolean value. The code also shows defining a public static class Foo with a static constructor and instance constructor that writes to the console. Libraries can be distributed as .jar/.aar, .dll/.so/.dylib, or .framework files depending on the platform and my Twitter handle is @EgorBo.
Patrick Premont of BoldRadius presented this talk at Scala By The Bay 2015.
Why do data structure lookups often return Options? Could we safely eliminate all the recovery code that we hope is never called? We will see how Scala’s type system lets us express referential integrity constraints to achieve unparalleled reliability. We apply the technique to in-memory data structures using the Total-Map library and consider how to extend the benefits to persisted data.
How to Handle NoSQL with a Relational DatabaseDATAVERSITY
It can be difficult to scale out relational databases and provide more schema flexibility, thus the rise of NoSQL. However, you shouldn’t have to sacrifice data integrity and transactions in order to scale out on commodity hardware and support semi-structured data. By using an RDBMS with built-in sharding and JSON support, you don’t have to. You get the scalability and flexibility of a NoSQL database along with the consistency and reliability of a relational database – and the ability to mix and match relational and JSON data.
In this webinar, we’ll explain how MariaDB Platform can be deployed as a NoSQL database by using the Spider storage engine and built-in SQL functions for JSON. In addition, we’ll discuss how you can access relational data as JSON documents, and how to enforce data integrity if a relational data model is extended with JSON.
Expressing Types as values using GADTS in scala and various other techniques. Using Schemas in this style allows subsequent derivation ot Typeclass instances (and other fun things)
If you want to play around with a minimal example of the involved code here you go: https://scalafiddle.io/sf/YSrSwQy/1
This document provides information about functions in Apache Hive, including a cheat sheet covering user defined functions (UDFs) and built-in functions. It describes how to create UDFs, UDAFs, and UDTFs in Hive along with examples. The document also lists many common mathematical, string, date and other function types available in Hive with descriptions.
Managing model-to-model transformations at scale with YAMTL (lowcomote)Artur Boronat
This document discusses YAMTL, a model transformation language for performing model-to-model and model-to-text transformations at scale. YAMTL uses an internal DSL based on Xtend for defining model transformations. It allows for model-based pattern matching, traceability of model changes, and incremental execution of transformations. YAMTL aims to improve the performance and scalability of model transformations compared to other languages through features like lazy rule evaluation, optimized collection handling, and interoperability with Java libraries. The document outlines YAMTL's execution model and language features, and provides an example of using YAMTL to synchronize class and database models.
The document discusses type-level programming in Scala. It covers several type-level programming techniques including:
1. Type safe equality using an implicit class StrictEq to define === operator that checks equality at compile time.
2. Builder pattern using phantom types to encode constraints and only allow building of valid objects.
3. Type class pattern to define type-parameterized behaviors like addition using an Adder trait and implicit instances.
4. Literal types to encode additional meaning to values like 42.type.
5. Dependent types where a type may depend on a value, like a type parameter a in a.B.
Scala 3 is arriving, and with it comes incredible new power for library authors. In this presentation, Alexander Ioffe, contributor to Quill (a LINQ-like persistence layer for Scala), will show how using Scala 3 Macros, Quill is being rebuilt to be better, stronger, and faster. As you will learn in this presentation, Scala 3 introduces a new powerhouse keyword called 'inline' that opens up a new continent of capability. This construct powers all Scala 3 macros, and allows users to interact with staged code almost indistinguishably from normal code, allowing familiar patterns such as global-methods, type-classes, and type-level-logic. For Quill, Alexander will show how this allows generating compile-time SQL using patterns that we once only dreamed about using--and these features just scratch the surface of what can be done with staged code. Come discover the bright future of powerful, type-safe libraries in Scala 3!
This document discusses various concepts related to polymorphism in Scala, including:
- Different types of polymorphism like subtyping, parametric polymorphism, and type classes.
- Examples of polymorphism patterns like duck typing, cake patterns, chaining polymorphism, and type constructors.
- How type classes enable retroactive polymorphism and dependency injection through implicit parameters.
The document describes list types in Haskell, Scala, and Java and how they are represented using dependent types. It includes:
1) The list type definitions for Haskell, Scala, and Java.
2) How lists are formed from types in dependent type theory using constructors and eliminators.
3) Computation rules for reducing cases on lists.
4) The uniqueness principle for lists in dependent type theory.
5) An example of proving properties of lists using ProvingGround, a dependently typed programming language.
The document discusses copy constructors in C++. It explains that a copy constructor is used to initialize an object from another object of the same class. It takes the other object as a reference parameter. The document provides an example class with a copy constructor that copies the member variables of one object to another. It also shows sample code that uses the copy constructor to make a copy of an object.
Download for flawless quality (slides viewed online look a bit grainy and out of focus).
Equivalence of nested flatMaps and chained flatMaps for Kleisli arrow composition.
Function Programming in Scala.
A lot of my examples here comes from the book
Functional programming in Scala By Paul Chiusano and Rúnar Bjarnason, It is a good book, buy it.
This is going to be a discussion about design patterns. But I promise it’s going to be very different from the Gang of Four patterns that we all have used and loved in Java.
It doesn’t have any mathematics or category theory - it’s about developing an insight that lets u identify code structures that u think may be improved with a beautiful transformation of an algebraic pattern.
In earlier days of Java coding we used to feel proud when we could locate a piece of code that could be transformed into an abstract factory and the factory bean could be injected using Spring DI. The result was we ended up maintaining not only Java code, but quite a bit of XML too, untyped and unsafe. This was the DI pattern in full glory. In this session we will discuss patterns that don’t look like external artifacts, they are part of the language, they have some mathematical foundations in the sense that they have an algebra that actually compose and compose organically to evolve larger abstractions.
The document discusses Applicative Functors, Monads, Foldables and Traversables in Scala. Some key points:
1. Applicative Functors allow applying functions to values inside data structures in a point-free style, while preserving the structure.
2. Monads are more powerful than Applicative Functors as they can flatten nested structures and change behavior through chaining of functions.
3. Foldables allow aggregating values inside a data structure using a Monoid. Traversables generalize Foldables by keeping the structure intact using an Applicative instead of a Monoid.
4. Composition of Applicative Functors is possible generically, but composition of
DataStax Accelerate - "Extending Gremlin with Foundational Steps" - Discusses Gremlin the graph traversal language of Apache TinkerPop and its functional, data-flow style. Examines how Gremlin can be extended to a Domain Specific Language (DSL) to encapsulate foundational and domain specific logic for better code organization and reusability.
Deck is a library for clients to make scalable presentations, using a standard markup language. Clients read deck files into the Deck structure, and traverse the structure for display, publication, etc. Clients may be interactive or produce standard formats such as SVG or PDF.
Also included is a REST API for listing content, uploading, stopping, starting and removing decks, generating tables, and playing video.
All layout in done in terms of percentages, using a coordinate system with the origin (0%, 0%) at the lower left. The x (horizontal) direction increases to the right, with the y (vertical) direction increasing to upwards. For example, to place an element in the middle of the canvas, specify xp="50" yp="50". To place an element one-third from the top, and one-third from the bottom: xp="66.6" yp="33.3".
The size of text is also scaled to the width of the canvas. For example sp="3" is a typical size for slide headings. The dimensions of graphical elements (width, height, stroke width) are also scaled to the canvas width.
The content of the slides are automatically scaled based on the specified canvas size (sane defaults are should be set the clients, if dimensions not specified)
Deck is a Go package for creating presentations using a single markup language. It allows elements for text, lists, code, images and graphics with all layout and sizes expressed as percentages. Clients can interactively view presentations or export to formats like PDF and SVG. Servers use a RESTful API for uploading, listing, starting, stopping and removing presentations.
I was a developer at Microsoft from 2004 to 2017 where I worked on various projects including corefx and OleDb. An example code shows initializing a Guid id, converting it to a string, and conditionally assigning an instance of class Foo to a variable or null depending on a boolean value. The code also shows defining a public static class Foo with a static constructor and instance constructor that writes to the console. Libraries can be distributed as .jar/.aar, .dll/.so/.dylib, or .framework files depending on the platform and my Twitter handle is @EgorBo.
Patrick Premont of BoldRadius presented this talk at Scala By The Bay 2015.
Why do data structure lookups often return Options? Could we safely eliminate all the recovery code that we hope is never called? We will see how Scala’s type system lets us express referential integrity constraints to achieve unparalleled reliability. We apply the technique to in-memory data structures using the Total-Map library and consider how to extend the benefits to persisted data.
How to Handle NoSQL with a Relational DatabaseDATAVERSITY
It can be difficult to scale out relational databases and provide more schema flexibility, thus the rise of NoSQL. However, you shouldn’t have to sacrifice data integrity and transactions in order to scale out on commodity hardware and support semi-structured data. By using an RDBMS with built-in sharding and JSON support, you don’t have to. You get the scalability and flexibility of a NoSQL database along with the consistency and reliability of a relational database – and the ability to mix and match relational and JSON data.
In this webinar, we’ll explain how MariaDB Platform can be deployed as a NoSQL database by using the Spider storage engine and built-in SQL functions for JSON. In addition, we’ll discuss how you can access relational data as JSON documents, and how to enforce data integrity if a relational data model is extended with JSON.
Expressing Types as values using GADTS in scala and various other techniques. Using Schemas in this style allows subsequent derivation ot Typeclass instances (and other fun things)
If you want to play around with a minimal example of the involved code here you go: https://scalafiddle.io/sf/YSrSwQy/1
This document provides information about functions in Apache Hive, including a cheat sheet covering user defined functions (UDFs) and built-in functions. It describes how to create UDFs, UDAFs, and UDTFs in Hive along with examples. The document also lists many common mathematical, string, date and other function types available in Hive with descriptions.
Managing model-to-model transformations at scale with YAMTL (lowcomote)Artur Boronat
This document discusses YAMTL, a model transformation language for performing model-to-model and model-to-text transformations at scale. YAMTL uses an internal DSL based on Xtend for defining model transformations. It allows for model-based pattern matching, traceability of model changes, and incremental execution of transformations. YAMTL aims to improve the performance and scalability of model transformations compared to other languages through features like lazy rule evaluation, optimized collection handling, and interoperability with Java libraries. The document outlines YAMTL's execution model and language features, and provides an example of using YAMTL to synchronize class and database models.
The document discusses type-level programming in Scala. It covers several type-level programming techniques including:
1. Type safe equality using an implicit class StrictEq to define === operator that checks equality at compile time.
2. Builder pattern using phantom types to encode constraints and only allow building of valid objects.
3. Type class pattern to define type-parameterized behaviors like addition using an Adder trait and implicit instances.
4. Literal types to encode additional meaning to values like 42.type.
5. Dependent types where a type may depend on a value, like a type parameter a in a.B.
Scala 3 is arriving, and with it comes incredible new power for library authors. In this presentation, Alexander Ioffe, contributor to Quill (a LINQ-like persistence layer for Scala), will show how using Scala 3 Macros, Quill is being rebuilt to be better, stronger, and faster. As you will learn in this presentation, Scala 3 introduces a new powerhouse keyword called 'inline' that opens up a new continent of capability. This construct powers all Scala 3 macros, and allows users to interact with staged code almost indistinguishably from normal code, allowing familiar patterns such as global-methods, type-classes, and type-level-logic. For Quill, Alexander will show how this allows generating compile-time SQL using patterns that we once only dreamed about using--and these features just scratch the surface of what can be done with staged code. Come discover the bright future of powerful, type-safe libraries in Scala 3!
This document discusses various concepts related to polymorphism in Scala, including:
- Different types of polymorphism like subtyping, parametric polymorphism, and type classes.
- Examples of polymorphism patterns like duck typing, cake patterns, chaining polymorphism, and type constructors.
- How type classes enable retroactive polymorphism and dependency injection through implicit parameters.
The document describes list types in Haskell, Scala, and Java and how they are represented using dependent types. It includes:
1) The list type definitions for Haskell, Scala, and Java.
2) How lists are formed from types in dependent type theory using constructors and eliminators.
3) Computation rules for reducing cases on lists.
4) The uniqueness principle for lists in dependent type theory.
5) An example of proving properties of lists using ProvingGround, a dependently typed programming language.
This document discusses improving the schema definition process in ZIO SQL. It proposes using Scala case classes and ZIO Schema to capture the structure of data and generate table schemas. ZIO Schema analyzes case classes to provide implicit schemas, and an AccessorBuilder pattern is used to generate column expressions from the schemas. This avoids boilerplate while providing type safety compared to alternatives like plain SQL strings.
The document summarizes new features introduced in Java 5, including generics for type-safe collections, enhanced for-each loops, auto-boxing/unboxing of primitive types, typesafe enums, variable arguments, static imports, annotations, and improved formatted output. It provides code examples to illustrate how these new features improve on and replace older styles in Java.
This document discusses type classes in Scala and Haskell. It provides a recap of implicits in Scala, including implicit parameters, conversions, and views. It then introduces type class concepts and examples from the Scala standard library like Ordering and Numeric. It explains how to define a Printable type class and instances for types like Int and Cat. It discusses improved designs using companion objects and implicit classes. Finally, it covers where to define type class instances, such as for standard types in the companion object and domain types in their package.
This document discusses expression trees in C#. It begins with an introduction to expression trees, which describe the structure of an expression. It then discusses how expression trees are represented in .NET using types deriving from System.Linq.Expressions.Expression. It provides examples of constructing expression trees manually using factory methods, and how lambda expression trees can be converted into delegates. The document also discusses optimizing reflection-heavy code using expression trees, implementing generic operators with expression trees, parsing DSLs into expression trees, obtaining expression trees from lambdas, and identifying type members using expression trees.
Expression trees is an obscure, although very interesting feature in .NET. Most people probably think of it as something synonymous with object-relational mapping frameworks, but despite being its most common use case, it’s not the only one. There are a lot of creative things you can do with expression trees, including code generation, transpilation, metaprogramming, and more. During this talk, I will explain what this feature really is about and guide you through some examples where it provides real-life benefits.
We'll talk about:
What is an expression tree
How to compile code at runtime
How to make reflection faster
How to implement generic operators
How to turn DSLs into expression trees
How to make metaprogramming type-safe
How to translate a lambda into a different language...and more
The document discusses Structured Query Language (SQL). It describes SQL as a declarative query language used to define database schemas, manipulate data through queries, and perform operations like insert, update, delete. It also outlines SQL's data definition language for defining database structure and data types, and its data manipulation language for conducting queries and CRUD operations. The document provides a brief history of SQL and describes the SQL standard.
Expressive and Efficient Model Transformation with an Internal DSL of XtendArtur Boronat
Model transformation (MT) of very large models (VLMs), with mil- lions of elements, is a challenging cornerstone for applying Model- Driven Engineering (MDE) technology in industry. Recent research efforts that tackle this problem have been directed at distributing MT on the Cloud, either directly, by managing clusters explicitly, or indirectly, via external NoSQL data stores. In this paper, we draw attention back to improving efficiency of model transformations that use EMF natively and that run on non-distributed environments, showing that substantial performance gains can still be reaped on that ground.
We present Yet Another Model Transformation Language (YAMTL), a new internal domain-specific language (DSL) of Xtend for defining declarative MT, and its execution engine. The part of the DSL for defining MT is similar to ATL in terms of expressiveness, including support for advanced modelling contructs, such as multiple rule inheritance and module composition. In addition, YAMTL provides support for specifying execution control strategies. We experimentally demonstrate that the presented transformation engine outper- forms other representative MT engines by using the batch transformation component of the VIATRA CPS benchmark. The improvement is, at least, one order of magnitude over the up-to-now fastest solution in all of the assessed scenarios.
Type safe embedded domain-specific languagesArthur Xavier
Language is everything; it governs our lives: from our thought processes, our communication abilities and our understanding of the world, all the way up to law, politics, logic and programming. All of these domains of human experience are governed by different languages that talk to each other, and so should be your code. Haskell provides all the means necessary—and many more—to easily and safely use embedded small languages that are tailored to specific needs and business domains.
In this series of lectures and workshops, we will explore the whats, whys and hows of embedded domain-specific languages in Haskell, and how language oriented programing can bring type-safety, composability and simplicity to the development of complex applications.
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
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
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.
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
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.
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Odoo ERP software
Odoo ERP software, a leading open-source software for Enterprise Resource Planning (ERP) and business management, has recently launched its latest version, Odoo 17 Community Edition. This update introduces a range of new features and enhancements designed to streamline business operations and support growth.
The Odoo Community serves as a cost-free edition within the Odoo suite of ERP systems. Tailored to accommodate the standard needs of business operations, it provides a robust platform suitable for organisations of different sizes and business sectors. Within the Odoo Community Edition, users can access a variety of essential features and services essential for managing day-to-day tasks efficiently.
This blog presents a detailed overview of the features available within the Odoo 17 Community edition, and the differences between Odoo 17 community and enterprise editions, aiming to equip you with the necessary information to make an informed decision about its suitability for your business.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
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.
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.
SOCRadar's Aviation Industry Q1 Incident Report is out now!
The aviation industry has always been a prime target for cybercriminals due to its critical infrastructure and high stakes. In the first quarter of 2024, the sector faced an alarming surge in cybersecurity threats, revealing its vulnerabilities and the relentless sophistication of cyber attackers.
SOCRadar’s Aviation Industry, Quarterly Incident Report, provides an in-depth analysis of these threats, detected and examined through our extensive monitoring of hacker forums, Telegram channels, and dark web platforms.
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
SMS API Integration in Saudi Arabia| Best SMS API ServiceYara Milbes
Discover the benefits and implementation of SMS API integration in the UAE and Middle East. This comprehensive guide covers the importance of SMS messaging APIs, the advantages of bulk SMS APIs, and real-world case studies. Learn how CEQUENS, a leader in communication solutions, can help your business enhance customer engagement and streamline operations with innovative CPaaS, reliable SMS APIs, and omnichannel solutions, including WhatsApp Business. Perfect for businesses seeking to optimize their communication strategies in the digital age.
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
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.
8. BRIDGES - BY @PVILLEGA
HTTPS://GITHUB.COM/DAVEGURNELL/B
RIDGES
9. BRIDGES - BY @PVILLEGA
WHAT IS THE SOLUTION
ADT BRIDGES ELM *
10. BRIDGES - BY @PVILLEGA
ELM
TYPESCRIP
T
FLOW
Types
Guards
Decoders
Encoders
11. BRIDGES - BY @PVILLEGA
case class Color(red: Int, green: Int, blue: Int)
Elm.buildFile("CustomModule", decl[Color])
12. BRIDGES - BY @PVILLEGA
module CustomModule.Color exposing (..)
import Json.Decode as Decode
import Json.Decode.Pipeline exposing (..)
import Json.Encode as Encode
type alias Color = { red: Int, green: Int, blue:
Int }
decoderColor : Decode.Decoder Color
decoderColor = decode Color |> required "red"
Decode.int |> required "green" Decode.int |>
required "blue" Decode.int
encoderColor : Color -> Encode.Value
encoderColor obj = Encode.object [ ("red",
Encode.int obj.red), ("green", Encode.int
obj.green), ("blue", Encode.int obj.blue) ]
13. BRIDGES - BY @PVILLEGA
sealed trait ADTAndObjects
case class MyClass(value: Int) extends ADTAndObjects
case object MyObject extends ADTAndObjects
case class ValueClass(value: String) extends AnyVal
case class ClassWithUUID(a: UUID)
final case class ComplexTypes(color: Color, nav: Navigation)
final case class RecursiveType(head: Int, tail: Option[RecursiveType])
val customErrorMsg = "ErrorMessage" := prod(
"error" := Ref("ErrorMessage")
)
case class ClassWithRefinedType(name: RefinedString)
14. BRIDGES - BY @PVILLEGA
WORKFLOW WITH BRIDGES
BACK-END
MODEL
RUN SBT
TASK *
15. BRIDGES - BY @PVILLEGA
case class Color(red: Int, green: Int, blue: Int)
sealed abstract class Shape
case class Circle(r: Double, c: Color) extends Shape
case class Rectangle(w: Double, h: Double, c: Color) extends Shape
case class ShapeGroup(left: Shape,right: Shape) extends Shape
Elm.render(decl[Shape])
type Shape = Circle Float Color
| Rectangle Float Float Color
| ShapeGroup Shape Shape
16.
17. BRIDGES - BY @PVILLEGA
sealed abstract class Type
case object Str extends Type
case object Bool extends Type
case class Arr(tpe: Type) extends Type
//Others...
case class Ref(id: String) extends Type
case class Prod(fields: List[Decl]) extends Type
case class Sum(products: List[ProdDecl]) extends Type
18. BRIDGES - BY @PVILLEGA
case class DeclF[+A](name: String, tpe: A)
type Decl = DeclF[Type]
case class Pair(a: String, b: Int)
DeclF(“Pair”, prod(
"a" := Str,
"b" := Intr
)
19. BRIDGES - BY @PVILLEGA
case class DeclF[+A](name: String, tpe: A)
type TsDecl = DeclF[TsType]
DeclF("A",
Ref("B") & Ref("C") & Ref("D")
)
export type A = B & C & D;
20. BRIDGES - BY @PVILLEGA
trait Renderer[A] {
def render(decl: DeclF[A]): String
}
trait ElmRenderer extends Renderer[Type] {
def render(decl: Decl): String =
decl.tpe match {
case Sum(products) ⇒ …
case other ⇒ …
}
// ...
}
21. BRIDGES - BY @PVILLEGA
def decl[A](implicit
tpeTag: WeakTypeTag[A],
encoder: Lazy[Encoder[A]]): Decl =
DeclF(
getCleanTagName[A],
encoder.value.encode)
trait Encoder[A] {
def encode: Type
}
type Decl = DeclF[Type]
22. trait FlowRenderer extends Renderer[FlowType] {
def render(decl: FlowDecl): String =
s"""export type ${decl.name} = ${renderType(decl.tpe)};"""
private def renderType(tpe: FlowType): String =
tpe match {
case Ref(id) => id
case Str => "string"
case Chr => "string"
case Intr => "number"
case Real => "number"
case Bool => "boolean"
case Null => "null"
case Undefined => "undefined"
case StrLit(value) => s""""${escape(value)}""""
case ChrLit(value) => s""""${escape(value.toString)}""""
case IntrLit(value) => value.toString
case RealLit(value) => value.toString
case BoolLit(value) => value.toString
case tpe @ Opt(arg) => s"""?${renderParens(tpe)(arg)}"""
case tpe @ Arr(arg) => s"""${renderParens(tpe)(arg)}[]"""
case Struct(fields) => renderStruct(fields)
case tpe @ Inter(types) => types.map(renderParens(tpe)).mkString(" & ")
case tpe @ Union(types) => types.map(renderParens(tpe)).mkString(" | ")
}
private def renderStruct(fields: List[FlowDecl]): String =
fields.map(renderField).mkString("{ ", ", ", " }")
private def renderField(field: FlowDecl): String =
s"""${field.name}: ${renderType(field.tpe)}"""
private def renderParens(outer: FlowType)(inner: FlowType): String =
if (precedence(outer) > precedence(inner)) s"(${renderType(inner)})"
else renderType(inner)
23. BRIDGES - BY @PVILLEGA
HTTPS://UNDERSCORE.IO/BLOG/POSTS/
2018/12/12/BRIDGES.HTML
HTTPS://GITHUB.COM/DAVEGURNELL/B
RIDGES
24. IF YOU WORK AT
UK’S HOME
OFFICE (OR KNOW
SOMEONE) TALK
TO ME!Questions welcome, too!
THE END!
Editor's Notes
Welcome everyone. I’m Pere Villega, Scala contractor, and in this presentation I’m going to talk about Bridges, a library by Dave Gurnell
Let’s first talk about the problem we want to solve. A project I was working on had a service build in Scala, with Elm used for the front-end. Elm! Describe. As we worked with the service, due to its nature many of the changes ended up following a familiar pattern: edit the back-end, including changes to the model. Modify the Elm model, and then edit Json decoders. A tedious repetitive loop for every change.
Repetitive tasks. There must be a better way, we are supposed to automate them.
And one way is to use Scala.js, in which case then problem solved. Talk is over. Ok, unfortunately we have Elm, not Scala.js
I knew what I wanted: many libraries, like Circe, use Shapeless to generate Json for your case classes. So, why not to use the same mechanism to generate front-end code, going from an ADT via Shapeless to Elm code? It must be a common problem, so there must be a solution out there.
So I did what all developers do: I went to stack overflow and I checked for solutions.
And when that didn’t work I searched a bit more…
And, as it happens, it’s not an uncommon problem. There are some libraries out there that help with this. Unfortunately, many I tested weren’t actively maintained or had crippling issues. Until I found Bridges, by Dave Gurnell
So, what is Bridges? Bridges is the solution to the problem. It allows me to define my ADT in scala, call a method, and obtain Elm code from it. Not only Elm, it also supports Typescript and Flow.
What can you get with Bridges? These are the current capabilities: Elm allows you to generate types, and json encoders and decoders. Typescript provides types, guards (to verify a json blob is the valid type) and decoders. Flow only generates types, currently.
In more practical terms, Bridges allows me to do this: I have a case class that I want to use in Elm. I use a method provided by the library, which says build me a file in that module for Color, and I will get a String as an output
That String contains what is in the slide: fully functional Elm code. Notice we have created module, imports, the type, Color, and both Json Encoder and Decoder for the type.
What Scala types does Bridges support? You can use it with most common structures. Case objects, value Classes. With complex types. With UUID as a first class citizen. With Recursive types. Custom types you create by hand using Bridges . And if you use Refined, you can use it too.
So this is how my workflow has changed now, using Bridges. I modify the back-end model. If I need to work with the front-end, I run an sbt task to generate the necessary code. Note that the sbt task is something that you create yourself, currently it is not included in Bridges.
This is another example with a more complex structure. That’s how you can use it. Simple, not getting in your way. Feels underwhelming when I prepared the slides but there is really not anything else to it.
Let’s check how does Bridges work under the hood to generate code. The answer, obviously, involves shapeless. But we are going to focus on other parts of the machinery in here.
There are a few key components in Bridges. The first component is the Type ADT. It is used to map a Scala ADT into an intermediate language. As you can see we can map basic types like String, references to complex types (like UUID) using Ref, or the Products and Sums in our ADT. Why do we need this structure? The reason we need an intermediate language is that Elm doesn’t have the same capabilities than Typescript, for example, so by doing this step first, we can then create more accurate representations in the target language.
The second important component is Declaration. A named declaration is a parameterised class that stores a name along a Type, and can be either top-level or a field in a sum, product, or in another structure. With it and Type we can manually build representations of a case class in our intermediate language, as the custom types we mentioned before.
Declaration has a type parameter. This allows us to swap the intermediate language. For example the Typescript components use the declaration you see in this slide, TsDecl, which allows us to build Intersection types (which don’t exist in Scala nor Elm) and use it to generate a valid Typescript type.
The final component is Renderer. It is a trait that given a declaration, will generate a string representation in the target language. In this example we see a partial implementation of the Elm renderer, which uses Type as seen before, and how it starts generating either a type or a type alias according to the type of Declaration we receive.
Obviously we don’t want to manually generate the Declarations for our ADT, so here is where shapeless gets involved. The helper method `decl` requires a witness `encoder` of type `A`, our own ADT. Shapeless magic happens and this encoder is generated for us, providing an encoding in an intermediate language, in this case `Type` as per the Decl definition.
As this is a lightning talk I can’t go into more detail on the way Bridges works. But I pasted this code here so you can see how simple can it be to extend it. This is the code for the Flow renderer, which given a declaration generates a syntactically valid type in Flow
For a more detailed description on Bridges, check this blog post at the Underscore blog, and you can always read the source code (and contribute pull requests for new target languages, of course).
And that is all. Now, questions time, but before, if you know someone that works at the home office as a developer please come to talk to me :)