(better presented by @drpicox)
Slides of an introductory course for web programming focusing in basic Javascript and CSS concepts. It assumes knowledge of programming, Java or C#.
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
How difficult is to automatically test the HelloWorld.
We fix it and other many difficult scenarios with techniques like:
- lower "s" singleton
- law of demeter
- dependency injection
- and more examples
This document discusses PyMongo, a Python driver for MongoDB. It provides an overview of common PyMongo operations like connecting to a database, inserting and querying documents, and using GridFS for storing and retrieving files. It also covers newer PyMongo features like commands, stored JavaScript, and awareness of datetime limits. The document encourages involvement in the PyMongo open source project.
ES3-2020-06 Test Driven Development (TDD)David Rodenas
Basics of TDD. Including why? Why it is discipline. Typical Pitfalls. Kinds of TDD, and a Recipe so anyone can do testing quickly. And lots of examples.
This document summarizes lessons learned from building MongoDB and MongoEngine. Some key lessons include: dive in and start contributing to open source projects to help them progress; metclasses are an important tool that allow ORM functionality to be added to classes; not all new ideas are good and it's important to avoid straying too far from existing patterns that users expect; tracking changes at a granular level allows partial updates but adds complexity. Overall it encourages contributors to learn why certain approaches were taken and focus on improving existing designs rather than introducing radical changes.
The document discusses testing techniques and principles for writing tests. It advocates for tests that are FAST, ISOLATING, REPEATABLE, SELF-VALIDATING, and TIMELY (FIRST). It also discusses the Arrange-Act-Assert (AAA) structure for tests and how to achieve high code coverage while maintaining test quality. The document notes that while code coverage is a useful metric, it does not guarantee correctness on its own. It also covers the use of test doubles like stubs, spies, mocks and fakes to replace dependencies.
A simple talk about appliyng patterns in Javascript.
It focuses in both jQuery and Angular.
It explains some basics MVC, cohesion and coupling.
It also have many examples of the patterns applied.
Full examples and documentation can be found here: http://david-rodenas.com/tutorial-jspatterns-v1/
The document discusses the Spock testing framework. It provides an overview of Spock, noting that it is a testing framework written in Groovy that embodies the behavior driven development (BDD) approach. Some key advantages of Spock are that it uses a more readable syntax compared to Java testing frameworks, has built-in support for stubs and mocks, and allows tests to be written in a given-when-then structure that resembles plain English.
TDD, BDD, ATDD are all methodologies that enable incremental design that is suitable for Agile environments. It seems that every day a new xDD methodology is born with the promise to be better than what came before. Should you use behaviour-driven tests or plain old unit tests? Which methodology is better? And how exactly would it benefit the development life cycle?
In this session, Dror will help to sort out the various methodologies – explaining where they came from, the tools they use, and discussing how and when to use each one. Here we will once and for all answer the question as to whether or not there’s one “DD” to rule them all.
Test-driven development (TDD) is a software development process that relies on the repetition of short development cycles called the TDD cycle. The TDD cycle involves first writing a test case that defines a desired improvement or new function, then producing code to pass that test and finally refactoring the new code to acceptable standards. The document discusses TDD training which includes topics like fixtures, assertion patterns, test quality and a case study. It motivates TDD by explaining how it helps build quality code, improves maintainability and meets client needs by focusing on internal and external quality. Key aspects of TDD like the AAA test format and strategies for selecting the next test are also covered. Finally, the document reviews evidence from case
Spock Testing Framework - The Next GenerationBTI360
You may be asking, "Do we really need another testing framework?" In this presentation Spencer says "Yes!" and will share some reasons why the Spock testing framework is gaining in popularity compared to other testing frameworks.
Unit testing patterns for concurrent codeDror Helper
Getting started with unit testing is not hard, the only problem is that most programs are more than a simple calculator with two parameters and a returns value that is easy to verify.
Writing unit tests for multi-threaded code is harder still.
Over the years I discovered useful patterns that helped me to test multi-threaded and asynchronous code and enabled the creation of deterministic, simple and robust unit tests.
Come learn how to test code that uses concurrency and parallelism – so that the excuses of not writing unit tests for such code would become as obsolete as a single core processors.
Software Testing - Invited Lecture at UNSW Sydneyjulien.ponge
This document provides an overview of software testing concepts and the JUnit testing framework. It discusses the importance of testing, different types of testing, unit testing with JUnit, best practices for writing tests, integrating tests into builds with Ant and Maven, and logging. Examples of JUnit tests are also provided. The key points covered are:
- Why testing is important to find bugs, prevent regressions, and allow for refactoring
- Unit testing, functional testing, and other types of testing
- How to write automated unit tests with JUnit
- Best practices like testing edge cases, achieving good code coverage
- Integrating tests into builds with Ant and Maven
- Using logging frameworks like Log
PVS-Studio analyzes source code and finds various errors and code quality issues across multiple languages and frameworks. The document highlights 20 examples of issues found, including uninitialized variables, unreachable code, incorrect operations, security flaws, and typos. PVS-Studio is able to find these issues using techniques such as data-flow analysis, method annotation analysis, symbolic execution, type inference, and pattern-based analysis to precisely evaluate the code and pinpoint potential bugs or code smells.
This document discusses best practices for writing unit tests. It emphasizes that unit tests should be easy to understand, trustworthy, and robust. A good unit test only fails if a bug is introduced or requirements change. The document provides examples of well-written unit tests and discusses how to avoid common problems like fragile tests. It stresses the importance of testing only specified functionality, using isolation frameworks to mock dependencies, and not putting test logic in the test. Overall, the document promotes writing "clean tests" to avoid brittle tests and minimize maintenance overhead.
How Data Flow analysis works in a static code analyzerAndrey Karpov
Data flow analysis is a technology for source code analysis, widely used in various development tools: compilers, linters, IDE. We'll talk about it exemplifying with design of a static analyzer. The talk covers classification and various kinds of data flow analysis, neighbouring technologies supporting each other, obstacles arising during development, surprises from C++ language when one tries to analyze the code. In this talk, some errors, detected in real projects using this technology, are shown in detail.
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
The document discusses new features in Java SE 7 including the Fork/Join framework for parallel programming, language evolutions through Project Coin such as try-with-resources statements, and diamond syntax for generic types which simplifies generic class instance creation. It also covers varargs syntax simplification and restrictions on using diamond syntax with anonymous inner classes.
The document discusses different ways to implement threading in Java programs. It provides code examples to demonstrate creating threads by extending the Thread class and implementing the Runnable interface. The code examples show printing output from both the main thread and child threads to illustrate threading concepts. Socket programming and RMI examples are also provided with code to implement client-server applications using threads.
This document discusses using Celery and RabbitMQ to implement asynchronous task queues. It provides an overview of Celery and RabbitMQ, how to set them up, configure tasks, schedule and retry tasks, and examples of using task queues for importing large files and sending complex emails. The key benefits highlighted are decoupling tasks from the main system, scalability, and ability to distribute tasks across multiple workers.
This document summarizes new features and enhancements in Java 7 including Project Coin, NIO.2, invokedynamic, Fork/Join framework, and concurrency utilities. It discusses how these features make threads, parallelism, and concurrency easier to work with in Java. Code examples are provided to illustrate the use of ForkJoinPool, Callable, and try-with-resources statements.
1. The document discusses good and bad practices for writing unit tests. It emphasizes that tests should verify the expected behavior, fail clearly when something goes wrong, and use mocks and isolation to focus on the code being tested.
2. Some examples of bad tests shown include tests that don't make assertions or assertions that don't provide useful information on failure. Real objects are also used instead of mocks, obscuring the test.
3. Good practices include using mocks to isolate the code being tested, making sure tests fail clearly when something goes wrong, and focusing tests on expected behavior through clear assertions. Automated testing, fixing broken tests, and mastering testing tools are also emphasized.
Here are some suggestions to improve the test method name:
- shouldReturnNullWhenQueryReturnsNull
- shouldPassNullFromDaoWhenQueryReturnsNull
Using "should" makes the intent clearer - we expect the method to return null under certain conditions. Describing those conditions ("when query returns null") in the name provides more context than a generic "testQuery".
Overall, test method names should clearly communicate what is being tested and under what conditions we expect the test to pass or fail. This helps readers understand the purpose and focus of each test.
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
This document provides an introduction to Test Driven Development (TDD) in Italian. It defines key TDD concepts like "test first" and automating tests. It then provides examples of using TDD to develop a parser for the "df" command output and features for an astrology horoscope application. The examples demonstrate the TDD process of writing a failing test, then code to pass the test, and refactoring. Rules for TDD like keeping tests passing and writing tests for all features are also outlined.
Использование GMock для обеспечения спокойной и сытой жизни разработчика. Обзор как верхушки так и некоторых подводных частей GMock. Разбор возможностей фреймворка на примерах.
Software companies and Corporate social responsibility (CSR) Jiří Napravnik
The manufacturers of toys, cars, food, etc. are responsible for their products. It is commonplace.
Software companies are not responsible for their products.
Programming is an exact discipline, where can be all procedures clearly defined, programmed and tested
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
We asked LinkedIn members worldwide about their levels of interest in the latest wave of technology: whether they’re using wearables, and whether they intend to buy self-driving cars and VR headsets as they become available. We asked them too about their attitudes to technology and to the growing role of Artificial Intelligence (AI) in the devices that they use. The answers were fascinating – and in many cases, surprising.
This SlideShare explores the full results of this study, including detailed market-by-market breakdowns of intention levels for each technology – and how attitudes change with age, location and seniority level. If you’re marketing a tech brand – or planning to use VR and wearables to reach a professional audience – then these are insights you won’t want to miss.
A simple talk about appliyng patterns in Javascript.
It focuses in both jQuery and Angular.
It explains some basics MVC, cohesion and coupling.
It also have many examples of the patterns applied.
Full examples and documentation can be found here: http://david-rodenas.com/tutorial-jspatterns-v1/
The document discusses the Spock testing framework. It provides an overview of Spock, noting that it is a testing framework written in Groovy that embodies the behavior driven development (BDD) approach. Some key advantages of Spock are that it uses a more readable syntax compared to Java testing frameworks, has built-in support for stubs and mocks, and allows tests to be written in a given-when-then structure that resembles plain English.
TDD, BDD, ATDD are all methodologies that enable incremental design that is suitable for Agile environments. It seems that every day a new xDD methodology is born with the promise to be better than what came before. Should you use behaviour-driven tests or plain old unit tests? Which methodology is better? And how exactly would it benefit the development life cycle?
In this session, Dror will help to sort out the various methodologies – explaining where they came from, the tools they use, and discussing how and when to use each one. Here we will once and for all answer the question as to whether or not there’s one “DD” to rule them all.
Test-driven development (TDD) is a software development process that relies on the repetition of short development cycles called the TDD cycle. The TDD cycle involves first writing a test case that defines a desired improvement or new function, then producing code to pass that test and finally refactoring the new code to acceptable standards. The document discusses TDD training which includes topics like fixtures, assertion patterns, test quality and a case study. It motivates TDD by explaining how it helps build quality code, improves maintainability and meets client needs by focusing on internal and external quality. Key aspects of TDD like the AAA test format and strategies for selecting the next test are also covered. Finally, the document reviews evidence from case
Spock Testing Framework - The Next GenerationBTI360
You may be asking, "Do we really need another testing framework?" In this presentation Spencer says "Yes!" and will share some reasons why the Spock testing framework is gaining in popularity compared to other testing frameworks.
Unit testing patterns for concurrent codeDror Helper
Getting started with unit testing is not hard, the only problem is that most programs are more than a simple calculator with two parameters and a returns value that is easy to verify.
Writing unit tests for multi-threaded code is harder still.
Over the years I discovered useful patterns that helped me to test multi-threaded and asynchronous code and enabled the creation of deterministic, simple and robust unit tests.
Come learn how to test code that uses concurrency and parallelism – so that the excuses of not writing unit tests for such code would become as obsolete as a single core processors.
Software Testing - Invited Lecture at UNSW Sydneyjulien.ponge
This document provides an overview of software testing concepts and the JUnit testing framework. It discusses the importance of testing, different types of testing, unit testing with JUnit, best practices for writing tests, integrating tests into builds with Ant and Maven, and logging. Examples of JUnit tests are also provided. The key points covered are:
- Why testing is important to find bugs, prevent regressions, and allow for refactoring
- Unit testing, functional testing, and other types of testing
- How to write automated unit tests with JUnit
- Best practices like testing edge cases, achieving good code coverage
- Integrating tests into builds with Ant and Maven
- Using logging frameworks like Log
PVS-Studio analyzes source code and finds various errors and code quality issues across multiple languages and frameworks. The document highlights 20 examples of issues found, including uninitialized variables, unreachable code, incorrect operations, security flaws, and typos. PVS-Studio is able to find these issues using techniques such as data-flow analysis, method annotation analysis, symbolic execution, type inference, and pattern-based analysis to precisely evaluate the code and pinpoint potential bugs or code smells.
This document discusses best practices for writing unit tests. It emphasizes that unit tests should be easy to understand, trustworthy, and robust. A good unit test only fails if a bug is introduced or requirements change. The document provides examples of well-written unit tests and discusses how to avoid common problems like fragile tests. It stresses the importance of testing only specified functionality, using isolation frameworks to mock dependencies, and not putting test logic in the test. Overall, the document promotes writing "clean tests" to avoid brittle tests and minimize maintenance overhead.
How Data Flow analysis works in a static code analyzerAndrey Karpov
Data flow analysis is a technology for source code analysis, widely used in various development tools: compilers, linters, IDE. We'll talk about it exemplifying with design of a static analyzer. The talk covers classification and various kinds of data flow analysis, neighbouring technologies supporting each other, obstacles arising during development, surprises from C++ language when one tries to analyze the code. In this talk, some errors, detected in real projects using this technology, are shown in detail.
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
The document discusses new features in Java SE 7 including the Fork/Join framework for parallel programming, language evolutions through Project Coin such as try-with-resources statements, and diamond syntax for generic types which simplifies generic class instance creation. It also covers varargs syntax simplification and restrictions on using diamond syntax with anonymous inner classes.
The document discusses different ways to implement threading in Java programs. It provides code examples to demonstrate creating threads by extending the Thread class and implementing the Runnable interface. The code examples show printing output from both the main thread and child threads to illustrate threading concepts. Socket programming and RMI examples are also provided with code to implement client-server applications using threads.
This document discusses using Celery and RabbitMQ to implement asynchronous task queues. It provides an overview of Celery and RabbitMQ, how to set them up, configure tasks, schedule and retry tasks, and examples of using task queues for importing large files and sending complex emails. The key benefits highlighted are decoupling tasks from the main system, scalability, and ability to distribute tasks across multiple workers.
This document summarizes new features and enhancements in Java 7 including Project Coin, NIO.2, invokedynamic, Fork/Join framework, and concurrency utilities. It discusses how these features make threads, parallelism, and concurrency easier to work with in Java. Code examples are provided to illustrate the use of ForkJoinPool, Callable, and try-with-resources statements.
1. The document discusses good and bad practices for writing unit tests. It emphasizes that tests should verify the expected behavior, fail clearly when something goes wrong, and use mocks and isolation to focus on the code being tested.
2. Some examples of bad tests shown include tests that don't make assertions or assertions that don't provide useful information on failure. Real objects are also used instead of mocks, obscuring the test.
3. Good practices include using mocks to isolate the code being tested, making sure tests fail clearly when something goes wrong, and focusing tests on expected behavior through clear assertions. Automated testing, fixing broken tests, and mastering testing tools are also emphasized.
Here are some suggestions to improve the test method name:
- shouldReturnNullWhenQueryReturnsNull
- shouldPassNullFromDaoWhenQueryReturnsNull
Using "should" makes the intent clearer - we expect the method to return null under certain conditions. Describing those conditions ("when query returns null") in the name provides more context than a generic "testQuery".
Overall, test method names should clearly communicate what is being tested and under what conditions we expect the test to pass or fail. This helps readers understand the purpose and focus of each test.
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
This document provides an introduction to Test Driven Development (TDD) in Italian. It defines key TDD concepts like "test first" and automating tests. It then provides examples of using TDD to develop a parser for the "df" command output and features for an astrology horoscope application. The examples demonstrate the TDD process of writing a failing test, then code to pass the test, and refactoring. Rules for TDD like keeping tests passing and writing tests for all features are also outlined.
Использование GMock для обеспечения спокойной и сытой жизни разработчика. Обзор как верхушки так и некоторых подводных частей GMock. Разбор возможностей фреймворка на примерах.
Software companies and Corporate social responsibility (CSR) Jiří Napravnik
The manufacturers of toys, cars, food, etc. are responsible for their products. It is commonplace.
Software companies are not responsible for their products.
Programming is an exact discipline, where can be all procedures clearly defined, programmed and tested
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
We asked LinkedIn members worldwide about their levels of interest in the latest wave of technology: whether they’re using wearables, and whether they intend to buy self-driving cars and VR headsets as they become available. We asked them too about their attitudes to technology and to the growing role of Artificial Intelligence (AI) in the devices that they use. The answers were fascinating – and in many cases, surprising.
This SlideShare explores the full results of this study, including detailed market-by-market breakdowns of intention levels for each technology – and how attitudes change with age, location and seniority level. If you’re marketing a tech brand – or planning to use VR and wearables to reach a professional audience – then these are insights you won’t want to miss.
Basic Tutorial of React for ProgrammersDavid Rodenas
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
This is the support of a course to teach mainly Redux, and Redux with React for Java and C# programmers. It is the third part of the course to recycle programmers from desktop app programming to web app programming. This course covers from history of Redux, its origin, step by step what is a reducer, and later concepts like reducer splitting, action handling, async and many more.
You also can use repositories:
- https://github.com/drpicox/learn-redux-bytesting
- https://github.com/drpicox/learn-redux-zoo-bytesting
To improve your skills.
This document provides an introduction to the Java programming language. It discusses key concepts such as the Java Virtual Machine (JVM), the Java Runtime Environment (JRE), and the Java Development Kit (JDK). It also introduces object-oriented programming concepts like classes, objects, interfaces, encapsulation, inheritance, and polymorphism. The document includes examples of a simple "Hello World" Java program and provides steps for writing, compiling, and running a Java file. It discusses some of the features of Java like being simple, object-oriented, interpreted, architecture neutral, portable, robust, distributed, secure, dynamic, concurrent, and having automatic memory management via garbage collection.
This document discusses interfaces and generics in C#. It covers defining and implementing interfaces, comparing interfaces and abstract classes, and commonly used .NET interfaces like ICloneable and IEnumerable. It also discusses generics, including creating generic classes and interfaces and applying constraints. Examples are provided of creating custom interfaces and classes, implementing interfaces, and using interfaces and generics in methods.
The document discusses phonetics, which is the study of human speech sounds. It describes the organs involved in speech production, including the larynx, vocal cords, soft palate, and tongue. It explains the classification of sounds based on their manner of articulation (such as plosives, nasals, and fricatives), place of articulation, voicing, and other phonetic features. Key terms like pulmonic egressive airflow and voiced/voiceless are defined in the context of phonetic analysis.
Introduction to Java Programming Languagejaimefrozr
The document provides an introduction and history of the Java programming language. It discusses that Java was originally developed in 1991 by Sun Microsystems to be portable for consumer electronic devices. The document then summarizes the key capabilities of Java including being a general purpose language that can develop robust applications for desktops, servers, and mobile devices. It also outlines the Java language specifications, application programming interface containing predefined classes, and development tools available. Finally, it explains how Java's use of byte code and the Java Virtual Machine allows it to be highly portable across different operating systems.
The document provides an overview of key Java concepts including classes, objects, methods, constructors, inheritance, polymorphism, abstraction, and encapsulation. It defines classes like Circle and Shape that demonstrate these concepts. Circles have fields like radius and methods like area() and circumference(). The Shape class is abstract with abstract area() and circumference() methods that concrete subclasses like Circle must implement. Access modifiers like public, private, and protected are used to control access to class members.
This document discusses the three domains of an ARO culture: personal accountability, mutual responsibility, and shared ownership. It defines each domain and how individuals should behave within them. Personal accountability refers to the areas an individual controls and will be evaluated on. Mutual responsibility involves areas impacted by one's work where input is shared. Shared ownership includes all aspects of the organization's mission and brand. The document provides guidance on when to engage in each domain and potential vulnerabilities like lack of clarity or competency creep. Overall it outlines an performance-focused culture based on transparency, collaboration, and clear roles.
Este documento ofrece consejos para periodistas sobre cómo informar de manera objetiva, independiente y ética. En resumen, recomienda: 1) informar sobre los hechos verdaderos y no sobre ficciones o deseos; 2) anteponer la verdad a otras consideraciones y evitar mentiras; 3) ser tan objetivo como un espejo plano al informar.
East Coast Transport-MACRO POINT CASE STUDYPaul Berman
East Coast Transport, a third-party logistics provider, implemented MacroPoint's freight tracking software to gain real-time visibility of load locations from start to finish. The software allows them to monitor every load with unprecedented precision and measure carrier performance. It has increased the carrier conversion rate to accept tracking from 50% to 80% over two years. MacroPoint saves East Coast Transport time by eliminating the need to continually call carriers and drivers for load updates.
Product Cost Analytics solution overviewSridhar Pai
The document discusses a product cost analytics solution from ConverBiz Technologies. It provides self-service reporting on product cost management data through pre-built dashboards. The solution allows assembly cost analysis, commodity analysis, supplier spend projection, and sourcing performance tracking. Sample dashboards show cost breakdowns, top cost drivers, and supplier spending charts. The solution is built on Oracle Product Lifecycle Analytics and integrates with Oracle Agile Product Cost Management.
Understanding ECMA Script 6 Javascript by Gaurav KhuranaGaurav Khurana
The document discusses the new features introduced in ECMAScript 6 (ES6), also known as JavaScript 6. Some key changes include the addition of block-scoped variables with let and const, new object literal syntax, arrow functions, classes, modules, iterators and generators, template literals, and new methods added to built-in objects like Array, String, and Number. The document provides examples and explanations of these new language features in ES6.
JavaScript is evolving. It’s an exciting time to be involved with this ubiquitous language of the web. Every year, we get exciting new features landing as part of the language. Let’s explore the freshly released features that were part of the 2019 ECMAScript specification. We’ll also briefly explore the process of how new features get proposed and added to the language, as well as the leading contenders expected to land in ES2020.
JavaScript and popular programming paradigms (OOP, AOP, FP, DSL). Overview of the language to see what tools we can leverage to reduce complexity of our projects.
This part goes over language features and looks at OOP and AOP with JavaScript.
The presentation was delivered at ClubAJAX on 2/2/2010.
Blog post: http://lazutkin.com/blog/2010/feb/5/exciting-js-1/
Continued in Part II: http://www.slideshare.net/elazutkin/exciting-javascript-part-ii
This document discusses JavaScript functions and objects. It explains that functions can return values, run code, and construct objects. It also discusses creating user-defined and built-in objects, accessing and adding properties, and inheritance through the prototype chain. Functions are first-class citizens that can be stored in variables, passed as arguments, and returned from other functions.
The document provides a history of the ECMAScript specification from 1995 to 2015. It outlines the major releases and additions to the language over time including ES3.1, ES5, ES6, and the ongoing development of future versions. Key changes include the introduction of classes, modules, arrow functions, promises, generators, and more robust collection types like Sets and Maps. The specification is developed by the TC39 committee group within Ecma International.
The document summarizes 10 new features in ECMAScript 2015 (ES6):
1. Default parameters allow defining function parameters that can be omitted when calling a function.
2. Rest parameters collect multiple function arguments into an array.
3. Spread syntax expands iterables like arrays into individual arguments.
4. Let and const introduce block scope and prevent redeclaration of variables.
5. Classes provide syntactic sugar over prototype-based inheritance.
6. Enhanced object literals allow omitting repeated name/value pairs and adding methods.
7. Template literals allow multiline strings and embedded expressions.
8. Object.assign copies enumerable own properties from one or more source objects to a target
The document discusses the future of JavaScript and the ECMAScript 4 (ES4) specification. Some key points:
- ES4 will introduce classes, inheritance, and other object-oriented features to JavaScript to make it suitable for large applications.
- A new virtual machine called Tamarin is being developed by Adobe and will power future versions of JavaScript across browsers.
- Features like classes, packages, generics and operator overloading are described. The specification aims to make JavaScript more powerful while keeping it usable for small programs.
- The reference implementations of new JavaScript classes and features will be written in JavaScript itself, allowing the language to be self-hosting.
Updated version of talk "Javascript the New Parts".
I gave this at JsDay on May 12th 2011.
I updated with latest stats and improved es5 coverage, most notably strict mode.
Abstract:
At last, ecmascript 5th edition is landing in all modern browsers. What are the new parts of the language and how can they help us to write better code?
Also
http://federico.galassi.net/
http://www.jsday.it/
Follow me on Twitter!
https://twitter.com/federicogalassi
This document provides an overview of ES6 features and how to set them up for use in Ruby on Rails applications. It describes key ES6 features such as let and const block scoping, template strings, destructuring assignment, default and rest parameters, loops and generators, enhanced object literals, Maps and Sets, arrow functions, modules, and classes. It then provides instructions for using the sprockets-es6 gem to transpile ES6 code to ES5 for use in Rails, as well as using Node.js and Gulp as an alternative approach.
The document discusses the history and evolution of JavaScript, including its origins from Java and LiveScript, standardization as ECMAScript, and key features such as dynamic typing, objects, functions, and prototypal inheritance. It also covers JavaScript data types like numbers, strings, Booleans, objects, and functions, and how the language handles values, scope, operators, and other elements.
This document discusses new features coming to JavaScript in ECMAScript 6, including:
1) Block scope keywords "let" and "const" that allow for block-level scoping of variables.
2) Shorthand syntax for object literals and method definitions.
3) Destructuring assignments for extracting values from objects and arrays.
4) Default parameter values, rest parameters, and spread syntax for working with functions and arrays.
5) New features like modules, classes, and imports for better organizing code.
This document provides a short introduction to ECMAScript and highlights some key features of ECMAScript 5 including: strict mode which detects bad programming practices; new native JSON object for parsing and stringifying JSON; new methods added to the Array and Object prototypes like indexOf, map and freeze; and property descriptors which allow defining getter/setter methods for object properties.
This document discusses ES6, the new version of JavaScript, and provides an overview of some of its key features including classes, iterators, lambdas, string interpolation, modules, and let block scoping. It encourages readers to begin using ES6 today by leveraging transpilation tools like Babel that allow ES6 code to run on current browsers and platforms. The best resource mentioned for learning ES6 is the Babel website, which contains tutorials, a live code editor, and helps developers get started with ES6.
Slides of my talk to present ES6 / ES2015 to the JsLuxembourg meetup in May 2015 : http://www.meetup.com/JSLuxembourg/events/219848586/
"JavaScript in 2016" by Eduard Tomàs
Some years ago in a far far away company, Brendan Eich created JavaScript. A lot of things happened since then. Times changed, the web grown, the language itself was updated, and we as a developers need to adapt too. Last year the last standard of the language arose: ECMAScript 2015 is here, and has some new and interesting features. In this talk we will show the most relevant ones, and also we will introduce some interesting patterns that you can use in JavaScript: you'll learn how to master the language and made JavaScript your best ally to conquest the world!
This document provides an introduction to JavaScript and the DOM. It begins with an overview of the author's background and experience. It then covers JavaScript fundamentals like data types, objects, functions, and events. It also discusses the DOM and how to access and manipulate elements using methods like getElementById, querySelector, and properties like childNodes. The document is intended as a basic JavaScript and DOM primer.
This document provides a summary of new features in JavaScript, including let/const block scoping, arrow functions, template strings, classes, generators, async/await, and more. It explains each feature in 1-3 sentences and includes code examples.
Entering in the full TDD, including:
- how TDD works and why it is required in Agile development
- why there are so many people that say that TDD does not work
- how to fix the problems in bad TDD to make it effective
- and the primary value of the sofware: make it adaptable
This document provides instructions for a test-driven development (TDD) coding assignment using JavaScript. It outlines how to set up the development environment, run tests, and iterate through solving tests one by one while committing changes. It also includes an introduction to JavaScript basics like types, functions, classes, and interfaces to provide context for completing the assignment. Students are instructed to work individually on solving commented tests in a GitHub classroom repository by running tests and committing after each solved test.
This document provides instructions for completing the bowling game kata exercise in both Java and JavaScript. It outlines the kata, links to the code repositories, and provides tips for setting up the development environment and executing tests in each language. The goal is to iteratively implement the kata by copying each commit exactly through test-driven development and repetition to learn how to solve problems and design solutions in the same way.
- Testing shows the presence, not the absence of bugs. Tests are driven by requirements and business rules, focusing only on relevant cases rather than testing everything.
- Tests improve quality and confidence by verifying that each scenario works as expected. Tests serve as live documentation of the system.
- While testing has been used for decades in different forms like debugging, demonstration, and evaluation, modern test-driven development and integrated testing frameworks from the 1990s helped establish testing as a mainstream practice.
Testing, Learning and Professionalism — 20171214David Rodenas
Two hours talk about testing, its history, its meaning and propose, a small guide of good practices, and what it is supposed to be a good professional and what is expected from us the professionals.
Have fast, performant, and successful web pages is a great Challenge. There are many layers involved and all of them have to work together.
In this talk I presented at FIBAlumni with collaboration of COEINF and the video recording is at http://media.fib.upc.edu/fibtv/streamingmedia/view/22/1400 (in Catalan).
It shows how all parts are involved in the success of web pages from the server up to the human brain and perception.
It introduces metrics and ways to effectively calculate and measure objectively the impact of the actions taken in the optimisation and also some ways to detect ways to optimise websites.
From high school to university and workDavid Rodenas
Presentation mostly in Catalan.
Aquesta presentació es va fer en el Institut Bernat el Ferrer de Molins de Rei.
El públic son els alumnes d'aquest institut i s'els mostra el camí que poden seguir després en la universitat i la responsabilitat que adquireixen després com a professionals.
La versió original conté els gifs animats, la majoria extrets de giphy.com.
By beginnings of 2016 there was very little information about how to work with Angular2 and almost no information about how to scale large applications.
There was no example of how to do modules, how to inject dependences inside services, how to use ES5 and so on.
In this presentation I explained how it worked and I have also provided an example in ES5 and Typescript how it can be done:
- https://github.com/drpicox/angular2-thedoctoris-ts
- https://github.com/drpicox/angular2-thedoctoris-es5
Talk given in the Mataro University (Technocampus) to grade students about what is a Freelance.
It explains about what implies to be a Freelance, concepts about Javascript, what are Meetups and user-groups, and basic notions about MVC.
Angular 1.X Community and API DecissionsDavid Rodenas
A talk presented to AngularCamp 2016 (both January and July editions) explaining how and encourage to participate and contribute inside AngularJS core.
It contains lots of examples and screenshots of github to make the process public, visible and friendly.
Previously I have presented MVC - Model: the great forgotten, in which I have explained what models were for.
It was very well received but because it was focused only in the model concept it leak of some important concepts about the whole MVC abstraction or how it make scale into a large AngularJS.
In the previous talk I gave some hints, but not all, and the audience asked for more.
This presentation explains the whole MVS, and adaptation of MVC leveraging in Angular capacities.
It should be presented in the Angular Camp of July 2016, but unfortunately their organizers forgot about it in the votations for talk and different set of talks were selected from the same author.
This talk has been given to some of my customers in private sessions.
MVC is a very popular model and many people claim that they follow it. But, despite of this, many people does not understand what are Models and which role are they playing.
This presentation was done in the Angular Camp of January'2015, explains with AngularJS step by step what happens when we develop Applications and how Models solve a large list of potential problems.
This presentation was very well received by the audience which had been very grateful and claimed to finally understand what models were for.
(automatic) Testing: from business to university and backDavid Rodenas
This talk cares about the fundamentals of testing, a little bit history of how the professional community developed what we currently know as testing, but also about why I should care about testing? why is it important to do a test? What is important to test? What is not important to test? How to do testing?
There some examples in plnker just to see each step, and many surprises.
This talk also compares what people learned in the Computer Sciences and Engineering degrees and what people does in testing. It gives some tips to catch up with current state of art and gives some points to start changing syllabus to make better engineers.
This talk is good for beginners, teachers, bosses, but also for seasoned techies that just want to light up some of the ideas that they might have been hatching.
Spoiler alert: testing will save you development time and make you a good professional.
There are lots of talks about testing: they talk about syntax, methodologies, tools. But there is usually a missing point: Why it is important to do a test? What is important to test? What is not important to test? How to do testing?
There lots of examples in plnker just to see each step, and many surprises.
This talk is good for beginners, but also for some seasoned people that just want to light up some of the ideas that they might have been hatching.
Spoiler alert: testing will save you development time.
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...Safe Software
The National Fuels Treatments Initiative (NFT) is transforming wildfire mitigation by creating a standardized map of nationwide fuels treatment locations across all land ownerships in the United States. While existing state and federal systems capture this data in diverse formats, NFT bridges these gaps, delivering the first truly integrated national view. This dataset will be used to measure the implementation of the National Cohesive Wildland Strategy and demonstrate the positive impact of collective investments in hazardous fuels reduction nationwide. In Phase 1, we developed an ETL pipeline template in FME Form, leveraging a schema-agnostic workflow with dynamic feature handling intended for fast roll-out and light maintenance. This was key as the initiative scaled from a few to over fifty contributors nationwide. By directly pulling from agency data stores, oftentimes ArcGIS Feature Services, NFT preserves existing structures, minimizing preparation needs. External mapping tables ensure consistent attribute and domain alignment, while robust change detection processes keep data current and actionable. Now in Phase 2, we’re migrating pipelines to FME Flow to take advantage of advanced scheduling, monitoring dashboards, and automated notifications to streamline operations. Join us to explore how this initiative exemplifies the power of technology, blending FME, ArcGIS Online, and AWS to solve a national business problem with a scalable, automated solution.
➡ 🌍📱👉COPY & PASTE LINK👉👉👉 ➤ ➤➤ https://drfiles.net/
Wondershare Filmora Crack is a user-friendly video editing software designed for both beginners and experienced users.
PyData - Graph Theory for Multi-Agent Integrationbarqawicloud
Graph theory is a well-known concept for algorithms and can be used to orchestrate the building of multi-model pipelines. By translating tasks and dependencies into a Directed Acyclic Graph, we can orchestrate diverse AI models, including NLP, vision, and recommendation capabilities. This tutorial provides a step-by-step approach to designing graph-based AI model pipelines, focusing on clinical use cases from the field.
If You Use Databricks, You Definitely Need FMESafe Software
DataBricks makes it easy to use Apache Spark. It provides a platform with the potential to analyze and process huge volumes of data. Sounds awesome. The sales brochure reads as if it is a can-do-all data integration platform. Does it replace our beloved FME platform or does it provide opportunities for FME to shine? Challenge accepted
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Your startup on AWS - How to architect and maintain a Lean and Mean account J...angelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
Your startup on AWS - How to architect and maintain a Lean and Mean accountangelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
Bridging the divide: A conversation on tariffs today in the book industry - T...BookNet Canada
A collaboration-focused conversation on the recently imposed US and Canadian tariffs where speakers shared insights into the current legislative landscape, ongoing advocacy efforts, and recommended next steps. This event was presented in partnership with the Book Industry Study Group.
Link to accompanying resource: https://bnctechforum.ca/sessions/bridging-the-divide-a-conversation-on-tariffs-today-in-the-book-industry/
Presented by BookNet Canada and the Book Industry Study Group on May 29, 2025 with support from the Department of Canadian Heritage.
Domino IQ – What to Expect, First Steps and Use Casespanagenda
Webinar Recording: https://www.panagenda.com/webinars/domino-iq-what-to-expect-first-steps-and-use-cases/
HCL Domino iQ Server – From Ideas Portal to implemented Feature. Discover what it is, what it isn’t, and explore the opportunities and challenges it presents.
Key Takeaways
- What are Large Language Models (LLMs) and how do they relate to Domino iQ
- Essential prerequisites for deploying Domino iQ Server
- Step-by-step instructions on setting up your Domino iQ Server
- Share and discuss thoughts and ideas to maximize the potential of Domino iQ
Down the Rabbit Hole – Solving 5 Training RoadblocksRustici Software
Feeling stuck in the Matrix of your training technologies? You’re not alone. Managing your training catalog, wrangling LMSs and delivering content across different tools and audiences can feel like dodging digital bullets. At some point, you hit a fork in the road: Keep patching things up as issues pop up… or follow the rabbit hole to the root of the problems.
Good news, we’ve already been down that rabbit hole. Peter Overton and Cameron Gray of Rustici Software are here to share what we found. In this webinar, we’ll break down 5 training roadblocks in delivery and management and show you how they’re easier to fix than you might think.
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfAlkin Tezuysal
As the demand for vector databases and Generative AI continues to rise, integrating vector storage and search capabilities into traditional databases has become increasingly important. This session introduces the *MyVector Plugin*, a project that brings native vector storage and similarity search to MySQL. Unlike PostgreSQL, which offers interfaces for adding new data types and index methods, MySQL lacks such extensibility. However, by utilizing MySQL's server component plugin and UDF, the *MyVector Plugin* successfully adds a fully functional vector search feature within the existing MySQL + InnoDB infrastructure, eliminating the need for a separate vector database. The session explains the technical aspects of integrating vector support into MySQL, the challenges posed by its architecture, and real-world use cases that showcase the advantages of combining vector search with MySQL's robust features. Attendees will leave with practical insights on how to add vector search capabilities to their MySQL systems.
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureSafe Software
When projects depend on fast, reliable spatial data, every minute counts.
AI Clearing needed a faster way to handle complex spatial data from drone surveys, CAD designs and 3D project models across construction sites. With FME Form, they built no-code workflows to clean, convert, integrate, and validate dozens of data formats – cutting analysis time from 5 hours to just 30 minutes.
Join us, our partner Globema, and customer AI Clearing to see how they:
-Automate processing of 2D, 3D, drone, spatial, and non-spatial data
-Analyze construction progress 10x faster and with fewer errors
-Handle diverse formats like DWG, KML, SHP, and PDF with ease
-Scale their workflows for international projects in solar, roads, and pipelines
If you work with complex data, join us to learn how to optimize your own processes and transform your results with FME.
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Impelsys Inc.
Web accessibility is a fundamental principle that strives to make the internet inclusive for all. According to the World Health Organization, over a billion people worldwide live with some form of disability. These individuals face significant challenges when navigating the digital landscape, making the quest for accessible web content more critical than ever.
Enter Artificial Intelligence (AI), a technological marvel with the potential to reshape the way we approach web accessibility. AI offers innovative solutions that can automate processes, enhance user experiences, and ultimately revolutionize web accessibility. In this blog post, we’ll explore how AI is making waves in the world of web accessibility.
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationChristine Shepherd
AI agents are reshaping logistics and supply chain operations by enabling automation, predictive insights, and real-time decision-making across key functions such as demand forecasting, inventory management, procurement, transportation, and warehouse operations. Powered by technologies like machine learning, NLP, computer vision, and robotic process automation, these agents deliver significant benefits including cost reduction, improved efficiency, greater visibility, and enhanced adaptability to market changes. While practical use cases show measurable gains in areas like dynamic routing and real-time inventory tracking, successful implementation requires careful integration with existing systems, quality data, and strategic scaling. Despite challenges such as data integration and change management, AI agents offer a strong competitive edge, with widespread industry adoption expected by 2025.
16. Number (immutable)
• IEEE-754: 1, 2, 5, 5000, -10, 3.14, 1e2, 1e-2, Infinity, NaN, …
• Methods: toFixed, toExponential, …
• Math: it has all methods and constants that Number should
have
• Cast to number:
• let number = Number(value);
• let number = parseInt(value, 10);
• let number = +value;
16
18. String (immutable)
• Any UCS-2 chain: 'hello', 'a', 'long word', …
• Character is length 1 string
• 'e' === 'hello'[1]
• Properties/Methods: length, slice, trim, concat, split, indexOf,
…
• Cast to string:
• let string = String(value);
• let string = value.toString();
• let string = '' + value;
18
19. String (immutable)
let single = 'single comma string';
let double = "double comma string";
let template = `template with ${'inter' + "polation"}`;
19
25. Array
• [1,2,3], [42,'sense',{of: 'life'}], [], …
• Properties: length, push/pop, shift/unshift, slice, map/reduce/
every/some, indexOf…
• Mixed content:
• Allow contents of different type for each element, including other
arrays
• Dynamic length:
• array = ['a','b','c']; array[4] = 'e';
• array[3] === undefined
• array.length = 3
25
26. Array mutators
26
// As stack
let array = ['b','c','d'];
array.push('e');
let e = array.pop();
array.unshift('a');
let a = array.shift();
// As queue
array.push('e');
let b = array.shift();
array.unshift('a');
let e = array.pop();
// Insert
let array = ['a','c','d'];
array.splice(1, 0, 'b');
// Remove
let array = ['a','x','b','c'];
array.splice(1, 1);
// Sort
let array = ['c','a','b'];
array.sort();
// Reverse
let array = ['c','b','a'];
array.reverse();
27. Array non-mutators
// As functional array
let copy = array.slice();
let numbers = ['a','b',1,2,3,'c'].slice(2,5);
let moreNumbers = [1,2,3].concat([4,5]);
let odds = numbers.filer(n => n % 2);
let doubles = numbers.map(n => n * 2);
let sum = numbers.reduce((s,n) => s + n);
let allPositives = numbers.every(n => n >= 0);
let thereIsATwo = numbers.some(n => n == 2);
let firstBig = numbers.find(n => n >= 3);
let bigIndex = numbers.findIndex(n => n >= 3);
let indexOfTwo = numbers.indexOf(2);
// Spread destructuring
let copy = [...numbers];
let concat = [...numbers, 4, 5, ...[6, 7, 8]];
let [one,...tail] = numbers;
27
30. Objects
• JSON constructor is the most common one
• let car = { color: 'blue' };
• Are string key/any value maps:
• Get property:
obj.propertyName
obj['propertyName']
• Set property:
obj.propertyName = newValue
obj['propertyName'] = newValue
30
31. Object
// Object is a Map:
// pairs string-value (properties)
let object1 = {
property: 'anyValue',
};
let object2 = new Object();
object.property = 'anyValue';
let object3 = new Object();
object['prop' + 'erty'] = 'anyValue';
31
32. Object
// By default, you can set any property
object.property = 'anyValue';
// And you can get any value
let value = object.property;
console.assert(value === 'anyValue');
// even if not defined
let notDefined = object.notDefined;
console.assert(notDefined === undefined);
32
33. Be Careful
let car = {
color: 'blue'
};
let carOwners = {};
carOwners[car] = 'elon';
JSON.stringify(carOwners); // hint: car is not string
33
34. Objects
// Spread & destructuring (in standardisation)
let main = {peter: 'tyrion', lena: 'cersei'};
let others = {sean: 'eddard', jason: 'khal'};
let copy = {...main};
let addFields = {...main, emilia: 'daenerys'};
let composed = {...main, ...others};
let {peter, lena} = main;
let {peter, ...rest} = main;
// Computed keys
let main = {['peter']: 'tyrion'};
// shorthand property names
let peter = 'tyrion';
let main = { peter };
34
36. Functions
• Are Objects
• Like arrays, numbers, strings, ...
• You can assign to a variable, object property, passed as an
argument, returned as result...
• Do not use new Function('n', 'n * 2')
36
37. Functions
// Short notation
const incr = a => a + 1;
const incr = (a) => a + 1;
const incr = a => { return a + 1; };
const incr = (a) => { return a + 1; };
const sum = (a, b) => a + b;
const sum = (a, b) => { return a + b };
37
38. Functions
// Short notation in object definition
const incrementer = {
incr(a) {
return a + 1;
},
};
incrementer.incr(3); // 4
// Long notation: function definition
function incr(a) {
return a + 1;
}
// Long notation: function expression
const incr = function(a) {
return a + 1;
}
38
39. Functions
// Function arguments can missmatch
incr(1) // === incr(1, ignoreOtherArguments)
incr() // === incr(undefined)
// Variable arguments
const sum = (first, ...rest) => first + sum(...rest);
sum(1, 2, 3) === sum(...[1, 2, 3])
// Arguments may have default values
const add = (a, b = 1) => a + b;
add(3) === 4
39
40. Functions
// May return any kind of object
const cast(tony, pepper) => ({ tony, pepper });
// No return or empty return is undefined
const makeUndefined() => { return; };
// Be careful: semicolon is optional (ops undefined)
const makeThree() => {
return
1 + 1 + 1;
};
40
41. Functions
// High order functions
const reduce = (array, fn, zero) => {
if (array.length === 0) { return zero; }
return fn(
array[0],
reduce(array.slice(1), fn, zero),
);
};
const add = (a, b) => a + b;
const sum = (array) => reduce(array, add, 0);
41
43. Class
• Are new in ES2015
• They can be transpiled to any browser that supports
Object.create and Object.defineProperties
• It uses a notation similar to object short hand
• There are no private fields (yet)
43
44. Class
// have one single constructor
class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
}
// new instances with new
const square = new Rectangle(5, 5);
// access to set/get like any object
square.width = square.width + 1;
square['height'] = square['height'] + 1;
44
45. Class
// have functions (no methods)
class Animal {
speak() {
return 'makes noise';
}
}
// has not method overloading
class Animal {
speak() {
return 'makes noise';
}
speak(predatorNear) { // avoid duplicates
return predatorNear ? 'is silent' : 'makes noise';
}
}
45
46. Class
// may have "methods"
class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
}
// new instances with new
const square = new Rectangle(5, 5);
// access to set/get like any object
square.width = square.width + 1;
square['height'] = square['height'] + 1;
46
47. Class (this)
// use «this» to access private members
class Pet {
constructor(name) {
this.name;
}
getName() {
return this.name;
}
salute() {
return `Hi ${this.getName()}`;
}
speak() {
return 'makes noise';
}
}
47
48. Class (this)
// there is no method
const boby = new Pet('boby');
// only functions
const speak = boby.speak;
speak();
const getName = boby.getName;
getName();
const lucas = {
name: 'lucas',
getName
};
lucas.getName();
48
METHOD
giphy.com
49. Class
// use extends for inheritance
class Animal {
speak() {
return 'makes noise';
}
}
// add behaviour
class Cat extends Animal {
purr() { … }
}
// or redefine behaviour
class Lion extends Cat {
speak() { return 'roars'; }
}
49
51. Closures
• Functions inside functions can access to variables and
arguments of outer functions.
• Variables and arguments keep their existence after the outer
function is finished.
51
54. Closures
// The equivalent in old Java
public IntSupplier makeCounter(int initial) {
final AtomicInteger counter =
new AtomicInteger(initial);
return new IntSupplier() {
public int getAsInt() {
return counter.getAndIncrement();
}
};
}
54
55. Closures
55
Function Call 4
Return @address
Stack
Function Call 3
Return @address
Function Call 2
Return @address
Function Call 1
Return @address
Current
Stack Frame
Grow
Local Variables
Local Variables
Local Variables
Local Variables
56. Closures
56
Function Call 4
Return @address
Stack
Function Call 3
Return @address
Function Call 2
Return @address
Function Call 1
Return @address
Local Variables
Local Variables
Local Variables
Local Variables
Scopes
Global
Scope
Parent Scope
new
new
new
new
57. Closures
// Use as callbacks
const startClock = () => {
let count = 0;
let intervalId = setInterval(() => {
console.log(count += 1);
}, 1000);
return () => {
clearInterval(intervalId);
};
};
let stopClock = startClock();
// …wait few seconds…
stopClock();
57
58. Closures
// Use to create modules
let myObj = (() => {
let privateState = …;
const privateFunction = () => { … }
return {
publicMethodA: function() {
…do something with privateState…
},
publicMethodB: function() {
…do something with privateFunction…
},
…
};
}());
58
60. Async/Await
• Javascript is asynchronous in its foundation.
• Traditionally it uses callbacks to handle asynchronicity: you
pass a function which is called when the operation is finished
with the resulting data as argument.
• ES2015 standarises: a kind of object for dependency inversion,
it allows you to call an operation before knowing which function
(or functions) handles the resulting data.
• ES2017 introduces async/await: promises were introduced in
the core, and functions can natively generate them and
consume them emulating a synchronized methods (but they
are not blocking and may be interleaved with other callbacks)
60
61. Async/Await
• There is only one thread
• no interferences
• no semaphores
• no deadlocks
• no quantum loss
• but also:
• no parallel processing
• no preemption (a callback may freeze the whole system)
61
80. Import/Export
• Allows to link with other files and get and publish symbols
• Symbols can be named or default
• Two path import possibilities:
• paths beginning with package-name import from package
• relative paths (a.k.a. './…') import from file in the current directory
• It has fallbacks:
• it automatically appends .js .jsx or .json if not specified
• if destination is a folder it reads index.js[x]
80
81. Import/Export
import rule from "./rule";
import * as math from "math-tools";
import { sqrt } from "math-tools";
import { sqrt as sq } from "math-tools";
import { min, max } from "math-tools";
import { min, max as big, … } from "math-tools";
import defaultMember, { sqrt } from "math-tools";
import defaultMember, * as math from "math-tools";
import "math-tools";
81
82. Import/Export
export { sqrt, min, max };
export { squareRoot as sqrt, min, max };
export let sqrt, min, max;
export let min = (a,b) => a < b ? a : b;
export const min = (a,b) => a < b ? a : b;
export default expression;
export default function (…) { … }
export default async function (…) { … }
export default async class (…) { … }
export default function sqrt(…) { … }
export { sqrt as default, … };
export * from './other-file';
export { name1, name2, …, nameN } from './other-file';
export { import1 as name1, name2, …, nameN } from …;
82
85. Object
• Java, C#, C++, … are class oriented
• Classes inherits from other Classes
• Javascript is instance oriented
• Objects (instances) inherits from other objects
85
car:
prototype is
mcQueen: raceCar:
prototype is
Car
instance of
mcQueen: RaceCar
inherits from
86. Object
• Javascript is “classless” but has inheritance
• Java, C# is class oriented
• Javascript is instance oriented
• Inheritance is performed through prototype
• Every object can become a prototype of other object
• Every object has another object as prototype
• The main prototype of almost all objects is Object.prototype
86
87. Object
// By default objects have a Object's prototype
let car1 = {
color: 'blue',
};
let car2 = Object.create(Object.prototype);
car.color = 'blue';
87
carX:
.color
Object.prototype:prototype is
89. Object
// But it can have no prototype
let prototypelessObject = Object.create(null);
// Object.getPrototypeOf(prototypelessObject) ?
// Object.getPrototypeOf(Object.prototype) ?
// Object.getPrototypeOf(Object) ?
89
prototypelessObject: nullprototype is
90. Object
// Objects can have any object as prototype
let car = {
color: 'blue',
};
let tesla = Object.create(car);
// car.color ?
// tesla.color ?
90
car:
.color
Object.prototype:tesla:
prototype is
has value fallback
prototype is
has value fallback
91. Object
// Objects inherits its prototype properties
let car = {
color: 'blue',
};
let tesla = Object.create(car);
tesla.brand = 'tesla';
// tesla.color ?
// tesla.brand ?
// Object.keys(tesla) ?
91
car:
.color
tesla:
.brand
92. Object
// Objects can overwrite prototype properties
let car = {
color: 'blue',
};
let ferrari = Object.create(car);
ferrari.color = 'red';
// car.color ?
// ferrari.color ?
92
car:
.color
ferrari:
.color
93. Be Careful
let car = {
color: 'red'
};
let parkingSpot = {
car: car,
};
let wolowitzParkingSpot = Object.create(parkingSpot);
wolowitzParkingSpot.car.color = 'gray';
// wolowitzParkingSpot.car.color ?
// car.color ?
93
car:
.color
parkingSpot:
.car
94. Object
class Object {
private Map<String,Object> properties;
private Object prototype;
public Object get(String key) {
if (properties.containsKey(key)) {
return properties.get(key);
} else if (prototype != null) {
return prototype.get(key);
} else {
return Undefined;
}
}
public void set(String key, Object value) {
properties.put(key, value);
}
}
94
95. Object
• In matter of speaking:
• Object.method.property are like Java/C# static members
ex: Object.create
• Object.prototype.property are like Java/C# instance members
ex: Object.prototype.isPrototypeOf
• Only properties, in matter of speaking:
• methods are properties whose value is a function
• members are properties whose value is not a function
• Object is a map, with an optional fallback map called prototype
95
96. Be Careful
let wordCount = {};
let word;
while (word = getSomeWord()) {
if (wordCount[word]) {
wordCount[word] ++;
} else {
wordCount[word] = 1;
}
}
// does it works? always?
96
106. Class
function Animal(name) {
this.name = name;
}
Animal.prototype.speak = function() {
console.log(this.name + ' makes a noise');
};
let fievel = new Animal('fievel');
106
Animal.prototype:
.speak
fievel:
.name
107. Class
function Animal(name) {
this.name = name;
}
Animal.prototype.speak = function() {
console.log(this.name + ' makes a noise');
};
let fievel = new Animal('fievel');
let tanya = new Animal('tanya');
107
Animal.prototype:
.speak
tanya:
.name
fievel:
.name
108. Class
function Animal(name) {
this.name = name;
}
Animal.prototype.speak = function() {
console.log(this.name + ' makes a noise');
};
let fievel1 = new Animal('fievel');
let fievel2 = Object.create(Animal.prototype);
Animal.call(fievel2, 'fievel');
108
109. Class
function Animal(name) { this.name = name; }
Animal.prototype.speak = function() { … };
function Lion(name) {
Animal.call(this, name + ' the lion');
}
Lion.prototype = Object.create(Animal.prototype);
Lion.prototype.constructor = Lion;
Lion.prototype.speak = function() {
console.log(this.name + ' roars!');
};
109
Animal.prototype:
.speak
.constructor
Lion.prototype:
.speak
.constructor
110. Class
class Animal {
constructor(name) {
this.name = name;
}
speak() {
console.log(this.name + ' makes a noise');
}
}
class Lion extends Animal {
constructor(name) {
super(name + ' the lion');
}
speak() {
console.log(this.name + ' roars');
}
}
110
111. Class
function Animal(name) {
this.name = name;
}
Animal.prototype.speak = function() {
console.log(this.name + ' makes a noise');
}
class Lion extends Animal {
constructor(name) {
super(name + ' the lion');
}
speak() {
console.log(this.name + ' roars');
}
}
111