The document provides an agenda for a two-day workshop on Clojure. Day one covers Clojure overviews and fundamentals including syntax, functions, flow control, and collections. Day two covers additional topics like testing, concurrency, polymorphism, performance, and tooling. The document also provides background on Clojure being a Lisp designed for functional programming and concurrency on the JVM.
The document discusses Google's Guava library and provides examples of how to use some of its main utilities and features. It summarizes Guava's basic utilities like Objects, Preconditions, Joiner and Splitter. It also covers Guava's collections, functions/predicates and MapMaker features and provides code examples for each.
Indexing and Query Optimizer (Aaron Staple)MongoSF
This document discusses MongoDB indexing and query optimization. It defines what indexes are, how they are stored and used to improve query performance. It provides examples of different types of queries and whether they can utilize indexes, including compound, geospatial and regular expression indexes. It also covers index creation, maintenance and limitations.
The Logical Burrito - pattern matching, term rewriting and unificationNorman Richards
The document summarizes key concepts related to unification, including pattern matching, term rewriting, and unification. It provides examples of these concepts in languages like ML, Mathematica, Prolog, and Clojure. Unification allows terms to be matched and variables substituted so that terms become identical. Pattern matching is used for conditional dispatch. Term rewriting uses rule-based substitutions to reduce terms. Prolog demonstrates how unification works for logic programming.
If you override the equals() method in a class, you must also override the hashCode() method to avoid violating the general contract for hashCode. The default hashCode() implementation returns an integer based on the object's identity, not its field values. So two equal objects according to the overridden equals() method could return different hash codes and fail when used with hash-based collections like HashMap. Overriding hashCode() to consider the same fields checked in equals() fixes this issue.
This document summarizes core.logic, a relational logic programming library for Clojure. It provides examples of core.logic concepts like unification, conde, fresh, membero, distincto, everyg, lvar, finite domains, and using core.logic to solve logic puzzles like map coloring, rock paper scissors, cryptarithmetic, and sudoku. Core.logic allows defining relations and facts to constrain logic variables and find all solutions that satisfy the goals.
Performance improvement strategies in Redux. Use memoized selectors to avoid redundant derivations in your mapStateToProps. Divide and flatten your reducers to prevent unnecessary re-renders of components.
Giving Clarity to LINQ Queries by Extending Expressions R2Ed Charbeneau
LINQ and Entity Framework are both commonly used in the .Net ecosystem, but even well-written applications can have LINQ queries that are difficult to understand. Because LINQ is so flexible, it can be written in ways that fail to communicate the developer’s intent. Well-written LINQ should be so clear as to be self-documenting. To write clear LINQ, it helps to understand the details of a few LINQ components that improve LINQ’s readability.
The document provides an agenda for a two-day workshop on Clojure. Day one covers Clojure overviews and fundamentals including syntax, functions, flow control, and collections. Day two covers additional topics like testing, concurrency, polymorphism, performance, and tooling. The document also provides background on Clojure being a Lisp designed for functional programming and concurrency on the JVM.
The document discusses Google's Guava library and provides examples of how to use some of its main utilities and features. It summarizes Guava's basic utilities like Objects, Preconditions, Joiner and Splitter. It also covers Guava's collections, functions/predicates and MapMaker features and provides code examples for each.
Indexing and Query Optimizer (Aaron Staple)MongoSF
This document discusses MongoDB indexing and query optimization. It defines what indexes are, how they are stored and used to improve query performance. It provides examples of different types of queries and whether they can utilize indexes, including compound, geospatial and regular expression indexes. It also covers index creation, maintenance and limitations.
The Logical Burrito - pattern matching, term rewriting and unificationNorman Richards
The document summarizes key concepts related to unification, including pattern matching, term rewriting, and unification. It provides examples of these concepts in languages like ML, Mathematica, Prolog, and Clojure. Unification allows terms to be matched and variables substituted so that terms become identical. Pattern matching is used for conditional dispatch. Term rewriting uses rule-based substitutions to reduce terms. Prolog demonstrates how unification works for logic programming.
If you override the equals() method in a class, you must also override the hashCode() method to avoid violating the general contract for hashCode. The default hashCode() implementation returns an integer based on the object's identity, not its field values. So two equal objects according to the overridden equals() method could return different hash codes and fail when used with hash-based collections like HashMap. Overriding hashCode() to consider the same fields checked in equals() fixes this issue.
This document summarizes core.logic, a relational logic programming library for Clojure. It provides examples of core.logic concepts like unification, conde, fresh, membero, distincto, everyg, lvar, finite domains, and using core.logic to solve logic puzzles like map coloring, rock paper scissors, cryptarithmetic, and sudoku. Core.logic allows defining relations and facts to constrain logic variables and find all solutions that satisfy the goals.
Performance improvement strategies in Redux. Use memoized selectors to avoid redundant derivations in your mapStateToProps. Divide and flatten your reducers to prevent unnecessary re-renders of components.
Giving Clarity to LINQ Queries by Extending Expressions R2Ed Charbeneau
LINQ and Entity Framework are both commonly used in the .Net ecosystem, but even well-written applications can have LINQ queries that are difficult to understand. Because LINQ is so flexible, it can be written in ways that fail to communicate the developer’s intent. Well-written LINQ should be so clear as to be self-documenting. To write clear LINQ, it helps to understand the details of a few LINQ components that improve LINQ’s readability.
This document discusses various iteration techniques in Java including for loops, iterators, and enhanced for loops. It provides examples of iterating over lists, sets, maps, and arrays. It also summarizes common object methods like toString(), equals(), hashCode(), and finalize(). The finalize() method is called by the garbage collector before an object is destroyed to allow for cleanup.
This document summarizes a presentation about machine learning. It begins with a definition of machine learning as giving computers the ability to learn without being explicitly programmed. It then provides examples of tasks that machine learning can perform, such as spam filtering and stock market prediction. The document notes that machine learning works to some degree but not perfectly. It introduces a company called Nuroko that is building a machine learning toolkit with certain desirable properties such as being general purpose, powerful, scalable, real-time, and pragmatic. The document explains why the company chose Clojure as its programming language and provides an overview of some key machine learning concepts and abstractions like vectors, coders, tasks, modules, and algorithms. It concludes
I'll found many papers and books talking about category theory, but many peoples still don't know how it can help. On this talk I'll help you better understand how math can help us develop a software more composable.
Coder on Beer - Concrete
2018 - São Paulo
Lecture06 methods for-making_data_structures_v2Hariz Mustafa
The document discusses methods for implementing dynamic data structures using arrays and linked lists. It describes how insertion and removal of elements from an array requires shifting all subsequent elements, which is inefficient. Linked lists allow efficient insertion and removal by using pointer connections between nodes. The document provides an example of traversing a linked list to search for a node matching given criteria.
This document provides an overview of using Clojure for data science. It discusses why Clojure is suitable for data science due to its functional programming capabilities, performance on the JVM, and rich library ecosystem. It introduces core.matrix, a Clojure library that provides multi-dimensional array programming functionality through Clojure protocols. The document covers core.matrix concepts like array creation and manipulation, element-wise operations, broadcasting, and optional support for mutability. It also discusses core.matrix implementation details like the performance benefits of using Clojure protocols.
This document provides information on regular expressions and file input/output in Python. It includes:
- Descriptions of regular expression functions like re.match(), re.search(), and re.sub() and examples of using them to search strings.
- Details on opening, reading, and writing to files in Python using the open() function and methods like read(), write(), close().
- Examples of reading and writing CSV files, renaming and deleting files using os module functions, and getting file metadata.
Monads, also known as Kleisli triples in Category Theory, are an (endo-)functor together with two natural transformations, which are surprisingly useful in pure languages like Haskell, but this talk will NOT reference monads. Ever. (Well, at least not in this talk.)
Instead what I intend to impress upon an audience of newcomers to Haskell is the wide array of freely available libraries most of which are liberally licensed open source software, intuitive package management, practical build tools, reasonable documentation (when you know how to read it and where to find it), interactive shell (or REPL), mature compiler, stable runtime, testing tools that will blow your mind away, and a small but collaborative and knowledgeable community of developers. Oh, and some special features of Haskell - the language - too!
The document discusses how abstraction is central to programming and how Clojure is a good language for creating abstractions, noting that Clojure provides primitive expressions, means of combination through functions, and means of abstraction through functions, records, multimethods and protocols to build complex programs from simple ideas.
Building a website in Haskell coming from Node.jsNicolas Hery
This document summarizes Nicolas Hery's experience building a website in Haskell after coming from a Node.js background. It discusses choosing a web framework in Haskell, using types to document data, handling optional values, refactoring code, and deploying to Docker and Heroku. It also notes both benefits of Haskell like compiler-checked refactoring but also challenges like syntax and documentation.
Google interviewer asked for an algorithm to extract the k smallest elements from a set of ordered arrays. I suggested a vectorised bucket sort and merge sort approach. I took the problem offline and produced this analysis and C++.
The document discusses Python modules and packages. Key points include:
- Modules allow organizing code into reusable files and namespaces. Common file extensions are .py.
- Packages are directories that contain modules and an __init__.py file to identify them as packages. They provide a hierarchy for importing modules.
- There are different ways to import modules, such as import, from, import *. This controls what names are imported into the current namespace.
This document contains code for a VB.Net application for a hospital patient admission system. It includes code for login authentication, user management, registration, payment, and treatment functions. The code handles tasks like connecting to a database, generating unique identifiers, performing queries, and updating/inserting records.
This document provides an introduction and overview of Matlab. It discusses (1) vectors, matrices and arithmetic operations in Matlab, (2) plotting capabilities, and (3) flow control structures like if/else statements and for loops. Some key aspects covered include how to define vectors and matrices, perform element-wise and standard matrix operations, create plots of data, and write programs with basic programming constructs. The document also provides examples of plotting commands and symbolic math operations in Matlab.
Lecture07 the linked-list_as_a_data_structure_v3Hariz Mustafa
This document describes the implementation of a linked list data structure in C++. It defines a Node struct to hold each element and a LinkedList class to manage the list. The LinkedList class implements common list operations like insert, retrieve, find, replace through methods that traverse the linked nodes. A current pointer tracks the active node during operations like getNext to iterate through the list sequentially. The implementation allows storing and accessing elements by value or key in a flexible linked list.
This document contains notes on JavaScript functions from a course. It discusses:
1) Functions allow breaking programs into modules for easier maintenance and debugging. Functions in JavaScript include predefined and programmer-defined methods.
2) Functions receive arguments, can call other functions in a hierarchical relationship, and may return values. Functions define local variables that do not exist outside the function.
3) Examples show defining and calling functions to square numbers, find the maximum of three values, and generate random numbers by scaling and shifting the output of Math.random().
MongoDB and Indexes - MUG Denver - 20160329Douglas Duncan
Indexes are data structures that store a subset of data to allow for efficient retrieval. MongoDB stores indexes using a b-tree format. There are several types of indexes including simple, compound, multikey, full-text, and geospatial indexes. Indexes improve performance by enabling efficient retrieval, sorting, and filtering of documents. Indexes are created using the createIndex command and their usage can be checked using explain plans.
The document provides an overview of strings in .NET, including string operations, empty strings vs String.Empty, null/empty checks, the string pool, string properties, and StringBuilder. It discusses performance differences between various string concatenation and empty string initialization methods. The document also includes code examples and benchmarks to demonstrate string pooling, null/empty checks, and the performance advantages of StringBuilder over string concatenation for multiple modifications. It concludes with references to additional resources on strings in .NET.
As your data grows, the need to establish proper indexes becomes critical to performance. MongoDB supports a wide range of indexing options to enable fast querying of your data, but what are the right strategies for your application?
In this talk we’ll cover how indexing works, the various indexing options, and use cases where each can be useful. We'll dive into common pitfalls using real-world examples to ensure that you're ready for scale.
String Function
1. charAt():
This method returns the character from the specified index.Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character in a string called stringName is stringName.length - 1.
Syntax:
string.charAt(index);
Return Value:
Returns the character from the specified index.
Example:
<html>
<head>
<title>JavaScript String charAt() Method</title>
</head>
<body>
</body>
</html>
Output:
str.charAt(0) is:T
2. concat():
Description:
This method adds two or more strings and returns a new single string.
Syntax:
string.concat(string2, string3[, ..., stringN]);
parameters:
string2...stringN : These are the strings to be concatenated.
Return Value:
Returns a single concatenated string.
Example:
<html>
<head>
<title>JavaScript String concat() Method</title>
</head>
<body>
</body>
</html>
Output:
Concatenated String :This is string oneThis is string two.
3. indexOf():
Description:
This method returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.indexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScript String indexOf() Method</title>
</head>
<body>
<br />");
var index = str1.indexOf( "one" );
document.write("indexOf found String :" + index );
</body></html>
Oputput:
indexOf found String :8
indexOf found String :15
4. lastIndexOf():
Description:
This method returns the index within the calling String object of the last occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.lastIndexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the last found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScri
This document discusses JavaScript objects and methods for manipulating strings and performing mathematical calculations. It introduces the Math object which allows common mathematical operations and contains constants like PI. It also covers the String object which allows manipulating and processing strings, including character-level methods, searching/extracting substrings, and generating XHTML tags. Methods like split(), indexOf(), toLowerCase() are described.
This document summarizes advanced JavaScript concepts including:
- Object-oriented inheritance patterns in JavaScript and trends toward avoiding new and emulating private members. Pseudo-classical inheritance is recommended for better performance.
- Exploiting JavaScript's support for functional programming with higher-order functions to allow functions as arguments and return values for more flexible programming.
- Common issues with asynchronous code in JavaScript and how promises can help address callbacks and synchronization.
- Common pitfalls to avoid with arrays, numbers, and typeof in JavaScript.
2013-06-15 - Software Craftsmanship mit JavaScriptJohannes Hoppe
Entwickeln Sie Clean Code mit JavaScript. Den “Software Craftsman” zeichnen dabei Wissen, Werkzeuge und Wiederholung aus. Diese drei Grundfeste werden speziell für JavaScript beleuchtet. Lernen Sie die wichtigsten Patterns für eine stabile und wartbare Website kennen. Überprüfen Sie Ihre persönliche Werkzeugkiste für Entwicklung, Testing und Deployment. Schließen Sie Bekanntschaft mit Code Katas für JavaScript.
This document discusses various iteration techniques in Java including for loops, iterators, and enhanced for loops. It provides examples of iterating over lists, sets, maps, and arrays. It also summarizes common object methods like toString(), equals(), hashCode(), and finalize(). The finalize() method is called by the garbage collector before an object is destroyed to allow for cleanup.
This document summarizes a presentation about machine learning. It begins with a definition of machine learning as giving computers the ability to learn without being explicitly programmed. It then provides examples of tasks that machine learning can perform, such as spam filtering and stock market prediction. The document notes that machine learning works to some degree but not perfectly. It introduces a company called Nuroko that is building a machine learning toolkit with certain desirable properties such as being general purpose, powerful, scalable, real-time, and pragmatic. The document explains why the company chose Clojure as its programming language and provides an overview of some key machine learning concepts and abstractions like vectors, coders, tasks, modules, and algorithms. It concludes
I'll found many papers and books talking about category theory, but many peoples still don't know how it can help. On this talk I'll help you better understand how math can help us develop a software more composable.
Coder on Beer - Concrete
2018 - São Paulo
Lecture06 methods for-making_data_structures_v2Hariz Mustafa
The document discusses methods for implementing dynamic data structures using arrays and linked lists. It describes how insertion and removal of elements from an array requires shifting all subsequent elements, which is inefficient. Linked lists allow efficient insertion and removal by using pointer connections between nodes. The document provides an example of traversing a linked list to search for a node matching given criteria.
This document provides an overview of using Clojure for data science. It discusses why Clojure is suitable for data science due to its functional programming capabilities, performance on the JVM, and rich library ecosystem. It introduces core.matrix, a Clojure library that provides multi-dimensional array programming functionality through Clojure protocols. The document covers core.matrix concepts like array creation and manipulation, element-wise operations, broadcasting, and optional support for mutability. It also discusses core.matrix implementation details like the performance benefits of using Clojure protocols.
This document provides information on regular expressions and file input/output in Python. It includes:
- Descriptions of regular expression functions like re.match(), re.search(), and re.sub() and examples of using them to search strings.
- Details on opening, reading, and writing to files in Python using the open() function and methods like read(), write(), close().
- Examples of reading and writing CSV files, renaming and deleting files using os module functions, and getting file metadata.
Monads, also known as Kleisli triples in Category Theory, are an (endo-)functor together with two natural transformations, which are surprisingly useful in pure languages like Haskell, but this talk will NOT reference monads. Ever. (Well, at least not in this talk.)
Instead what I intend to impress upon an audience of newcomers to Haskell is the wide array of freely available libraries most of which are liberally licensed open source software, intuitive package management, practical build tools, reasonable documentation (when you know how to read it and where to find it), interactive shell (or REPL), mature compiler, stable runtime, testing tools that will blow your mind away, and a small but collaborative and knowledgeable community of developers. Oh, and some special features of Haskell - the language - too!
The document discusses how abstraction is central to programming and how Clojure is a good language for creating abstractions, noting that Clojure provides primitive expressions, means of combination through functions, and means of abstraction through functions, records, multimethods and protocols to build complex programs from simple ideas.
Building a website in Haskell coming from Node.jsNicolas Hery
This document summarizes Nicolas Hery's experience building a website in Haskell after coming from a Node.js background. It discusses choosing a web framework in Haskell, using types to document data, handling optional values, refactoring code, and deploying to Docker and Heroku. It also notes both benefits of Haskell like compiler-checked refactoring but also challenges like syntax and documentation.
Google interviewer asked for an algorithm to extract the k smallest elements from a set of ordered arrays. I suggested a vectorised bucket sort and merge sort approach. I took the problem offline and produced this analysis and C++.
The document discusses Python modules and packages. Key points include:
- Modules allow organizing code into reusable files and namespaces. Common file extensions are .py.
- Packages are directories that contain modules and an __init__.py file to identify them as packages. They provide a hierarchy for importing modules.
- There are different ways to import modules, such as import, from, import *. This controls what names are imported into the current namespace.
This document contains code for a VB.Net application for a hospital patient admission system. It includes code for login authentication, user management, registration, payment, and treatment functions. The code handles tasks like connecting to a database, generating unique identifiers, performing queries, and updating/inserting records.
This document provides an introduction and overview of Matlab. It discusses (1) vectors, matrices and arithmetic operations in Matlab, (2) plotting capabilities, and (3) flow control structures like if/else statements and for loops. Some key aspects covered include how to define vectors and matrices, perform element-wise and standard matrix operations, create plots of data, and write programs with basic programming constructs. The document also provides examples of plotting commands and symbolic math operations in Matlab.
Lecture07 the linked-list_as_a_data_structure_v3Hariz Mustafa
This document describes the implementation of a linked list data structure in C++. It defines a Node struct to hold each element and a LinkedList class to manage the list. The LinkedList class implements common list operations like insert, retrieve, find, replace through methods that traverse the linked nodes. A current pointer tracks the active node during operations like getNext to iterate through the list sequentially. The implementation allows storing and accessing elements by value or key in a flexible linked list.
This document contains notes on JavaScript functions from a course. It discusses:
1) Functions allow breaking programs into modules for easier maintenance and debugging. Functions in JavaScript include predefined and programmer-defined methods.
2) Functions receive arguments, can call other functions in a hierarchical relationship, and may return values. Functions define local variables that do not exist outside the function.
3) Examples show defining and calling functions to square numbers, find the maximum of three values, and generate random numbers by scaling and shifting the output of Math.random().
MongoDB and Indexes - MUG Denver - 20160329Douglas Duncan
Indexes are data structures that store a subset of data to allow for efficient retrieval. MongoDB stores indexes using a b-tree format. There are several types of indexes including simple, compound, multikey, full-text, and geospatial indexes. Indexes improve performance by enabling efficient retrieval, sorting, and filtering of documents. Indexes are created using the createIndex command and their usage can be checked using explain plans.
The document provides an overview of strings in .NET, including string operations, empty strings vs String.Empty, null/empty checks, the string pool, string properties, and StringBuilder. It discusses performance differences between various string concatenation and empty string initialization methods. The document also includes code examples and benchmarks to demonstrate string pooling, null/empty checks, and the performance advantages of StringBuilder over string concatenation for multiple modifications. It concludes with references to additional resources on strings in .NET.
As your data grows, the need to establish proper indexes becomes critical to performance. MongoDB supports a wide range of indexing options to enable fast querying of your data, but what are the right strategies for your application?
In this talk we’ll cover how indexing works, the various indexing options, and use cases where each can be useful. We'll dive into common pitfalls using real-world examples to ensure that you're ready for scale.
String Function
1. charAt():
This method returns the character from the specified index.Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character in a string called stringName is stringName.length - 1.
Syntax:
string.charAt(index);
Return Value:
Returns the character from the specified index.
Example:
<html>
<head>
<title>JavaScript String charAt() Method</title>
</head>
<body>
</body>
</html>
Output:
str.charAt(0) is:T
2. concat():
Description:
This method adds two or more strings and returns a new single string.
Syntax:
string.concat(string2, string3[, ..., stringN]);
parameters:
string2...stringN : These are the strings to be concatenated.
Return Value:
Returns a single concatenated string.
Example:
<html>
<head>
<title>JavaScript String concat() Method</title>
</head>
<body>
</body>
</html>
Output:
Concatenated String :This is string oneThis is string two.
3. indexOf():
Description:
This method returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.indexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScript String indexOf() Method</title>
</head>
<body>
<br />");
var index = str1.indexOf( "one" );
document.write("indexOf found String :" + index );
</body></html>
Oputput:
indexOf found String :8
indexOf found String :15
4. lastIndexOf():
Description:
This method returns the index within the calling String object of the last occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.lastIndexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the last found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScri
This document discusses JavaScript objects and methods for manipulating strings and performing mathematical calculations. It introduces the Math object which allows common mathematical operations and contains constants like PI. It also covers the String object which allows manipulating and processing strings, including character-level methods, searching/extracting substrings, and generating XHTML tags. Methods like split(), indexOf(), toLowerCase() are described.
This document summarizes advanced JavaScript concepts including:
- Object-oriented inheritance patterns in JavaScript and trends toward avoiding new and emulating private members. Pseudo-classical inheritance is recommended for better performance.
- Exploiting JavaScript's support for functional programming with higher-order functions to allow functions as arguments and return values for more flexible programming.
- Common issues with asynchronous code in JavaScript and how promises can help address callbacks and synchronization.
- Common pitfalls to avoid with arrays, numbers, and typeof in JavaScript.
2013-06-15 - Software Craftsmanship mit JavaScriptJohannes Hoppe
Entwickeln Sie Clean Code mit JavaScript. Den “Software Craftsman” zeichnen dabei Wissen, Werkzeuge und Wiederholung aus. Diese drei Grundfeste werden speziell für JavaScript beleuchtet. Lernen Sie die wichtigsten Patterns für eine stabile und wartbare Website kennen. Überprüfen Sie Ihre persönliche Werkzeugkiste für Entwicklung, Testing und Deployment. Schließen Sie Bekanntschaft mit Code Katas für JavaScript.
2013-06-24 - Software Craftsmanship with JavaScriptJohannes Hoppe
This document discusses principles of software craftsmanship including:
- Common JavaScript pitfalls like implied globals, trailing commas, and return undefined
- Best practices like avoiding globals, using module patterns for organization, and test-driven development
- Tools for JavaScript development like Jasmine for testing, RequireJS for module loading, and Visual Studio for debugging
- The process of test-driven development including writing tests, making them fail, making them pass, refactoring code, and repeating
This document provides an overview of an ES6 hackathon focusing on new features in ES6 including block scope, modules, destructuring, arrow functions, classes, template literals, internationalization, spread syntax, generators, sets, promises and more. Attendees will have 30 minutes to work on code challenges exploring these new ES6 features using resources like JSFiddle and TypeScript. The challenges involve updating functions to use new syntax like arrow functions, default parameters and object shorthand, satisfying class assertions, and improving outputs using template strings and internationalization.
JavaScript is the programming language of the web. It can dynamically manipulate HTML content by changing element properties like innerHTML. Functions allow JavaScript code to run in response to events like button clicks or timeouts. JavaScript uses objects and prototypes to define reusable behaviors and properties for objects. It is an important language for web developers to learn alongside HTML and CSS.
The document provides an overview of ECMAScript 6 (ES6) and Asynchronous Module Definition (AMD). It discusses features of ES6 like constants, block scoping, arrow functions, classes, and generators. It also covers using AMD modules with AngularJS and demonstrates importing and exporting modules. The presentation aims to introduce developers to ES6 and show how to use AMD modules with AngularJS applications.
1. George Shevtsov - Functional JavaScriptInnovecs
The document discusses functional JavaScript concepts like pure functions, side effects, immutability, function composition, and monads. It provides examples of using Maybe monads to safely access nested object properties and define functor and monad interfaces for the Maybe type to allow chaining operations.
This is a presentation which was presented on Innovecs Tech Hangout in Kiev June 2017.
Includes
- Pure Functions
- Currying
- Function Composition
- Functors
- Monads
The document discusses Java and the benefits of Groovy compared to Java. It covers boilerplate code and ceremony in Java that can be reduced using Groovy. Examples are provided demonstrating Groovy's syntax for primitives, collections like lists and maps, closures, IO operations, XML processing, and a DSL. The document recommends Groovy for its duck typing, operators, and safe navigation operator to avoid null pointer exceptions.
This document discusses JavaScript best practices for naming variables and functions, code formatting and style, scopes and closures, and class-like structures. It provides examples of how to use descriptive names, consistent formatting, closures to manage variable scopes, immediately invoked function expressions (IIFEs), and dataclass structures in Wakanda to define classes. Following these practices can improve code readability, maintainability and reduce bugs.
This document provides an overview of ES6 (ECMAScript 2015) features including: let, const and var; template strings; arrow functions; destructuring; default parameters; rest and spread syntax; iterators; classes; modules; maps, sets, weakmaps and weaksets; promises; and more. It explains each feature and provides code examples to demonstrate usage and differences from ES5. Browser compatibility notes are also included to advise on safe usage of new features across environments.
This document summarizes some lesser known features of the ActionScript programming language. It begins by discussing various operators like equality, logical operators, and type casting. It then covers topics like namespaces, arguments, rest parameters, object references vs copies, and global functions. The document concludes by noting some gotchas and peculiarities in ActionScript, such as casting behaviors and behaviors of the Array and Date classes.
JavaScript variables hold values and are declared with var. Variable names are case sensitive and must begin with a letter or underscore. Variables can hold numbers, strings, Booleans, objects, and null values. Arrays are objects that hold multiple values in a single variable. Functions are blocks of code that perform tasks and are executed by events or calls. Objects store related data and functions to represent self-contained entities.
Typescript fundamentals document summarized in 3 sentences:
The document discusses Typescript fundamentals including types, classes, interfaces, modules and how to use the Typescript compiler. It explains how Typescript adds type safety and compile time checking to JavaScript by using types for variables, parameters, returns and more. Examples are provided for many Typescript features and how they compile down to equivalent JavaScript.
The document discusses MongoDB, a non-relational database that uses documents with a flexible schema rather than tables, and is well-suited for applications that need to store data in complex, nested structures. It provides an overview of key MongoDB concepts like collections, queries, indexing, updating documents, and aggregation capabilities. Examples are given of how MongoDB can be used for applications involving user profiles, blogs, and logging.
The document provides information about a JavaScript course including:
1. The course consists of 5 lectures and 5 labs and is evaluated based on projects, assignments, labs and quizzes.
2. The lecture outline covers introduction to JavaScript, syntax, built-in objects and functions.
3. JavaScript was invented by Brendan Eich at Netscape and first appeared in the Netscape Navigator browser in 1995.
Slides from talk given at Ithaca Web Group and GORGES on CoffeeScript.
The focus is on explaining to people who haven't tried it yet that it's more than syntactic sugar. There are several real life code examples but they were explained verbally so they may not be super helpful if you don't know CoffeeScript yet.
It's an overview, not a tutorial.
Referential Transparency, Higher Order functions, Lazy Evaluation, and Pattern Matching are key concepts in Functional Programming. Referential Transparency means that equal expressions can be replaced with each other without changing the program's behavior. Higher Order functions allow functions to be passed as arguments to other functions and returned as results. Lazy Evaluation delays evaluating arguments until their values are needed to avoid unnecessary computation. Pattern Matching allows decomposing and analyzing data structures.
Similar to Immutability, and how to do it in JavaScripts (20)
Preparing Non - Technical Founders for Engaging a Tech AgencyISH Technologies
Preparing non-technical founders before engaging a tech agency is crucial for the success of their projects. It starts with clearly defining their vision and goals, conducting thorough market research, and gaining a basic understanding of relevant technologies. Setting realistic expectations and preparing a detailed project brief are essential steps. Founders should select a tech agency with a proven track record and establish clear communication channels. Additionally, addressing legal and contractual considerations and planning for post-launch support are vital to ensure a smooth and successful collaboration. This preparation empowers non-technical founders to effectively communicate their needs and work seamlessly with their chosen tech agency.Visit our site to get more details about this. Contact us today www.ishtechnologies.com.au
UI5con 2024 - Bring Your Own Design SystemPeter Muessig
How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of your design system which are created with Stencil. The integration embeds the Web Components in a way that they can be used naturally in XMLViews, like with standard UI5 controls, and can be bound with data binding. Learn how you can also make use of the Web Components base class in OpenUI5/SAPUI5 to also integrate your Web Components and get inspired by the solution to generate a custom UI5 library providing the Web Components control wrappers for the native ones.
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...XfilesPro
Wondering how X-Sign gained popularity in a quick time span? This eSign functionality of XfilesPro DocuPrime has many advancements to offer for Salesforce users. Explore them now!
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...The Third Creative Media
"Navigating Invideo: A Comprehensive Guide" is an essential resource for anyone looking to master Invideo, an AI-powered video creation tool. This guide provides step-by-step instructions, helpful tips, and comparisons with other AI video creators. Whether you're a beginner or an experienced video editor, you'll find valuable insights to enhance your video projects and bring your creative ideas to life.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
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.
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
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/
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
Enhanced Screen Flows UI/UX using SLDS with Tom KittPeter Caitens
Join us for an engaging session led by Flow Champion, Tom Kitt. This session will dive into a technique of enhancing the user interfaces and user experiences within Screen Flows using the Salesforce Lightning Design System (SLDS). This technique uses Native functionality, with No Apex Code, No Custom Components and No Managed Packages required.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid
IBM watsonx Code Assistant for Z, our latest Generative AI-assisted mainframe application modernization solution. Mainframe (IBM Z) application modernization is a topic that every mainframe client is addressing to various degrees today, driven largely from digital transformation. With generative AI comes the opportunity to reimagine the mainframe application modernization experience. Infusing generative AI will enable speed and trust, help de-risk, and lower total costs associated with heavy-lifting application modernization initiatives. This document provides an overview of the IBM watsonx Code Assistant for Z which uses the power of generative AI to make it easier for developers to selectively modernize COBOL business services while maintaining mainframe qualities of service.
3. I’m not going to talk about
let vs const vs var
const is for
immutable
bindings
const foo = 1;
foo = 2; // nope
const someObject = {};
someObject["foo"] = "bar"; // yup
4. It’s an object, that cannot be modified after it’s creation
Immutable Object
6. When you’re sure nothing will change this object, it helps
making assumptions about the code
Still helps reasoning about the code
function main() {
const foo = new Foo();
const bar = calculateBar(foo);
// You know that `calculateBar` would never
// change internals of foo
}
7. Performance is better
Caching is simpler, you can cache more
class SomeClass {
get someSeriousNumber() {
if (this._someSeriousNumber == null) {
this._someSeriousNumber = this.heavyCalculation();
}
return this._someSeriousNumber;
}
}
8. Performance is better
Reusable parts of nested existing objects
make it fast and memory efficient to clone
{
project: {
pages: [
{id: 1, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 2, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 3, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 4, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 5, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
]
}
}
9. Performance is better
Reusable parts of nested existing objects
make it fast and memory efficient to clone
{
project: {
pages: [
{id: 1, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 2, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 3, page_items: [{type: "sticker", bounds: [1,1,30,40]}]},
{id: 4, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 5, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
]
}
}
10. Performance is better
Reusable parts of nested existing objects
make it fast and memory efficient to clone
{
project: {
pages: [
{id: 1, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 2, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 3, page_items: [{type: "sticker", bounds: [1,1,30,40]}]},
{id: 4, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
{id: 5, page_items: [{type: "sticker", bounds: [1,1,3,4]}]},
]
}
}
11. Performance is better
Equality is faster
foo.hashCode();
// => 3247253721
foo.hashCode() === bar.hashCode();
// if false - they are not equal
// if true - ¯_(ツ)_/¯
12. Performance is better
Equality is faster
1 function equals(a, b) {
2 if (a === b) {
3 return true;
4 } else if (a != null) {
5 if (isHashable(a) && isHashable(b) && a.hashCode() !== b.hashCode()) {
6 return false;
7 } else if (isEquatable(a)) {
8 return a.equals(b);
9 } else if (a instanceof Array && b instanceof Array) {
10 return areArraysEqual(a, b);
11 } else if (a instanceof Map && b instanceof Map) {
12 return areMapsEqual(a, b);
13 } else if (a instanceof Set && b instanceof Set) {
14 return areSetsEqual(a, b);
15 } else if (isPlainObject(a) && isPlainObject(b)) {
16 return arePlainObjectsEqual(a, b);
17 } else {
18 return _.isEqual(a, b);
19 }
20 } else {
21 return _.isEqual(a, b);
22 }
23 }
13. You can control the level of uniqueness of your hashcodes
Usually you recursively go through all
the children of an object to calculate a
hash code
Sometimes you could just use some
model id
Performance is better
Equality is faster
14. Object.freeze
How to make an
immutable object?
1 const obj = Object.freeze({a: "1"});
2 obj.a = "8";
3 obj.a;
4 // => 1
5 // => or throws, if in strict mode
17. There’s Record in Immutable JS
Though `equals` there doesn’t use hash codes
unless you already have them calculated and cached.
Value Object
1 class ABClass extends Record({a: 1, b: 2}) {
2 constructor(...rest) {
3 super(...rest);
4 this.hashCode();
5 }
6 // ...
7 }
21. Very efficient updates, inserts and deletions
Persistent Data Structures
80 elements - only 3 nodes to recreate,
33 refs to recreate.
1000000 elements - 5 nodes to recreate
81 refs to recreate
22. Usually used parent-to-child ratio of 16
Persistent Data Structures
Even on very big collections (billions of
records), updating is only ~10-20x times
slower than updating a mutable
collection
Memory efficient
24. • Global state is a huge Immutable.JS object
• Very fast checks for changes in subtree
allows to write super-fast
shouldComponentUpdate checks
It plays especially
nice with Redux
26. Caveats
Some algorithms are harder to implement in immutable
data structures
Sometimes the performance of updates is actually
a show stopper
Immutable.JS offers a shortcut - withMutations()
const list = List.of(1, 2, 3);
const list2 = list.withMutations(mutableList => {
mutableList.push(4);
mutableList.push(5);
});
28. Using wrong reference
Piping:
function main() {
let result = "hello"
|> doubleSay
|> capitalize
|> exclaim;
// => "Hello, hello!"
}
1 function main() {
2 const result = "hello";
3 const result2 = capitalize(result);
4 const result3 = doubleSay(result);
5 const result4 = exclaim(result3);
6 // => "hello, hello!"
7 }
29. Using wrong reference
1 class Page {
2 // ...
3 doStuff() {
4 let post = this.posts.get(0);
5 post = post.update({content: "New content"});
6 const author = this.postsToAuthors.get(post);
7 notifyAuthor(author);
8 // author is null, because it's totally different post now
9 return post;
10 }
11 }
12
30. I think it’d be cool, if JS’ Array, Map and Set
would be persistent collections
I still use immutable objects
by default in my projects
Never gonna happen tho