Although OOP has been in industry for a while, it is still one of the paradigms that is most badly applied when it comes to implementation. This presentation tries to uncover the basic fundamentals, so that anyone can apply the paradigm correctly
An overview of the Idris functional programming language. Idris has a number of interesting features such as dependent types, function totality checking and theorem proving.
1) The document discusses Scala and type inference using the Hindley-Milner type system. It provides examples of type inference in Scala and compares it to other languages like OCaml and Haskell.
2) Hindley-Milner type inference allows Scala to infer types for variables and functions without needing explicit type annotations in many cases. This is illustrated through examples of integer increment functions.
3) Type inference in Scala 3.0 aims to improve on the current approach and make types even more implicit, bringing it closer to languages like OCaml.
Category theory concepts such as objects, arrows, and composition directly map to concepts in Scala. Objects represent types, arrows represent functions between types, and composition represents function composition. Scala examples demonstrate how category theory diagrams commute, with projection functions mapping to tuple accessors. Thinking in terms of interfaces and duality enriches both category theory and programming language concepts. Learning category theory provides a uniform way to reason about programming language structures and properties of data types.
Scala is a multi-paradigm programming language that runs on the JVM. It combines object-oriented and functional programming concepts. SBT is the build tool used for Scala projects and allows for incremental compilation. Scala has a uniform approach to collections that emphasizes immutability and uses higher-order
Models—abstract and simple descriptions of some artifact—are the backbone of all software engineering activities. While writing models is hard, existing code can serve as a source for abstract descriptions of how software behaves. To infer correct usage, code analysis needs usage examples, though; the more, the better.
We have built a lightweight parser that efficiently extracts API usage models from source code—models that can then be used to detect anomalies. Applied on the 200 mil- lion lines of code of the Gentoo Linux distribution, we would extract more than 15 million API constraints. On the web site checkmycode.org, anyone can check his/her code against the “wisdom of Linux”.
OSCON Presentation: Developing High Performance Websites and Modern Apps with...Doris Chen
Creating high performance sites and apps is crucial for every developer. In this session, we will explore the best practices and performance tricks, including startup time, UI responsiveness, and Memory efficiency to make your apps running faster and fluid. Come learn the tips, tricks, and tools for maximizing the performance of your sites and apps with JavaScript and HTML5.
Martin Odersky received his PhD in 1989 and began designing Scala in 2001 at EPFL. Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It is concise, high-level, statically typed, and supports both immutable and mutable data structures. Many large companies use Scala including LinkedIn, Twitter, and Ebay. Scala supports both object-oriented programming with classes, traits, and objects as well as functional programming with immutable data, higher-order functions, and algebraic data types.
This document discusses various Yin-Yang concepts in software development, including:
- Effort and knowledge, theory and practice, design for manufacturing and design for assembly represent opposing yet interconnected concepts.
- Programs (E-programs) built on simpler programs (S-programs) balance ease of use and performance.
- Designing for both short-term efficiency and long-term evolvability requires balancing opposing priorities.
- Many software development processes involve balancing logical thinking with creative control, and reducing complexity through modularity.
An overview of the Idris functional programming language. Idris has a number of interesting features such as dependent types, function totality checking and theorem proving.
1) The document discusses Scala and type inference using the Hindley-Milner type system. It provides examples of type inference in Scala and compares it to other languages like OCaml and Haskell.
2) Hindley-Milner type inference allows Scala to infer types for variables and functions without needing explicit type annotations in many cases. This is illustrated through examples of integer increment functions.
3) Type inference in Scala 3.0 aims to improve on the current approach and make types even more implicit, bringing it closer to languages like OCaml.
Category theory concepts such as objects, arrows, and composition directly map to concepts in Scala. Objects represent types, arrows represent functions between types, and composition represents function composition. Scala examples demonstrate how category theory diagrams commute, with projection functions mapping to tuple accessors. Thinking in terms of interfaces and duality enriches both category theory and programming language concepts. Learning category theory provides a uniform way to reason about programming language structures and properties of data types.
Scala is a multi-paradigm programming language that runs on the JVM. It combines object-oriented and functional programming concepts. SBT is the build tool used for Scala projects and allows for incremental compilation. Scala has a uniform approach to collections that emphasizes immutability and uses higher-order
Models—abstract and simple descriptions of some artifact—are the backbone of all software engineering activities. While writing models is hard, existing code can serve as a source for abstract descriptions of how software behaves. To infer correct usage, code analysis needs usage examples, though; the more, the better.
We have built a lightweight parser that efficiently extracts API usage models from source code—models that can then be used to detect anomalies. Applied on the 200 mil- lion lines of code of the Gentoo Linux distribution, we would extract more than 15 million API constraints. On the web site checkmycode.org, anyone can check his/her code against the “wisdom of Linux”.
OSCON Presentation: Developing High Performance Websites and Modern Apps with...Doris Chen
Creating high performance sites and apps is crucial for every developer. In this session, we will explore the best practices and performance tricks, including startup time, UI responsiveness, and Memory efficiency to make your apps running faster and fluid. Come learn the tips, tricks, and tools for maximizing the performance of your sites and apps with JavaScript and HTML5.
Martin Odersky received his PhD in 1989 and began designing Scala in 2001 at EPFL. Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It is concise, high-level, statically typed, and supports both immutable and mutable data structures. Many large companies use Scala including LinkedIn, Twitter, and Ebay. Scala supports both object-oriented programming with classes, traits, and objects as well as functional programming with immutable data, higher-order functions, and algebraic data types.
This document discusses various Yin-Yang concepts in software development, including:
- Effort and knowledge, theory and practice, design for manufacturing and design for assembly represent opposing yet interconnected concepts.
- Programs (E-programs) built on simpler programs (S-programs) balance ease of use and performance.
- Designing for both short-term efficiency and long-term evolvability requires balancing opposing priorities.
- Many software development processes involve balancing logical thinking with creative control, and reducing complexity through modularity.
This document discusses stacks as an abstract data type (ADT) and their implementation in Java. It begins by defining an ADT as having a specific interface of operations and axioms defining the semantics of those operations. Stacks are introduced as a LIFO data structure that supports push, pop, and top operations. The document then discusses implementing a stack interface in Java using exceptions to handle errors. It provides an example array-based stack implementation in Java using an array and index to track elements. Finally, it discusses an application of stacks to efficiently compute the span of stock price changes over time by using a stack to track previous higher prices.
This document introduces monad transformers and illustrates their usage in Scala. It defines the Reader and IO monads and shows how they can be composed using the ReaderT transformer. This allows defining computations that both read configuration values and perform side effects. The document recommends using type classes like MonadReader and MonadBase to define computations over monad stacks in a parametrically polymorphic way. It provides examples of defining and running such computations over a ReaderT[IO, ?] stack.
Watch video (in Hebrew): http://parleys.com/play/53f7a9cce4b06208c7b7ca1e
Type classes are a fundamental feature of Scala, which allows you to layer new functionality on top of existing types externally, i.e. without modifying or recompiling existing code. When combined with implicits, this is a truly remarkable tool that enables many of the advanced features offered by the Scala library ecosystem. In this talk we'll go back to basics: how type classes are defined and encoded, and cover several prominent use cases.
A talk given at the Underscore meetup on 19 August, 2014.
The document discusses different data structures for representing queues and linked lists, including their implementations and operations. Queues follow FIFO ordering and can be implemented using arrays or linked lists. Linked lists allow efficient insertion/removal at both ends and can be used to implement double-ended queues (deques). Deques support efficient insertion/removal from both ends and can implement stacks and queues. Sequences generalize vectors and linked lists, introducing the concept of positions to provide implementation independence.
Sukant Hajra gave a presentation on type classes in Scala. The presentation introduced type classes as an alternative to ad hoc polymorphism that provides stronger guarantees. It provided examples of using type classes for concepts like equality, size, and monoid. It explained how type classes are encoded in Scala using implicits and discussed best practices for organizing implicit instances. The presentation concluded after demonstrating some capabilities of the Scalaz library, which provides many type class instances.
Presented online for C++ on Sea (2020-07-17)
Video at https://www.youtube.com/watch?v=Bai1DTcCHVE
Lambdas. All the cool kid languages have them. But does lambda mean what C++ and other languages, from Java to Python, mean by lambda? Where did lambdas come from? What were they originally for? What is their relationship to data abstraction?
In this session we will into the history, the syntax, the uses and abuses of lambdas and the way in which lambda constructs in C++ and other languages do (or do not) match the original construct introduced in lambda calculus.
This document outlines the agenda and content for a Scala training workshop. The agenda includes an introduction, sections on types and pattern matching, lists, collections, lazy evaluation, exercises, and sharing. The types and pattern matching section covers functions as objects, subtyping and generics, pattern matching, and examples. It also discusses blocks, tail recursion, higher-order functions, currying, and data abstraction through class hierarchies and traits vs abstract classes. The document provides examples for many of these concepts. Exercises at the end include implementing Pascal's triangle through recursion.
The Ring programming language version 1.3 book - Part 82 of 88Mahmoud Samir Fayed
The Ring documentation describes the different data types that can be used to represent values in Ring programs. The main types are Number, String, and List. Number can represent numeric values like integers and doubles. String represents textual data like characters, dates, and times. List represents arrays and collections like dictionaries and trees that can contain multiple data types. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything while also allowing customization through new classes.
This document provides an overview and summary of Numerical Python (NumPy), an extension to the Python programming language that adds support for large, multi-dimensional arrays and matrices, along with a large library of high-level mathematical functions to operate on these arrays. It describes how to install NumPy, test the installation, and introduces some of the key features like array objects, universal functions (ufuncs), and convenience functions for array creation and manipulation.
The document provides an introduction and tutorial to Java 3D, a library for displaying three-dimensional graphics in Java. It covers installing Java 3D, creating a basic 3D program with a cube, adding lighting, positioning objects in 3D space using transformations, changing object appearances using materials and textures, and more. Examples of Java 3D code are provided throughout to demonstrate key concepts.
This document discusses various data types and conversions between them in Java. It defines variables of different primitive data types like boolean, byte, char, int etc and assigns values. It then demonstrates conversions between boolean and other data types by assigning the result of a ternary operator to the other variables. The values before and after conversions are printed to check the results. This allows understanding implicit and explicit type conversions between different data types in Java.
This document discusses type classes in Haskell and how they relate to object-oriented programming concepts. It makes three key points:
1. Type classes implement type-based dispatch rather than value-based dispatch, unlike object-oriented languages which do value-based dispatch.
2. Haskell classes are more analogous to interfaces in object-oriented languages, specifying which operations a type must support, rather than classes which provide an implementation.
3. Haskell uses parametric polymorphism and generics rather than subtyping, so functions work for any type instance of a class rather than subclasses of a type. This means functions must anticipate working with a variety of types from the start.
Scala for Java Developers provides an overview of Scala for Java developers. It discusses:
- The goals of understanding what Scala is, learning more about it, and installing Scala.
- An introduction to Scala including what it is, its history from 1995 to 2013, and whether it is a good fit for certain uses based on its strengths like functional programming and weaknesses like syntax.
- How to get started with Scala including required and optional software and plugins.
- Key Scala features like objects, classes, traits, pattern matching, and collections.
Special Edition with Dr. Robin Bloor
Live Webcast September 9, 2015
Watch the Archive: https://bloorgroup.webex.com/bloorgroup/onstage/g.php?MTID=e8b9ac35d8e4ffa3452562c1d4286a975
Do the math: algebra will transform information management. Just as the relational database revolutionized the information landscape, so will a just-released, complete algebra of data overhaul the industry itself. So says Dr. Robin Bloor in his new book, the Algebra of Data, which he’ll outline in this special one-hour webcast.
Once organizations learn how to express their data sets algebraically, the benefits will be significant and far-reaching. Data quality problems will slowly subside; queries will run orders of magnitude faster; integration challenges will fade; and countless tedious jobs in the data management space will bid their farewell. But first, software companies must evolve, and that will take time.
Visit InsideAnalysis.com for more information.
The document describes the merge sort algorithm. It begins by explaining the divide and conquer approach to algorithm design, which merge sort uses. It then provides pseudocode that divides the input array into two halves, recursively sorts each half using merge sort, and then merges the two sorted halves back together. The document includes examples walking through applying merge sort to an array. It analyzes the running time of merge sort using recurrence relations and the substitution method, determining its runtime is O(n log n). Finally, it provides Java code implementing merge sort.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an overview of the Introduction to Programming in MATLAB course. It outlines the course layout including 5 lectures covering various MATLAB topics. Problem sets are due daily and students must complete all lectures and problem sets to pass. Basic MATLAB skills such as scripts, variables, arrays, and basic plotting are introduced. The document also provides instructions for getting started with MATLAB and accessing resources.
This presentation at TEFCON2016 (Telefonica Developers Conference) shows how hackathons can be applied to software projects to exhibit Agility.
From Agile "methods" today to the root of what developing software should be about : programming.
Explaining what is software architecture from a different point of view and giving the fundamentals for understanding what software architecture is and how it should be created
This document discusses stacks as an abstract data type (ADT) and their implementation in Java. It begins by defining an ADT as having a specific interface of operations and axioms defining the semantics of those operations. Stacks are introduced as a LIFO data structure that supports push, pop, and top operations. The document then discusses implementing a stack interface in Java using exceptions to handle errors. It provides an example array-based stack implementation in Java using an array and index to track elements. Finally, it discusses an application of stacks to efficiently compute the span of stock price changes over time by using a stack to track previous higher prices.
This document introduces monad transformers and illustrates their usage in Scala. It defines the Reader and IO monads and shows how they can be composed using the ReaderT transformer. This allows defining computations that both read configuration values and perform side effects. The document recommends using type classes like MonadReader and MonadBase to define computations over monad stacks in a parametrically polymorphic way. It provides examples of defining and running such computations over a ReaderT[IO, ?] stack.
Watch video (in Hebrew): http://parleys.com/play/53f7a9cce4b06208c7b7ca1e
Type classes are a fundamental feature of Scala, which allows you to layer new functionality on top of existing types externally, i.e. without modifying or recompiling existing code. When combined with implicits, this is a truly remarkable tool that enables many of the advanced features offered by the Scala library ecosystem. In this talk we'll go back to basics: how type classes are defined and encoded, and cover several prominent use cases.
A talk given at the Underscore meetup on 19 August, 2014.
The document discusses different data structures for representing queues and linked lists, including their implementations and operations. Queues follow FIFO ordering and can be implemented using arrays or linked lists. Linked lists allow efficient insertion/removal at both ends and can be used to implement double-ended queues (deques). Deques support efficient insertion/removal from both ends and can implement stacks and queues. Sequences generalize vectors and linked lists, introducing the concept of positions to provide implementation independence.
Sukant Hajra gave a presentation on type classes in Scala. The presentation introduced type classes as an alternative to ad hoc polymorphism that provides stronger guarantees. It provided examples of using type classes for concepts like equality, size, and monoid. It explained how type classes are encoded in Scala using implicits and discussed best practices for organizing implicit instances. The presentation concluded after demonstrating some capabilities of the Scalaz library, which provides many type class instances.
Presented online for C++ on Sea (2020-07-17)
Video at https://www.youtube.com/watch?v=Bai1DTcCHVE
Lambdas. All the cool kid languages have them. But does lambda mean what C++ and other languages, from Java to Python, mean by lambda? Where did lambdas come from? What were they originally for? What is their relationship to data abstraction?
In this session we will into the history, the syntax, the uses and abuses of lambdas and the way in which lambda constructs in C++ and other languages do (or do not) match the original construct introduced in lambda calculus.
This document outlines the agenda and content for a Scala training workshop. The agenda includes an introduction, sections on types and pattern matching, lists, collections, lazy evaluation, exercises, and sharing. The types and pattern matching section covers functions as objects, subtyping and generics, pattern matching, and examples. It also discusses blocks, tail recursion, higher-order functions, currying, and data abstraction through class hierarchies and traits vs abstract classes. The document provides examples for many of these concepts. Exercises at the end include implementing Pascal's triangle through recursion.
The Ring programming language version 1.3 book - Part 82 of 88Mahmoud Samir Fayed
The Ring documentation describes the different data types that can be used to represent values in Ring programs. The main types are Number, String, and List. Number can represent numeric values like integers and doubles. String represents textual data like characters, dates, and times. List represents arrays and collections like dictionaries and trees that can contain multiple data types. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything while also allowing customization through new classes.
This document provides an overview and summary of Numerical Python (NumPy), an extension to the Python programming language that adds support for large, multi-dimensional arrays and matrices, along with a large library of high-level mathematical functions to operate on these arrays. It describes how to install NumPy, test the installation, and introduces some of the key features like array objects, universal functions (ufuncs), and convenience functions for array creation and manipulation.
The document provides an introduction and tutorial to Java 3D, a library for displaying three-dimensional graphics in Java. It covers installing Java 3D, creating a basic 3D program with a cube, adding lighting, positioning objects in 3D space using transformations, changing object appearances using materials and textures, and more. Examples of Java 3D code are provided throughout to demonstrate key concepts.
This document discusses various data types and conversions between them in Java. It defines variables of different primitive data types like boolean, byte, char, int etc and assigns values. It then demonstrates conversions between boolean and other data types by assigning the result of a ternary operator to the other variables. The values before and after conversions are printed to check the results. This allows understanding implicit and explicit type conversions between different data types in Java.
This document discusses type classes in Haskell and how they relate to object-oriented programming concepts. It makes three key points:
1. Type classes implement type-based dispatch rather than value-based dispatch, unlike object-oriented languages which do value-based dispatch.
2. Haskell classes are more analogous to interfaces in object-oriented languages, specifying which operations a type must support, rather than classes which provide an implementation.
3. Haskell uses parametric polymorphism and generics rather than subtyping, so functions work for any type instance of a class rather than subclasses of a type. This means functions must anticipate working with a variety of types from the start.
Scala for Java Developers provides an overview of Scala for Java developers. It discusses:
- The goals of understanding what Scala is, learning more about it, and installing Scala.
- An introduction to Scala including what it is, its history from 1995 to 2013, and whether it is a good fit for certain uses based on its strengths like functional programming and weaknesses like syntax.
- How to get started with Scala including required and optional software and plugins.
- Key Scala features like objects, classes, traits, pattern matching, and collections.
Special Edition with Dr. Robin Bloor
Live Webcast September 9, 2015
Watch the Archive: https://bloorgroup.webex.com/bloorgroup/onstage/g.php?MTID=e8b9ac35d8e4ffa3452562c1d4286a975
Do the math: algebra will transform information management. Just as the relational database revolutionized the information landscape, so will a just-released, complete algebra of data overhaul the industry itself. So says Dr. Robin Bloor in his new book, the Algebra of Data, which he’ll outline in this special one-hour webcast.
Once organizations learn how to express their data sets algebraically, the benefits will be significant and far-reaching. Data quality problems will slowly subside; queries will run orders of magnitude faster; integration challenges will fade; and countless tedious jobs in the data management space will bid their farewell. But first, software companies must evolve, and that will take time.
Visit InsideAnalysis.com for more information.
The document describes the merge sort algorithm. It begins by explaining the divide and conquer approach to algorithm design, which merge sort uses. It then provides pseudocode that divides the input array into two halves, recursively sorts each half using merge sort, and then merges the two sorted halves back together. The document includes examples walking through applying merge sort to an array. It analyzes the running time of merge sort using recurrence relations and the substitution method, determining its runtime is O(n log n). Finally, it provides Java code implementing merge sort.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an overview of the Introduction to Programming in MATLAB course. It outlines the course layout including 5 lectures covering various MATLAB topics. Problem sets are due daily and students must complete all lectures and problem sets to pass. Basic MATLAB skills such as scripts, variables, arrays, and basic plotting are introduced. The document also provides instructions for getting started with MATLAB and accessing resources.
This presentation at TEFCON2016 (Telefonica Developers Conference) shows how hackathons can be applied to software projects to exhibit Agility.
From Agile "methods" today to the root of what developing software should be about : programming.
Explaining what is software architecture from a different point of view and giving the fundamentals for understanding what software architecture is and how it should be created
A primer on AB testing and it's application in ecommerce. A necessary tool in every product manager's arsenal. Covers the principles behind setting up a good test and the statistical tools required to analyze results.
20 top AB testing mistakes and how to avoid themCraig Sullivan
This document discusses best practices for A/B testing. It provides guidance on several common mistakes made in A/B testing, including not testing for long enough, putting too much faith in confidence values, and self-stopping tests prematurely. The key recommendations are to test for at least two business cycles or purchase cycles, whichever is longer, continue testing until the predetermined end date regardless of early results, and make decisions based on error bar separation and sample sizes rather than confidence values. Testing best practices like collecting a large enough sample size and running whole cycle tests are emphasized to avoid false positives and draw reliable conclusions from A/B tests.
Widemile and Microsoft Multivariate Testing Case StudyWidemile
A joint presentation at DMDays09 New York, showcasing a case study between Widemile and Microsoft Office Live Small Business, which through Widemile's multivariate testing platform improved Microsoft's online conversions by 40%.
This document discusses A/B testing and provides advice for conducting A/B tests. It notes that A/B testing was originally used in pharmaceutical testing but is now commonly used by websites to test different versions of pages or features. The document emphasizes defining key performance indicators, testing hypotheses with proper sample sizes and durations, and not assuming causation from correlations in results. It cautions that A/B testing requires data analysis and should not kill creativity.
J.P. Bowman Ltd. is a tooling company that has established a global reputation for providing quality tooling since 1948. They specialize in designing, engineering, building, and proving mid to large stamping dies. Their facility utilizes the latest technologies and they have capabilities for machining, tryouts, and shipping tooling worldwide to meet deadlines.
10th Anniversary - The Butterfly Marketing ManuscriptJeremy Katz
http://bit.ly/BMMLR17 The Butterfly Marketing Manuscript is 10 years old. Here is a shot of the page in pdf form. However there is a banner up top commemorating this book. This document should be an in the Smithsonian due the historical significance. http://butterflymarketingmanuscriptlicensedreseller.funulz.com/
The document describes a dissertation defense for a doctoral thesis on the development of fast, stiff, and high-resolution piezoelectric motors with integrated bearing and driving functionality. The jury members and date are listed. The dissertation developed two motor concepts - a travelling wave motor that overcomes the limited stroke of piezoactuators through a travelling wave principle, and a combined drive motor that can operate in both a high-resolution slow stepping mode and a lower resolution high-speed ultrasonic mode. An experimentally verified motor model was developed to investigate the effect of resonance on motor performance and heat dissipation in piezoactuators.
Excavating 500,000 tonnes of seabed and replacing a 6,000-tonne section of oil pipeline in the busy Port of Singapore required careful planning to limit disruption. Shell consulted with local fish farm owners who were concerned dredging could harm their sea bass. Shell's project team implemented measures like installing filters on the fish farms' water intake pipes to address these concerns. Through open communication and environmental protection efforts, the pipeline replacement was completed successfully with no disruptions to neighbors or port operations.
This document summarizes the key findings of the 2014 Aflac WorkForces Report regarding benefits trends in California:
- Employers believe benefits are more influential on job satisfaction, loyalty, retention, and productivity than employees do, showing a disconnect between employer and employee perceptions.
- California companies offer major medical, dental, life, vision, and disability insurance at rates close to or exceeding national averages, but offer voluntary insurance at a lower rate.
- Many employees are not financially prepared for unexpected medical expenses and say medical costs have hindered their savings, with most unable to handle costs of a serious illness.
- While most employees prioritize maintaining health benefits and see a need for voluntary benefits, few
This document provides guidelines for conducting population-based surveys to measure national HIV prevalence. It outlines how to plan and implement a new national survey, incorporate HIV testing into existing surveys, and calculate a national HIV prevalence estimate by combining data from surveys and sentinel surveillance. Population-based surveys can provide more representative HIV prevalence data than sentinel surveillance alone. The guidelines aim to help countries obtain accurate national estimates by adjusting prevalence measures from different data sources and accounting for biases.
John Ayad has over 25 years of experience in ICT sales and consulting. He has a proven track record of developing long-term, profitable relationships with enterprise customers and identifying their needs to provide strategic solutions. Throughout his career, Ayad has focused on putting customers first and exceeding their expectations through his sales skills, product knowledge, and vision for how technology can help businesses achieve their goals. He is seeking a new opportunity to leverage his experience helping organizations strategically cement customer relationships.
Transports publics fribourgeois (TPF) SA operates a 940-kilometer public transportation network in Fribourg, Switzerland that transported almost 28 million passengers in 2012. To ensure reliable operations, TPF deployed two Oracle Database Appliances in clustered mode with Oracle Active Data Guard for high availability of applications like route planning and vehicle management. The engineered database infrastructure provides scalability, performance, and disaster recovery to support TPF's growing transportation needs in the region.
The document discusses real-time big data management and Apache Flink. It provides an overview of Apache Flink, including its architecture, components, and APIs for batch and streaming data processing. It also provides examples of word count programs in Java, Scala, and Java 8 that demonstrate how to write Flink programs for batch and streaming data.
Presented online for javaBin (2020-04-14)
Video at https://www.youtube.com/watch?v=orcSUE0Jjdc
Lambdas. All the cool kid languages have them. But does ‘lambda’ mean what Java, JavaScript, etc. mean by ‘lambda’? Where did lambdas come from? What were they originally for? What is their relationship to data abstraction?
In this session we will look into the history, the syntax and the uses of lambdas and the way in which lambda constructs in Java and other languages do (or do not) match the original construct introduced in lambda calculus.
- The document discusses various algorithms for computer graphics primitives like lines, circles, and flood fills.
- It introduces midpoint line drawing and the midpoint circle algorithm, which use implicit functions to determine the next pixel efficiently.
- Fractals are also covered, including algorithms for generating the Koch curve and fractal trees recursively with randomness.
- Finally, the Julia set and Mandelbrot set are described, which are generated by repeatedly applying complex functions to points.
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)PROIDEA
Kiedy ostatnio stworzyłeś nową strukturę pisząc aplikację w .NET? Wiesz do czego wykorzystywać struktury i jak mogą one zwiększyć wydajność Twojego programu? W prezentacji pokażę czym charakteryzują się struktury, jak dużo różni je od klas oraz opowiem o kilku ciekawych eksperymentach.
Dev Concepts: Object-Oriented ProgrammingSvetlin Nakov
What Is Object-Oriented Programming?
Watch the video lesson from Svetlin Nakov and learn more at:
https://softuni.org/dev-concepts/what-is-object-oriented-programming
Some key features of Scala include:
1. It allows blending of functional programming and object-oriented programming for more concise and powerful code.
2. The static type system allows for type safety while maintaining expressiveness through type inference, implicits, and other features.
3. Scala code interoperates seamlessly with existing Java code and libraries due to its compatibility with the JVM.
Java is an object-oriented programming language created by James Gosling at Sun Microsystems in 1995. It is platform independent, meaning programs written in Java can run on any system that supports Java without needing to be recompiled. The document provides an overview of Java, including its history and development, basic concepts like classes and objects, and how to write simple Java programs. It also discusses Java's advantages like being simple, object-oriented, portable, multithreaded, and secure.
The document provides documentation for an SVG generation library in Go. It describes functions for reading Flickr photo data, parsing it into structures, and drawing an image grid. Key functions include flickrAPI to call the Flickr API, makeURI to convert photo details to URLs, and imageGrid to read the response, create an SVG group, and add linked image elements in a grid layout.
This document provides an overview of defining classes in Python. It begins with objectives for defining classes and using encapsulation. It then reviews the concepts of objects and classes. The remainder of the document discusses designing a cannonball simulation program, first as an unmodularized program and then refactoring it into a modularized object-oriented program using a Projectile class. It also provides an example class definition for modeling multi-sided dice.
This document summarizes a slide presentation on string methods and debugging in Java. It provides examples of common string methods like charAt, compareTo, indexOf, replace, and substring. It also briefly explains how to debug programs using breakpoints and stepping through code line-by-line.
This document provides an overview of key object-oriented programming concepts including classes and objects, inheritance, encapsulation, polymorphism, interfaces, abstract classes, and design patterns. It discusses class construction and object instantiation. Inheritance is described as both exposing implementation details and potentially breaking encapsulation. Composition is presented as an alternative to inheritance. The document also covers method overriding, overloading, and duck typing as forms of polymorphism. Finally, it briefly introduces common design principles like SOLID and patterns like delegation.
This document introduces higher order functions (HOFs) in Scala. It provides examples of how HOFs such as map and filter can transform collections in more idiomatic and functional ways compared to imperative approaches using loops. Key benefits of HOFs include producing immutable and thread-safe results without needing to manually manage intermediate data structures. The document also briefly outlines some other powerful HOFs like reduce, partition, min, max and parallel collections.
This document provides an introduction to the Scala programming language. It discusses that Scala is a hybrid language that is both object-oriented and functional, runs on the JVM, and provides seamless interoperability with Java. It highlights features of Scala such as pattern matching, traits, case classes, immutable data structures, lazy evaluation, and actors for concurrency.
The document discusses models for software growth and extension. It proposes that software growth can be modeled as occurring in both a "decision space" of adding/removing features, and an "artifact space" of creating/deleting code artifacts. When growth is misaligned between these spaces, problems can occur. It explores representing concepts, behaviors, and composite behaviors in code using different approaches like classes, records of closures, and existential types to allow operating on mixed concept collections. The goal is to develop modular, extensible software models and architectures.
This document summarizes a lecture about quaternions and how to represent them in Haskell using algebraic data types and type classes. It introduces quaternions, defines a Quaternion data type, and shows how to use data constructors to create and pattern match quaternion values. It also discusses type classes like Eq and Show that allow quaternions to be compared and printed by making Quaternion an instance of these classes. Finally, it provides homework problems about working with points and angles in 2D space.
Principles of functional progrmming in scalaehsoon
a short outline on necessity of functional programming and principles of functional programming in Scala.
In the article some keyword are used but not explained (to keep the article short and simple), the interested reader can look them up in internet.
1. Hash tables are good for random access of elements but not sequential access. When records need to be accessed sequentially, hashing can be problematic because elements are stored in random locations instead of consecutively.
2. To find the successor of a node in a binary search tree, we take the right child. This operation has a runtime complexity of O(1).
3. When comparing operations like insertion, deletion, and searching between different data structures, arrays generally have the best performance for insertion and searching, while linked lists have better performance for deletion and allow for easy insertion/deletion anywhere. Binary search trees fall between these two.
I am trying to create a program That works with two other programs i.pdffortmdu
The document describes a problem the user is having with a C++ program that uses multiple files and a makefile. Specifically, the Shape.cpp file is not working correctly and is giving errors. The user needs someone to fix the Shape.cpp file and explain what changes were made.
Similar to The Object Oriented Paradigm in perspective (20)
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
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.
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
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.
Project Management: The Role of Project Dashboards.pdfKarya Keeper
Project management is a crucial aspect of any organization, ensuring that projects are completed efficiently and effectively. One of the key tools used in project management is the project dashboard, which provides a comprehensive view of project progress and performance. In this article, we will explore the role of project dashboards in project management, highlighting their key features and benefits.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Drona Infotech is a premier mobile app development company in Noida, providing cutting-edge solutions for businesses.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
E-commerce Development Services- Hornet DynamicsHornet Dynamics
For any business hoping to succeed in the digital age, having a strong online presence is crucial. We offer Ecommerce Development Services that are customized according to your business requirements and client preferences, enabling you to create a dynamic, safe, and user-friendly online store.
7. Most
of
our
OOP
soPware
is
“Platonic”
CLASS
Object1
Object2
Object3
Create
Object
INTERFACE
Run4me
World
Design&Coding
World
8. First
the
Code,
then
the
Objects
Interface
Shape
{
draw(Canvas
c);
move(int
x,
int
y);
}
class
Circle
implements
Shape
{
//
a:ributes
int
cx;
int
cy;
int
radius;
//
implementa>on
draw(Canvas
c)
{
c.drawEllipse(cx,cy,
r);
}
move(int
x,
int
y)
{
cx
=
cx+x;
cy
=cy+y
}
setC(int
x,
int
y)
{
cx=x;
cy=y;
}
setR(int
radious)
{
r=radious;
}
}
Main()
{
Circle
s1
=
new
Circle();
s1.setC(100,50)
s1.setR(20);
Canvas
c
=
new
DefaultCanvas();
c.addShape(s1);
//
registered
as
Shape
c.show();
}
a"rributes*
memory&
draw()*implementa3on*
opera3ons*table*
Design&
Coding
World
Run4me
World
9. The
Forms
Theory
from
Aristotle
Only
1
World
=
Sensi4ve
World
Concepts
or
Forms
=
Abstrac4ons
Horse
Form
Mammal
Form
Abstrac4on
(extract
the
general
from
the
par2cular)
(in
our
minds)
11. The
Forms
are
not
separated
from
the
Things
Horse
Form
Horse
Form
Horse
Form
12. Form
Theory
from
Aristotle
Substance
Form
Physical
Ma`er
Accidents
(Thing)
(Idea)
(thing
proper4es
varia4ons)
• Forms
can
have
different
levels
of
abstrac2ons
• Ma`er
can
disappear,
Forms
persist
13. OOP
and
Form
Theory
Substance
Form
Physical
Ma`er
Accidents
(Thing)
(Idea)
Object
Class
“Electronic”
Ma`er
(Object
in
the
Computer
Memory,
processed
by
the
CPU)
State
(Object
aKributes=status
varia4ons)
Interface
(thing
proper4es
varia4ons)
code
code
(Abstrac4on)
(Abstrac4on)
(Abstrac4on)
Sensible
World
Run4me
World
14. “Aristotelic”
view
of
OOP:
What
it
really
ma`ers
are
the
Objects
Interface Shape {
draw(Canvas c);
move(int x, int y);
}
class Circle implements Shape {
// a$ributes
int cx;
int cy;
int radius;
// implementa0on
draw(Canvas c) {
c.drawEllipse(cx,cy, r);
}
move(int x, int y) {
cx = cx+x;
cy =cy+y
}
setC(int x, int y) {
cx=x;
cy=y;
}
setR(int radious) {
r=radious;
}
}
draw()
move()
_Line_draw()
_Line_move()
X1=100
Y1=100
X2=100
Y2=200
draw()
move()
_Circle_draw()
_Circle_move()
Cx=80
Cy=90
R=50
show()
addShape()
removeShape()
_DefaultCanvas_show()
…
shapes=[s1]
c1:DefaultCanvas
onMousePressed()
onMouseMoved()
onMouseReleased()
_CircleTool_onMouseReleased()
…
canvas=c1
..
:CircleTool
draw()
move()
_Circle_draw()
_Circle_move()
Cx=80
Cy=90
R=50
draw()
move()
_Circle_draw()
_Circle_move()
Cx=80
Cy=90
R=50
onMouseReleased(MouseEvent mevent) {
//..get radious from mevent posi3on
r = ….
Circle circle = new Circle();
circle.setC(x,y);
circle.setR(r);
// registered as Shape
canvas.addShape(circle);
}
App=Run4me
World
Design
&
Coding
World
16. OOP
by
Alan
Kay
"OOP
to
me
means
only
messaging,
local
reten4on
and
protec4on
and
hiding
of
state-‐process,
and
extreme
late-‐binding
of
all
things.
It
can
be
done
in
Smalltalk
and
in
LISP.
There
are
possibly
other
systems
in
which
this
is
possible,
but
I'm
not
aware
of
them."
-‐
Dr.
Alan
Kay
17. Objects
in
OOP
are
“like”
Cells
I
thought
of
objects
being
like
biological
cells
and/or
individual
computers
on
a
network,
only
able
to
communicate
with
messages
(so
messaging
came
at
the
very
beginning
-‐-‐
it
took
a
while
to
see
how
to
do
messaging
in
a
programming
language
efficiently
enough
to
be
useful).
h`p://www.purl.org/stefan_ram/pub/doc_kay_oop_en
18. A
“primi2ve”
form
of
object
h`p://www.smalltalk.org/smalltalk/TheEarlyHistoryOfSmalltalk_Abstract.html
19. Dr.
Alan
Kay
OOP
realiza2on
:
Smalltalk
Smalltalk
is
a
founda2onal
programming
language
that
is
based
on
pervasive
message
passing,
pervasive
dynamic
and
strong
typing,
pervasive
reflec4on
and
pervasive
object
orienta4on.
h`p://www.smalltalk.org/ar2cles/ar2cle_20100320_a3_Gekng_The_Message.html
Smalltalk
is
one
of
the
first
object-‐oriented
programming
languages.
Its
design
was
influenced
by
Lisp,
Logo,
Sketchpad,
Flex
and
Simula.
Smalltalk
was
developed
as
a
research
project
at
Xerox
PARC
in
the
1970s
by
a
team
whose
members
included
Dr.
Alan
Kay,
Dan
Ingalls,
Adele
Goldberg,
Ted
Kaehler,
[Dianna
Merry-‐
Shipiro],
Sco`
Wallace
and
others.
21. An
Object
is
a
run4me
en4ty
that
processes
messages
using
dynamic
binding
Message
Dynamic
Binding
=
Late
Binding
Binding
mechanism
Message
Object
Message
processor
Implementa2on
Data
A`ributes=State
Opera2ons
Realiza2on
A`ributes
Interface
Opera2ons
Specifica2on
Class
Data
24. Dynamic
Binding
Message
Binding
mechanism
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
At
run-‐2me
1
2
3
25. Dynamic
Binding
=
Late
Binding
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
Not
Bound
1
26. Dynamic
Binding
=
Late
Binding
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
Message
Not
Bound
Linked
when
the
message
is
received
1
2
• Implementa2on
is
bound
in
the
last
moment
• (when
a
message
is
received)
27. The
same
object
can
change
its
implementa2on
between
messages
recep2on
Binding
mechanism
Object2
Message
processor
Implementa2on
Data
A`ributes=State
Data
Object1
1
28. The
same
object
can
change
its
implementa2on
between
messages
recep2on
Binding
mechanism
Object2
Message
processor
Implementa2on
Data
A`ributes=State
Data
Binding
mechanism
Object2
Message
processor
Implementa2on
Data
A`ributes=State
Data
Object1
Object1
1
2
29. An
object
can
interact
with
different
Implementa2ons
of
the
same
interface
Binding
mechanism
Object2
Message
processor
Implementa2on
Data
A`ributes=State
Binding
mechanism
Object3
Message
processor
Implementa2on
Data
A`ributes=State
Data
Data
Object1
• Same
“Interface”
and
different
implementa2on
• Implementa2on
can
vary
at
run2me
• Flexibility
=
easily
recombine
exis2ng
objects
into
new
configura2ons
• Extensibility
=
easily
add
new
behaviours
30. Polymorphism
and
Encapsula2on
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
INTERFACE
(specifica2on)
Mul2ple
muta2ons
of
the
same
“Thing”
Same
object
instance
with
varia2ons
in
its
implementa2on
Same
specifica2on
(interface)
with
different
instances
realiza2ons
IMPLEMENTATION1
(realiza2on)
Binding
mechanism
Message
processor
Implementa4on
Data
A`ributes=State
Data
IMPLEMENTATION2
(realiza2on)
Hidden
31. The
“P”
in
OOP
is
misleading
OOP
is
a
Computa4onal
Model
Not
a
Programming
Model
Can
be
implemented
in
different
programming
languages
32. An
object
is
like
a
“virtual”
server
OOP
should
be
equals
to
Object
Oriented
Processing
33. Most
of
the
“modern”
so
called
OO
languages
(C++,
Java,
…)
are
more
focused
on
the
Programming
part
than
the
Computa2onal
part
(the
run2me
objects)
Interface
Class
Inheritance
Messages
Object
Late
Binding
Design
&
Coding
Time
Run4me
Processing
Plato
Aristotle
34. How
SoPware
Objects
Would
be
like
in
our
physical
World?
(
just
for
adding
clarifica>on
)
35. How
SoPware
Objects
Would
be
like
in
our
physical
World?
The
Post-‐World
a
PostBox
Object
36. The
Post-‐World
aPostboxObject
Ann
aPostBoxObject
Teacher
Postbox
(abstract
or
representa>on
box)
slot
Interface
How
it
is
seen
by
other
postBoxObjects
(only
the
interface
is
seen,
not
the
implementa>on)
As
a
Teacher
implementa>on
Abstract
Form
slot
teachLesson
Dynamic
binding
40. A
C++,Java
like
“Typed”
Post-‐World
would
be
also
possible,
but
would
be
“less”
OO
(less
polymorphic)
and
more
complicated
to
deal
with
Teacher
answerQues2on
teachLesson
Teacher
aTapeRecorder
exposed/referenced
as
a
Teacher
TapeRecorderTeacher
teachLesson
answerQues2on
play
stop
forward
rewind
aTapeRecorder
exposed/referenced
as
TapeRecoderTeacher
teachLesson
answerQues2on
play
stop
forward
rewind
concrete
slots
are
hidden
Referenced
as
Teacher
Teacher
• Type=“slots
Interface”
is
hardcoded.
• Different
slots
are
presented
in
different
situa2ons
(type
cas2ng)
• To
be
“more”
OO
polymorphic,
objects
always
try
to
present
themselves
as
the
most
abstract
type
possib
41. Analysis
of
the
OOP
idea
and
how
we
have
implemented
it
during
the
past
40
years
42. Dynamic
Binding
is
present
in
many
places
• func2on
pointers
in
C
and
C++
• DLLs
and
Shared
Objects
• “CGI”
like
mechanism
in
HTTP
servers
• GUIs
For
origins
of
dynamic
binding:
“Fundamental
Concepts
in
Programming
Languages”.
CHRISTOPHER
STRACHEY
-‐
1967
43. Dynamic
Binding
is
present
in
many
places
a
basic
example
in
C
typedef int (*foo)(int i);!
int fooImp1(int i ) {!
return 2*i;!
}!
!
int fooImp2(int i ) {!
return i/2;!
}!
!
void doFoo(int i,foo afoo) {!
!
int r = afoo(i);!
!
printf (“result=%dn”,r);!
!!
}!
!
int main (int argc, char** argv){!
!
foo myfoo = &fooImp1;!
!
doFoo (4, myfoo); !
}!
//foo
is
polymorphic
2A10F
memory
…
…
_fooImp2(int i)
fooImp2()
implementa2on
…
afoo 1A001
1A001 _fooImp1(int i)
fooImp1()
implementa2on
i 4
//sets
the
concrete
“instance”
46. Anatomy
of
an
object
in
C,
C++,
Java…
draw()
move()
_Circle_draw()
_Circle_move()
cx=100
cy=50
r=0
s1:Shape
s1:Circle
Opera>ons
specifica>on
Opera>ons
realiza>on
a:ributes
draw()
move()
s1:Shape
How
it
is
seen
by
other
objects
s1
referenced
as
a
Shape
Dynamic
Binding
s1
is
a
Circle
class
instance
that
implements
the
Shape
interface
47. Anatomy
of
an
object
in
C,
C++,
Java…
draw()
move()
_Circle_draw()
_Circle_move()
…
cx=100
cy=50
r=20
s1:Shape
s1:Circle
Dynamic
binding
Interface
Implementa>on
data
Opera>ons
specifica>on
Opera>ons
realiza>on
a:ributes
Interface
Shape
{
draw(Canvas
c);
move(int
x,
int
y);
}
class
Circle
implements
Shape
{
//
a:ributes
int
cx;
int
cy;
int
radius;
//
implementa>on
draw(Canvas
c)
{
c.drawEllipse(cx,cy,
r);
}
move(int
x,
int
y)
{
cx
=
cx+x;
cy
=cy+y
}
setC(int
x,
int
y)
{
cx=x;
cy=y;
}
setR(int
radious)
{
r=radious;
}
}
s1
Instan>a>on
(new)
Main()
{
Circle
s1
=
new
Circle();
s1.setC(100,50)
s1.setR(20);
Canvas
c
=
new
DefaultCanvas();
c.addShape(s1);
//
registered
as
Shape
c.show();
}
Object
s1
shown
as
“Shape”
interface
while
its
implementa>on
is
class
“Circle”
Instan&a&on
Code
Defini&on
Code
48. A
basic
implementa2on
in
C
(not
C++)
a"rributes*
Shape*
memory&
draw()*implementa5on*
opera5ons*table*
typedef struct tShape Shape;!
typedef struct tCanvas Canvas;!
!
// SHAPE INTERFACE DECLARATION!
struct tShape {!
void (*draw) (Shape * this, Canvas * canvas);!
void (*move) (Shape * this , int x, int y);!
!!
};!
!
!
// CIRCLE CLASS DECLARATION!
!
typedef struct tCircle Circle;!
!
struct tCircle {!
void (*draw) (Circle * this, Canvas * canvas);!
void (*move) (Circle * this, int x, int y);!
!
double (*circunference) (Circle * this );!
!!
int cx;!
int cy;!
int r;!
!
};!
!
// CIRCLE CLASS OPERATIONS!
!
void _Circle_draw(Circle * this, Canvas* canvas) {!
// code for drawing a circle!
}!
!
double _Circle_circunference(Circle * this) {!
return 2*M_PI*this->r;!
}!
!
// code for allocating a Circle in memory!
!
Circle * newCircle (int cx, int cy, int r) {!
Circle * circle = malloc(sizeof(Circle));!
!
circle->cx = cx;!
circle->cy = cy;!
circle-> r= r;!
!
// filling function pointer members!
!
circle->draw = &_Circle_draw;!
circle->move = &_Circle_move;!
circle->circunference = &_Circle_circunference;!
!
return circle;!
!
}!
Shape**shape*
Circle**shape*
50. Fine…But….
Messages
are
synchronous
(like
“func2on
calls”)
Classes
are
defined
at
coding
2me,
can
not
be
changed
at
run2me.
Too
much
focus
on
coding
the
Hierarchies
(aaarg..)
No
Reflec2on
(yes
in
Java)
Late
binding
limited
to
message
processing
In
Java,
C++
like
languages
,
inheritance
is
a
coding
mechanism,
for
reusing
both
specifica2on
(interface)
and
realiza2on
(implementa2on)
52. Basic
Advise
for
java,c++
like
programmers
• Programing
to
an
interface
not
an
Implementa4on
• Composi4on
and
Delega4on
over
inheritance
53. Basic
Advise
for
java,c++
like
programmers
I
Interface!!Shape!{!
!!!!!!!draw(Canvas!c);!
!!!!!!!move(int!x,!int!y);!
}!
class!Circle!implements!Shape!{!
!!!!!//!a$ributes!
!!!!!!int!cx;!
!!!!!!int!cy;!
!!!!!!int!radius;!
!!!!!!!!!!!
!!!!!!//!implementa0on!
!!!!!!draw(Canvas!c)!{!
!!!!!!!!!!!!!c.drawEllipse(cx,cy,!r);!
!!!!!!}!
!!!!!!move(int!x,!int!y)!{!
!!!!!!!!!!!!!cx!=!cx+x;!
!!!!!!!!!!!!!cy!=cy+y!
!!!!!!}!
!!!!!!setC(int!x,!int!y)!{!
!!!!!!!!!!!!!!cx=x;!
!!!!!!!!!!!!!!cy=y;!
!!!!!!}!
!
!!!!!setR(int!radious)!{!
!!!!!!!!!!!!!!r=radious;!
!!!!}!
}!
draw()!
move()!
setC()!
setR()!
_Circle_draw()!
_Circle_move()!
_Circle_setC()!
_Circle_setR()!
cx=100!
cy=50!
r=20!
s1:Circle!
Shape!instanceShape()!{!
!!!!Circle!s1!=!new!Circle();!
!!!!s1.setC(100,50)!
!!!!s1.setR(20);!
!!!!return!s1;!
}!
draw()!
move()!
setC()!
setR()!
_Circle_draw()!
_Circle_move()!
_Circle_setC()!
_Circle_setR()!
cx=100!
cy=50!
r=20!
s1:Shape!
draw()!
move()!
s1:Shape!
draw()!
How!it!is!seen!by!other!objects!
s1!referenced!as!a!Shape!s1!referenced!as!a!Circle!
Instan0a0on!
Object!allocated!and!running!in!memory!Programmed!code!
Reference
an
Object
(class
Circle)
as
its
most
abstract
form
possible
(Shape)
54. Basic
Advise
for
java,c++
like
programmers
II
• new
operator
is
hardcode
– Instan2a2on
should
be
encapsulated
and
done
via
scrip2ng
or
declara2ve
like
mechanisms
(xml,
proper2es
file,
json…)
• Never
instan2ate
a
concrete
object
from
other
object
methods
– (inject
dependencies
via
abstract
refs)
class CircleDrawingTool extends DrawingTool {
DefaultCanvas canvas;
CircleDrawingTool(){
this.canvas = new DefaultCanvas();
}
….
}
class CircleDrawingTool extends DrawingTool {
Canvas canvas;
CircleDrawingTool(Canvas c){
this.canvas = c;
}
….
}
void instantiation (File configurationFile) {
Configuration cfg = parse(configurationFile);
Canvas canvas;
CircleDrawingTool ctool;
if (cfg.property(“canvas.type”)== DEFAULT_CANVAS) {
Canvas = new DefaultCanvas();
//… set canvas attributes
}
// canvas injected through constructor
ctool = new CircleDrawingTool(canvas)
…
}
Or
se:er
injec>on
56. Basic
Advise
for
java,c++
like
programmers
IV
• A
switch-‐case
by
type
(if
object
instanceof
)
it
is
a
symptom
of
bad
polymorphic
interface-‐class
design
void handle(Shape* shape) {
if (shape instanceof Circle) {
Circle c = (Circle) shape;
// handling a circle
}
else if (shape instanceof Line) {
Line l = (Line) shape;
// handling a line
}
else if …
}
void handle(Shape* shape) {
shape->doHandle();
}
Or
more
sophis2cated
pa`ern
(i.e
Visitor,
Chain
of
Reponsabili2es)
57. Basic
Advise
for
java,c++
like
programmers
V
Use
Design
PaKerns
– Help
you
to
have
polymorphic
designs
(Composite,
Builder,
Prototype,
Visitor,
Chain
of
Responsibili2es,
Decorator,
Observer….)
• Composi4on
and
Delega4on
over
inheritance:
– Favor
extending
the
behavior
of
an
object
by
delega2ng
its
message
processing
to
a
collabora2ng
object
that
are
part
of
it
(they
compose
it)
• Programing
to
an
interface
not
an
Implementa4on:
– Make
the
applica2on
work
through
a
set
of
objects
that
collaborate
between
them
through
interfaces
or
abstrac2ons
that
hide
the
concrete
implementa2ons
or
concrete
classes.
h`p://www.amazon.com/Design-‐Pa`erns-‐Elements-‐Reusable-‐Object-‐Oriented/dp/0201633612/ref=sr_1_1?s=books&ie=UTF8&qid=1383378933&sr=1-‐1&keywords=design+pa`erns
h`p://en.wikipedia.org/wiki/Design_Pa`erns
Gang
of
Four
Ward
Cunningham
58. Basic
Advise
for
java,c++
like
programmers
VI
Follow
SOLID
principles
in
your
Design
• Single
Responsibility
Principle
– A
class
should
have
one,
and
only
one,
reason
to
change
• Open
Closed
Principle
– You
should
be
able
to
extend
a
classes
behavior,
without
modifying
it.
Classes
should
be
open
for
extension,
but
closed
for
modifica2on.
• Liskov
Subs2tu2on
Principle
– Derived
classes
must
be
subs4tutable
for
their
base
classes
and
vice
versa
as
long
as
they
are
referenced
by
the
same
abstract
interface.
The
base
abstrac2ons
must
be
really
polymorphic.
• Interface
Segrega2on
Principle
– Make
fine
grained
interfaces
that
are
client
specific.
Many
client
specific
interfaces
are
be`er
than
one
general
purpose
interface
• Dependency
Inversion
Principle
– Depend
on
abstrac4ons,
not
on
concre4ons.
Never
have
references
or
directly
instan2ate
concrete
classes
from
the
class
that
collaborates
with
them,
just
have
a
references
to
abstrac2ons.
Let
other
part
of
the
program
do
the
concrete
instan2a2on
and
control
the
injec2on
of
the
dependency
object
referenced
as
an
abstrac2on.
h`p://butunclebob.com/Ar2cleS.UncleBob.PrinciplesOfOod
“Uncle
Bob”
Robert
Cecil
Mar2n
59. But
…
(c++,
java
like
languages)
• S2ll
separa2on
between
Coding&Design
Time
vs
Run2me
– Should
be
the
same
:
interac2ve
programming
• Once
classes
and
interfaces
are
“wired”
they
can
not
be
(easily)
altered
at
run2me
• “Cumbersome”
and
complex
mechanisms
for
separa2ng
instan2a2on
part
from
execu2on
part
– like
spring
framework,
xml
coding,
more
than
2100
classes!!
61. Smalltalk
and
its
dialects
A
dialect
of
Smalltalk
based
on
the
concept
of
Prototypes
Opensource
Smalltalk
…..Only
in
academic
environments
| myButton |!
!
myButton := Button new.!
myButton label: 'press me'.!
myButton action: [ myButton destroy ].!
myButton open.!
62. JavaScript
object
model
h`p://www.ecma-‐interna2onal.org/publica2ons/files/ECMA-‐ST/Ecma-‐262.pdf
prototype-‐based
language
objects
are
Associa2ve
Arrays
than
can
vary
at
run2me
63. Being
closer
to
OOP
Alan
Kay
• Objec2ve
C,
Java,
C#
provide
dynamic
mechanisms,
most
of
them
inherited
from
smalltalk
language
and
its
tools
– java.lang.reflect,
garbage
collector,
refactoring…
@implementation GSTimeSliderCell!
!
- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag!
{!
if (flag) {!
[[NSNotificationCenter defaultCenter] postNotificationName:GSMouseUpNotification object:self];!
}!
[super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag];!
}!
!
@end!
64. Being
closer
to
OOP
Alan
Kay
• Actors
model
– Proposed
by
by
Carl
HewiK
in
1973
– Actors
are
ac2ve
objects
which
communicate
by
message
passing
• Erlang,
Scala
65. Conclusions
• We
have
been
too
platonic
and
having
imperfect
realiza2ons
of
the
OOP
idea
• We
should
try
to
be
more
aristotlelic,
focusing
on
objects
as
message
processors
with
late
binding
• Be
aware
of
the
Compu2ng
Science
History
– Most
of
what
we
think
is
modern
was
invented
in
the
70s