Swift is Apple's new programming language that is intended to replace Objective-C. It was created to address weaknesses in Objective-C like its unusual syntax, lack of modern features, and "C baggage". Swift keeps the best parts of Objective-C but brings modern features like type inference, closures, generics, and optionals. It also has a cleaner syntax that is more familiar to developers from other languages.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Java som sprog har ikke bevæget sig meget de seneste år. Vi har stadig ikke closures eller funktionelle aspekter som f.eks. C# har haft siden version 3. Er Scala svaret på enhver Javaudviklers bønner eller er sproget kun interessant for tågehoveder som mig, som begynder at synes bedre og bedre om funktionsorientering? Er den store portion syntaktisk sukker, Scala bringer på bordet, bare tomme kalorier?
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
Kotlin Advanced - Apalon Kotlin Sprint Part 3Kirill Rozov
The document discusses several Kotlin advanced topics including delegated properties, lazy properties, objects, higher-order functions, lambdas, inline functions, and standard library functions like apply, also, let. It explains concepts like lazy initialization with lazy properties, property delegation, object expressions and declarations, functional programming with higher-order functions and lambdas, and inline functions for performance. It also covers utility functions in the standard library for working with objects and collections.
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Ruby and rails - Advanced Training (Cybage)Gautam Rege
This document outlines the agenda for a two-day Ruby on Rails advanced training course. Day 1 will cover Ruby basics like syntax, classes, modules and metaprogramming. It will also discuss Rails concepts like design patterns, ActiveSupport Concern, and Rails engines. Day 2 will involve discussing applications, gems, resolving problems, ActiveResource, security, caching and performance monitoring. The document also includes examples demonstrating Ruby concepts like objects, closures, exceptions and SOLID principles.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Java som sprog har ikke bevæget sig meget de seneste år. Vi har stadig ikke closures eller funktionelle aspekter som f.eks. C# har haft siden version 3. Er Scala svaret på enhver Javaudviklers bønner eller er sproget kun interessant for tågehoveder som mig, som begynder at synes bedre og bedre om funktionsorientering? Er den store portion syntaktisk sukker, Scala bringer på bordet, bare tomme kalorier?
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
Kotlin Advanced - Apalon Kotlin Sprint Part 3Kirill Rozov
The document discusses several Kotlin advanced topics including delegated properties, lazy properties, objects, higher-order functions, lambdas, inline functions, and standard library functions like apply, also, let. It explains concepts like lazy initialization with lazy properties, property delegation, object expressions and declarations, functional programming with higher-order functions and lambdas, and inline functions for performance. It also covers utility functions in the standard library for working with objects and collections.
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Ruby and rails - Advanced Training (Cybage)Gautam Rege
This document outlines the agenda for a two-day Ruby on Rails advanced training course. Day 1 will cover Ruby basics like syntax, classes, modules and metaprogramming. It will also discuss Rails concepts like design patterns, ActiveSupport Concern, and Rails engines. Day 2 will involve discussing applications, gems, resolving problems, ActiveResource, security, caching and performance monitoring. The document also includes examples demonstrating Ruby concepts like objects, closures, exceptions and SOLID principles.
3 kotlin vs. java- what kotlin has that java does notSergey Bandysik
This document discusses Kotlin functions and lambda expressions. It explains that lambda expressions can be passed immediately as expressions or defined separately as functions. It also discusses that using higher-order functions can introduce runtime overhead which can be eliminated by inlining lambda expressions. Finally, it provides an example of an inline fun that demonstrates inlining and non-inlining of lambda expressions.
The document compares and contrasts features of the Scala and Ruby programming languages, including type systems, pattern matching, monkey patching, dynamic calls, traits/modules, and more. It discusses how each language handles the given features, often providing code examples, and notes similarities and differences between the two approaches. The overall assessment is that a draw is the best way to characterize the comparison between Scala and Ruby, as both languages have their merits for different use cases and preferences.
This document provides an overview of the Swift programming language. It discusses Swift's basic data types including variables, constants, strings, arrays, dictionaries, tuples, optionals, and basic control flow structures like if/else statements and loops. It also covers classes, structures, enums, extensions, generics, closures, and other advanced topics like protocols, operators, and subscripts.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
A short talk on what makes Functional Programming - and especially Haskell - different.
We'll take a quick overview of Haskell's features and coding style, and then work through a short but complete example of using it for a Real World problem.
http://lanyrd.com/2011/geekup-liverpool-may/sdykh/
Ever wonder what this "new" Kotlin thing is? Curious what the syntax looks like? Unsure how to implement this at your own company? Or do you just want to know what Nick and Cody's favorite things are about this language?
All that and (maybe) more are revealed in Privet Kotlin.
Kotlin Basics - Apalon Kotlin Sprint Part 2Kirill Rozov
This document provides an overview of Kotlin basics including:
- Basic data types like Int, String, Boolean
- Collections like List, Set, Map
- Variables, functions, control flow
- Classes, properties, constructors
- Inheritance, interfaces
- Additional features like lambdas, extensions, coroutines
It aims to introduce fundamental Kotlin concepts and syntax in a concise manner.
The Ring programming language version 1.5.1 book - Part 21 of 180Mahmoud Samir Fayed
The document discusses various methods for working with strings in Ring programming language. Some key points include:
- Strings can be defined using double or single quotes, and the : operator can be used to define strings as literals.
- The len() function returns the length of a string. Functions like lower(), upper() can convert case, and left(), right() extract substrings.
- Individual characters in a string can be accessed and modified using indexes. The trim() function removes leading/trailing spaces.
- The copy() function duplicates a string, and lines() counts lines in a string.
- The substr() function allows finding, extracting, and replacing substrings. strcmp() compares two
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
This document discusses string handling in Java. Some key points:
- Strings are immutable sequences of characters represented by the String class. StringBuffer allows mutable strings.
- Constructors can initialize strings from arrays of characters or other strings. Methods like length(), charAt(), and compareTo() operate on strings.
- Strings can be concatenated, searched, extracted, modified, and converted between cases. StringBuffer supports mutable operations like insertion and deletion.
JavaScript introduction 1 ( Variables And Values )Victor Verhaagen
This document provides a summary of JavaScript variables and values. It discusses JavaScript's history and introduces some key concepts around variables, data types, type conversions, and more. The history section outlines the creation of JavaScript and releases of ECMAScript standards over time. Global objects, variables, and values are defined. Data types covered include numbers, strings, Booleans, undefined and null. Object types like arrays are also summarized.
Underscore.js is a JavaScript utility library that provides support for functional programming without extending built-in JavaScript objects. It includes over 60 functions for working with arrays, objects, functions and more. Some key functions include map, reduce, find, and bind for working with collections and functions. Underscore is open source and part of the DocumentCloud project.
The document summarizes 10 idioms for expressing common programming patterns in Ceylon's type system in a concise and type-safe way. These include functions with multiple outcomes, functions returning null, overloading, multiple return values, spreading tuple returns, unions and intersections of values, distinguishing empty and nonempty iterables, abstracting over function types, and auto-discovering annotated classes. The idioms show how Ceylon's type system allows regaining expressiveness within static typing boundaries compared to languages like Java.
Java Cheat Sheet includes the following contents:
- Data Types
- Statements
- String, ArrayList and HashMap Methods
- Conversion
- Operators
- Exception Handling
The document provides idiomatic Kotlin coding style guidelines and best practices for expressions, classes, functions, and the standard library. Some key recommendations include using 'when' and 'try' as expression bodies, avoiding classes just for functions, extracting non-essential APIs to extensions, using data classes, type aliases, and destructuring declarations, and leveraging functions like 'apply', 'filterIsInstance', and 'groupBy' from the standard library. Overall the document advises organizing code in a concise and functional way that fully utilizes Kotlin language features.
The document discusses Scala as a potential replacement for Java on the JVM. It provides quotes from several influential Java developers who express their view that Scala is the most capable replacement for Java currently available on the JVM, and the momentum behind Scala is growing. The document also briefly outlines an agenda for introducing Scala, covering basic syntax, patterns, functions, classes and traits.
Open Solaris Introduction: How to make it feel like homeAhmed Saeed
Ahmed Saeed gives a presentation introducing OpenSolaris. He discusses the history of Solaris and how it became OpenSolaris when Sun open sourced it in 2005. He explains why developers would want to use OpenSolaris due to its innovative technologies like ZFS, DTrace, and Zones. He demonstrates how to install OpenSolaris and describes the Image Packaging System for managing software packages. Finally, he encourages the audience to get involved with the OpenSolaris community.
Sun Web Server 7 is a high-performance, scalable web server with built-in clustering, security, and management features. It has seen widespread adoption serving sites with high traffic like MLB.com. The presentation discusses Sun Web Server 7's architecture, performance benchmarks, new features like regular expressions and URL rewriting, security enhancements, and its role in the Sun GlassFish application server portfolio.
3 kotlin vs. java- what kotlin has that java does notSergey Bandysik
This document discusses Kotlin functions and lambda expressions. It explains that lambda expressions can be passed immediately as expressions or defined separately as functions. It also discusses that using higher-order functions can introduce runtime overhead which can be eliminated by inlining lambda expressions. Finally, it provides an example of an inline fun that demonstrates inlining and non-inlining of lambda expressions.
The document compares and contrasts features of the Scala and Ruby programming languages, including type systems, pattern matching, monkey patching, dynamic calls, traits/modules, and more. It discusses how each language handles the given features, often providing code examples, and notes similarities and differences between the two approaches. The overall assessment is that a draw is the best way to characterize the comparison between Scala and Ruby, as both languages have their merits for different use cases and preferences.
This document provides an overview of the Swift programming language. It discusses Swift's basic data types including variables, constants, strings, arrays, dictionaries, tuples, optionals, and basic control flow structures like if/else statements and loops. It also covers classes, structures, enums, extensions, generics, closures, and other advanced topics like protocols, operators, and subscripts.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
A short talk on what makes Functional Programming - and especially Haskell - different.
We'll take a quick overview of Haskell's features and coding style, and then work through a short but complete example of using it for a Real World problem.
http://lanyrd.com/2011/geekup-liverpool-may/sdykh/
Ever wonder what this "new" Kotlin thing is? Curious what the syntax looks like? Unsure how to implement this at your own company? Or do you just want to know what Nick and Cody's favorite things are about this language?
All that and (maybe) more are revealed in Privet Kotlin.
Kotlin Basics - Apalon Kotlin Sprint Part 2Kirill Rozov
This document provides an overview of Kotlin basics including:
- Basic data types like Int, String, Boolean
- Collections like List, Set, Map
- Variables, functions, control flow
- Classes, properties, constructors
- Inheritance, interfaces
- Additional features like lambdas, extensions, coroutines
It aims to introduce fundamental Kotlin concepts and syntax in a concise manner.
The Ring programming language version 1.5.1 book - Part 21 of 180Mahmoud Samir Fayed
The document discusses various methods for working with strings in Ring programming language. Some key points include:
- Strings can be defined using double or single quotes, and the : operator can be used to define strings as literals.
- The len() function returns the length of a string. Functions like lower(), upper() can convert case, and left(), right() extract substrings.
- Individual characters in a string can be accessed and modified using indexes. The trim() function removes leading/trailing spaces.
- The copy() function duplicates a string, and lines() counts lines in a string.
- The substr() function allows finding, extracting, and replacing substrings. strcmp() compares two
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
This document discusses string handling in Java. Some key points:
- Strings are immutable sequences of characters represented by the String class. StringBuffer allows mutable strings.
- Constructors can initialize strings from arrays of characters or other strings. Methods like length(), charAt(), and compareTo() operate on strings.
- Strings can be concatenated, searched, extracted, modified, and converted between cases. StringBuffer supports mutable operations like insertion and deletion.
JavaScript introduction 1 ( Variables And Values )Victor Verhaagen
This document provides a summary of JavaScript variables and values. It discusses JavaScript's history and introduces some key concepts around variables, data types, type conversions, and more. The history section outlines the creation of JavaScript and releases of ECMAScript standards over time. Global objects, variables, and values are defined. Data types covered include numbers, strings, Booleans, undefined and null. Object types like arrays are also summarized.
Underscore.js is a JavaScript utility library that provides support for functional programming without extending built-in JavaScript objects. It includes over 60 functions for working with arrays, objects, functions and more. Some key functions include map, reduce, find, and bind for working with collections and functions. Underscore is open source and part of the DocumentCloud project.
The document summarizes 10 idioms for expressing common programming patterns in Ceylon's type system in a concise and type-safe way. These include functions with multiple outcomes, functions returning null, overloading, multiple return values, spreading tuple returns, unions and intersections of values, distinguishing empty and nonempty iterables, abstracting over function types, and auto-discovering annotated classes. The idioms show how Ceylon's type system allows regaining expressiveness within static typing boundaries compared to languages like Java.
Java Cheat Sheet includes the following contents:
- Data Types
- Statements
- String, ArrayList and HashMap Methods
- Conversion
- Operators
- Exception Handling
The document provides idiomatic Kotlin coding style guidelines and best practices for expressions, classes, functions, and the standard library. Some key recommendations include using 'when' and 'try' as expression bodies, avoiding classes just for functions, extracting non-essential APIs to extensions, using data classes, type aliases, and destructuring declarations, and leveraging functions like 'apply', 'filterIsInstance', and 'groupBy' from the standard library. Overall the document advises organizing code in a concise and functional way that fully utilizes Kotlin language features.
The document discusses Scala as a potential replacement for Java on the JVM. It provides quotes from several influential Java developers who express their view that Scala is the most capable replacement for Java currently available on the JVM, and the momentum behind Scala is growing. The document also briefly outlines an agenda for introducing Scala, covering basic syntax, patterns, functions, classes and traits.
Open Solaris Introduction: How to make it feel like homeAhmed Saeed
Ahmed Saeed gives a presentation introducing OpenSolaris. He discusses the history of Solaris and how it became OpenSolaris when Sun open sourced it in 2005. He explains why developers would want to use OpenSolaris due to its innovative technologies like ZFS, DTrace, and Zones. He demonstrates how to install OpenSolaris and describes the Image Packaging System for managing software packages. Finally, he encourages the audience to get involved with the OpenSolaris community.
Sun Web Server 7 is a high-performance, scalable web server with built-in clustering, security, and management features. It has seen widespread adoption serving sites with high traffic like MLB.com. The presentation discusses Sun Web Server 7's architecture, performance benchmarks, new features like regular expressions and URL rewriting, security enhancements, and its role in the Sun GlassFish application server portfolio.
Trusted Virtual Domains on OpenSolaris: Usable Secure Desktop EnvironmentsMarcel Winandy
The document summarizes research on implementing Trusted Virtual Domains (TVDs) on OpenSolaris to provide secure desktop environments. Key points are that it focuses on lightweight virtualization for end-user systems without requiring changes to the kernel. It leverages existing OpenSolaris features like zones and MLS and adds new components for TVD management and transparent encryption of home directories and removable storage.
illumos is an open source operating system project that is a descendant of OpenSolaris. It was created as a community-led continuation of OpenSolaris development after Oracle discontinued updates. The illumos project aims to maintain 100% API/ABI compatibility with Solaris while allowing for independent innovation. It has a growing community of developers and is used as the basis for distributions like OpenIndiana.
This document discusses installing and configuring OpenSolaris on an ASUS Eee PC for advanced users. Tips are provided for making a LiveUSB, installing additional drivers, and applications like Google Gadgets, Songbird media player, and Second Life. Issues are noted with wireless and Ethernet drivers, and help from OpenSolaris developers is acknowledged. The goal is to expand usage of OpenSolaris through netbooks and share tips for technically-minded "GEEKS".
This document discusses the OpenSolaris Web Stack, which provides a set of integrated and optimized open source web infrastructure components. It summarizes the components included in the Web Stack, how they are packaged and supported on OpenSolaris, Solaris 10, and RHEL 5. It also discusses the performance benefits of using the Web Stack on newer Intel Nehalem servers and outlines future directions.
School OS is specially designed for school chidren by Sun Microsystems, India in collaboration with NCERT and
IIT Delhi and is determined to spearhead the rise of open-source in the primary & secondary education system of India. OpenSolaris School OS is a unix based operating system. As we’ll see in this guide it is pretty easy to use even for school students and It has a lot of cool featur es. OpenSolaris has all the tools you need for day to
day productivity, development and even simple tasks like browsing the web, listening to music and watching movies. There is nothing that your Windows box can do and OpenSolaris cannot.
Sun Web Server 7 is a high-performance, scalable web server with built-in clustering, security, and management features. It has set performance records and powers many large sites including MLB.com. The document discusses Sun Web Server 7's architecture, performance optimizations, security enhancements, clustering capabilities, and integration within the Sun GlassFish application server portfolio.
OpenSolaris + Netbeans + Glassfish + MySQL on VirtualBox Install GuideSean O'Quin
The document provides step-by-step instructions for installing OpenSolaris, VirtualBox, JDK 6, Netbeans 6.1, Glassfish, and MySQL on a virtual machine using VirtualBox to create an open source enterprise solution. It outlines 27 steps for configuring the virtual machine, installing the operating system and software packages, and configuring the packages.
This document provides an overview of a workshop on Solaris 10 security topics presented by Peter Baer Galvin. The workshop covers new security features in Solaris 10 from an administrator's perspective, with the objectives of exploring the features, conveying their status and usability, and helping prepare for Solaris 10 deployment. The outline includes topics like DTrace, RBAC, privileges, NFSv4, auditing enhancements, packet filtering, and more.
This document summarizes Solaris Operating System and virtualization technologies from Sun Microsystems. It discusses Solaris 10 and OpenSolaris releases, features of Solaris containers and logical domains for OS virtualization. It also covers Sun xVM virtualization portfolio including Solaris containers, logical domains, VirtualBox and xVM Server for server and desktop virtualization. xVM Ops Center 2.0 is introduced for managing heterogeneous datacenters.
Virtualization allows consolidation of servers to improve efficiency and reduce costs. It addresses challenges like high server maintenance costs, power and cooling expenses from datacenter sprawl, and limited space for physical expansion. Solaris virtualization technologies like containers, logical domains, and the xVM hypervisor enable consolidation while maintaining performance and security. They provide flexibility to adapt resource allocation to business needs and improve resilience against failures or disasters.
This document provides an overview of OpenSolaris and the process for porting open source applications to the OpenSolaris platform. It discusses key OpenSolaris features like ZFS, IPS packaging, and development tools. It also outlines the Package Factory and Source Juicer tools that automate and streamline the process of porting applications. The document demonstrates how to use Source Juicer to port an application, including submitting it, building packages, testing, and publishing to repositories.
OpenSolaris Clusters And Clouds From Your Laptopbogdanv
This document discusses Sun HPC Software, Developer Edition for OpenSolaris, which provides an integrated development environment for building and testing HPC applications on clusters and clouds. It allows developers to easily set up and use OpenSolaris zones on their laptop for development and testing, and then deploy applications to public clouds like Amazon EC2. The software appliance provides tools like Sun Studio, Sun Grid Engine for job scheduling, and cloud connectivity through the Service Domain Manager. This enables developers to focus on coding without having to configure systems.
The document provides an agenda and overview for a workshop on key OpenSolaris 2009.06 technologies including installing OpenSolaris, the IPS package manager, ZFS and Time Slider, and DTrace. It discusses options for installing OpenSolaris natively, in a partition, or in VirtualBox. It also provides demonstrations of the IPS package manager, managing repositories, ZFS features like snapshots and Time Slider, and using DTrace to monitor system calls.
The document discusses various looping constructs in Swift including for-in loops, while loops, and repeat-while loops. It provides syntax examples and sample outputs for each type of loop. It also covers strings, arrays, and dictionaries in Swift, describing how to create, access, modify and iterate over each.
This document summarizes a talk given about Nokia's migration to Scala for its Places API. The key points are:
1) Nokia migrated its Places API codebase to Scala to take advantage of Scala's features like its powerful type system, immutable data structures, and functional programming capabilities.
2) The migration was done gradually over time while continuing to develop new features. They discovered many benefits of Scala along the way like improved test readability and JSON parsing capabilities.
3) Nokia uses Scala features like case classes, options, and functions to model data and add type safety to its codebase. This uncovered bugs that would have been hard to find in Java.
This document provides an introduction to the Scala programming language. It discusses that Scala is a hybrid language that is both object-oriented and functional, runs on the JVM, and provides seamless interoperability with Java. It highlights features of Scala such as pattern matching, traits, case classes, immutable data structures, lazy evaluation, and actors for concurrency.
Apple's Swift has achieved the top place in Stack Overflow's "Most Loved" list of programming languages in its 2015 Developer Survey. Based on information gleaned from GitHub and Stack Overflow, analyst firm RedMonk has seen Swift's popularity ranking soar from 68 to 22 in an unprecedented 6 months.
The "Extreme Swift" event does not require advanced, or even any, knowledge of Swift. Learn about some of the more outrageous features of the language which help explain what the fuss is all about!
Never look at programming the same way again — even if you never end up writing a single line of Swift code in your life.
(How) can we benefit from adopting scala?Tomasz Wrobel
Scala offers benefits from adopting it such as increased productivity through concise and expressive code, static typing with type inference, support for both object-oriented and functional programming paradigms, and interoperability with Java. Switching from Java to Scala involves some changes like using val for immutable variables and var for mutable, but overall the syntax is quite similar which eases the transition.
The document contains code examples demonstrating various Scala programming concepts such as functions, pattern matching, traits, actors and more. It also includes links to online resources for learning Scala.
This document discusses creating an Android app using Kotlin. It begins by explaining some of the limitations of using Java for Android development and how Kotlin addresses these issues. It then provides examples of Kotlin code showing functions, variables, parameter defaults, string templates, collections, lambdas, equality checks, destructuring, extension functions, null safety, smart casts, classes, interfaces, data classes, and delegated properties. It concludes by outlining steps for creating an Android app in Kotlin, including configuring the project, converting Java code to Kotlin, and initializing basic app components.
The document provides an overview of Strings and StringBuilders in Java. It discusses Strings as immutable objects and how StringBuilders can be more efficient for modifying strings. It also covers common String and StringBuilder methods, when to use each, and exceptions in Java using try/catch blocks.
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
This document provides an introduction to learning Python. It discusses prerequisites for Python, basic Python concepts like variables, data types, operators, conditionals and loops. It also covers functions, files, classes and exceptions handling in Python. The document demonstrates these concepts through examples and exercises learners to practice char frequency counting and Caesar cipher encoding/decoding in Python. It encourages learners to practice more to master the language and provides additional learning resources.
The document discusses various String methods in Java:
- The charAt() method returns the character at a given index in the String.
- The compareTo() method compares two Strings lexicographically and returns an integer indicating their relative ordering.
- The indexOf() method returns the index of the first occurrence of a character or substring in the given String. It has overloads to specify a starting index for the search.
We have this new language, Swift, which takes some familiar Apple patterns, and introduces some new ones. With tools like closures and method chaining, there are definitely some new ways to solve the age-old Obj-c architecture challenges. This talk will walk through some of the most common Obj-c design patterns rewritten in Swift, and showcase the strengths and weaknesses of this new language.
The document discusses arrays, strings, and vectors. It provides information on:
- Arrays being indexed collections that store fixed elements in contiguous memory locations.
- Single dimensional and multidimensional arrays in Java, including declaration, instantiation, initialization, and passing arrays as method parameters.
- Strings being immutable character sequences that can be manipulated through methods like length(), substring(), indexOf(), and replace().
- StringBuffer providing mutability over Strings for operations like insertion, deletion, and reversal of characters.
The document discusses processing strings in Java using the String, StringBuffer, and StringTokenizer classes. It provides details on constructing and manipulating strings, including obtaining length, retrieving characters, concatenation, substrings, comparisons, and conversions. It also covers the StringBuffer class for processing mutable strings, and the StringTokenizer class for extracting tokens from strings. Examples provided demonstrate checking palindromes, counting letters, using StringBuffer for output, and processing command-line arguments.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was created in 2001 by Martin Odersky and aims to integrate features of object-oriented and functional languages. Scala code is compiled to JVM bytecode and supports interoperability with Java libraries and frameworks. Some key features of Scala include support for immutable data structures, pattern matching, traits for mixing composition, and functional programming constructs like functions as first-class values. Scala has gained popularity in industry at companies like LinkedIn, Twitter, and The Guardian.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining messages as case classes, and implementing a chat server and comet component. It then summarizes that Scala is a pragmatically-oriented, statically typed language that runs on the JVM and provides a unique blend of object-oriented and functional programming. Traits allow for code reuse and multiple class inheritances. Functional programming concepts like immutable data structures, higher-order functions, and for-comprehensions are discussed.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining case classes and actors for messages. It summarizes that Scala is a pragmatically oriented, statically typed language that runs on the JVM and has a unique blend of object-oriented and functional programming. Functional programming concepts like immutable data structures, functions as first-class values, and for-comprehensions are demonstrated with examples in Scala.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
This document discusses Scala and its features. It provides an example of building a chat application in 30 lines of code using Lift framework. It also demonstrates pattern matching, functional data structures like lists and tuples, for comprehensions, and common Scala tools and frameworks. The document promotes Scala as a pragmatic and scalable language that blends object-oriented and functional programming. It encourages learning more about Scala.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining messages as case classes, and implementing a chat server and comet component. It then summarizes that Scala is a pragmatically-oriented, statically typed language that runs on the JVM and provides a unique blend of object-oriented and functional programming. Traits allow for static and dynamic mixin-based composition. Functional programming concepts like immutable data structures, higher-order functions, and for-comprehensions are discussed.
2. Agenda
- Who am I?
- How Apple arrived at Swift
- What’s new in Swift
- Swift’s syntax & basics
- Resources
What we will cover
3. Who am I?
- iOS + .NET Developer
- Write on all things development
- Game Developer (Specifically, Unity)
- Founded Dreaming In Binary
- Developer at HealthMEDX
Jordan Morgan
4. Apple’s road to Swift
Created in 1983 by Brad Cox & Tom Love
Built right on top of C
Added Object Oriented ideas (classes, objects, etc)
Objective-C is created
5. Apple’s road to Swift
2 years later, Jobs licenses it for NeXT (NeXTSTEP)
1996, Jobs is back at Apple and NeXT is acquired
Object Oriented libraries separated out from the OS as an API
called OpenStep
1997, Apples includes NeXT OS and APIs into new OS -
“Rhapsody”. This became Mac OS X.
This is where we get “NS” from - NeXT Step
Objective-C is engrained into Apple’s technology stack
6. Apple’s road to Swift
Objective-C became the native language for iOS/OS X
Improved and iterated upon over the years
Works fine - but starts to show its age
Objective-C peaks
7. Apple’s road to Swift
- Objective-C is not easy to learn
- Syntax is unusual and unfamiliar
- C is mixed in and heavily used in Foundation
- C baggage (.h & .m files, for example)
- No generics (leads to tedious casts)
- Overloading not supported
Objective-C’s weaknesses
8. Apple’s road to Swift
Keeps the best of Objective-C, such as named
parameters
Brings in modern programming language
advancements
Syntax is familiar - similar to PHP, Python, and
Rust
In comes Swift!
9. What’s new in Swift
Type inference
Cool new features
var aString:String = "String variable"
keyword name type initial value
10. What’s new in Swift
var 😼 = "Catface"
Type Inference
var anotherString = "Another string variable"
Variables can be unicode characters
Omit the type - it’s inferred to be a String
11. What’s new in Swift
String is lightweight like a C string
Powerful as an NSString
Concatenating is no longer a chore
Types
var twitterURL = "(kTwitterURL) + (twitterHandle)";
NSURL *twitterURL = [[NSURL alloc] initWithString:
[kTwitterURL stringByAppendingString:twitterHandle]];
12. What’s new in Swift
var speakers = 20
var attendees = 300
var audience = "On average, there will be
(attendees / speakers) people at each session."
String Interpolation
Can even have expressions evaluated
No need for a mutable or immutable typed Strings
13. What’s new in Swift
The let keyword defines a constant
Constants
let speakers = 20
let attendees = 300
let audience = "On average, there will be
(attendees / speakers) people at each session."
- Opt for immutability
- Forces you to think about your declarations
- Safer for multithreaded environments
- Optimization gains
14. What’s new in Swift
- Variables always initialized before use
- But what about nil?
- Objective - C nil = Pointer to a non existent object
- Swift nil = Absence of a value of a certain type
- Optionals - more on that later
Variable Initialization
15. What’s new in Swift
- Closures unified with function pointers
- Generics
- Tuples
- No more semicolons (though you can)
- and more
Other notable additions
16. If Statements
No parentheses required
Some basic and minor changes
Braces always required
if 1 < 2
{
println("True")
}
else
{
println("False")
}
17. Collections
They can work with any type - primitives included
Concise and powerful:
NSArray *numAr = @[[NSNumber numberWithInt:0]];
Array and Dictionary
let numAr = [1]
let names: [String] = ["Jordan", "Jansyn"]
Specify the type if you want:
19. Collections
Easy to modify
Modify a collection with append(<T>):
var modify = [“Jordan”]
modify.appened(“Jansyn”)
//["Jordan","Jansyn"]
Specify index
var modify = ["Jordan"]
modify[0] = "Jansyn"
//["Jansyn"]
Use range operators
var modify = ["Jordan","Jansyn"]
modify[0...1] = ["Bennett","Whitney"]
//["Bennett","Whitney"]
20. Collections
Just define a new key
Modify a dictionary
var morganFam = ["Jordan":25]
morganFam["Jansyn"] = 25
Editing value works the same way
var morganFam = ["Jordan":25]
morganFam["Jansyn"] = 26
21. Collections
If you want a collection with more than one type :
Varied types
var multiTyped: [AnyObject] = ["foo", 01, true, 44.5]
That said, try to keep them strongly typed
For most intents and purposes, AnyObject is
analogous to id
22. Loops
for i in 0..<2
{
println(i)
}
//Output: 0,1
Ranges
Half open range Closed range
for i in 0...2
{
println(i)
}
//Output: 0,1,2
23. Loops
Easily loop through characters in a string
Flexible
let abc = "abc"
for char in abc
{
println(char)
}
In Objective-C :
NSString *myStrings = @"abc";
for (NSInteger charIdx=0; charIdx < myStrings.length; charIdx++)
{
NSLog(@"%C", [myStrings characterAtIndex:charIdx]);
}
24. Loops
Exclude value from the range (use _)
Loops cont.
let base = 3
let power = 10
var answer = 1
for _ in 1...power
{
answer *= base
}
Iterating over collections
let morganFam = ["Jordan":25,"Jansyn":25,"Bennett":1]
//KVPs from dictionary come back as tuples
for (name,age) in morganFam
{
println("(name) is (age) years old.")
}
25. Loops
Condition - increment looping
Traditional C-style iteration
for var idx = 0; idx < MAX; idx++
{
println("Index is (idx)")
}
No parentheses
Initialization with var and not let
While loops are here too
26. Switch Statements
No implicit fall through
Fallthrough
You can still “break” out before execution if finished
If you want to fallthrough, you can use fallthrough
27. Switch Statements
You can get cute with them
Switches cont.
let anInt = 40
switch anInt
{
case 0, 1, 2:
println("Tiny")
case 3...5:
println("Medium")
case 6..<39:
println("Large")
case _ where anInt % 2 == 1:
println("It's odd")
case _ where anInt % 2 == 0:
println("Nope, it's not odd, it's even")
default:
break
}
28. Switch Statements
The old days
Compared to Objective-C
NSString *morganFamMember = @"Jordan";
if ([morganFamMember isEqualToString:@"Jansyn"])
{
NSLog(@"It's mom!");
}
else if([morganFamMember isEqualToString:@"Bennett"])
{
NSLog(@"It's the baby boy!");
}
else if([morganFamMember isEqualToString:@"Whit"])
{
NSLog(@"It's Jordan's sister!");
}
else if([morganFamMember isEqualToString:@"Jordan"])
{
NSLog(@"It's dad!");
}
else
{
NSLog(@"We don't know who it is.");
}
The new days
let morganFamMember = "Jordan"
switch morganFamMember
{
case "Jansyn":
println("It's mom!”)
case "Bennett":
println("It's the baby boy!")
case "Whit":
println("It's Jordan's sister!")
case "Jordan":
println("It's dad!")
default:
println("We don't know who it is.")
}
Objective-C doesn’t support Switch with NSString
29. Optionals
We want the value - or to know it wasn’t found
A core concept of Swift
Optionals have ? by them
Means we get a value back - or nothing at all
30. Optionals
We could use magic numbers (i.e. -1)
Cont.
let jansynsAge:Int? = morganFam["Jansyn"]
NSNotFound if in Objective-C
Returns nil -or no value, or an int (Need to specify type)
31. Optionals
So if it’s there, how do we get it?
Unwrapping
let jansynsAge:Int? = morganFam["Jansyn"]
if jansynsAge == nil
{
println("Jansyn is apparently timeless.")
}
else
{
let foundAge = jansynsAge!
println("Jansyn is (foundAge) years old.")
}
Unwrap the value (i.e. the !)
No need to specify the type, the compiler knows
32. Optionals
This is a common pattern, shorthand is like so (no !):
Short syntax
if let foundAge = jansynsAge
{
println("Jansyn is (foundAge) years old.")
}
If you know the value is there, you can unwrap it directly:
var name: String? = "Jordan"
let anotherJordan = name!
println(anotherJordan)
You’re crashing if you’re wrong
If forced unwrapped, you don’t need to set it to a var.
33. Optional Chaining
What if you want a value that could be housed around
other nil values?
Query multiple optionals
class Residence
{
var street:String?
}
class Person
{
var humbleAbode:Residence?
}
var aPerson = Person()
34. Optional Chaining
Use ? operator to use optional chaining
Cont.
class Residence
{
var street:String?
}
class Person
{
var humbleAbode:Residence?
}
var aPerson = Person()
if let theStreet = aPerson.humbleAbode?.street
{
println("The street is (theStreet)")
}
else
{
println("Person has no street")
}
Remember, any optional must be unwrapped via !
35. Functions
Defined with func keyword
Overview
func printName()
{
println("It's Jordan")
}
Named parameters, like Objective-C
func printName(name:String)
{
println("It's (name)”)
}
36. Functions
Denote return type with ->
Return types
func printNameWithGreeting(name:String) -> String
{
return "It's (name), how ya doin' today?"
}
Define default values
func printNameWithGreeting(name:String = "Jansyn") -> String
{
return "It's (name), how ya doin' today?"
}
37. Functions
Return tuples
Multiple return types
func nameAndAge() -> (String, Int)
{
return ("Jordan",25)
}
Decompose them to access values
let (name,age) = nameAndAge()
println("(name) is (age) years old.")
38. Functions
Give meaningful names to return values
Name multiple return values
func nameAndAge() -> (name:String, age:Int)
{
return ("Jordan",25)
}
let Jordan = nameAndAge()
println("(Jordan.name) is (Jordan.age) years old.")
//Jordan is 25 years old.
39. Closures
Much like blocks in Objective-C
Similar functionality
Contain some code, you can pass them around
Lambdas or anonymous functions
let aClosure =
{
println("This is a closure")
}
Compiler sees it like this:
let aClosure: () -> () =
{
println("This is a closure")
}
40. Closures
Notice that’s similar to a function’s signature
Syntax
let aClosure: () -> () =
{
println("This is a closure")
}
func aClosure: () -> () =
{
println("This is a closure")
}
Functions are just named closures
41. Closures
Define in the formal parameter list
Passed as a parameter
func doTaskRepeated(count: Int, theTask: () -> ())
{
for i in 0..<count
{
theTask()
}
}
Calling it
doTaskRepeated(10, {
println("A complex and awesome task.")
})
42. Closures
Define closure as the last parameter in formal parameter
list
Trailing closure
doTaskRepeated(10) {
println("A complex and awesome task.")
}
Looks like control flow statement
43. Classes
No more import because Swift has no implementation file
Much like Java and .NET
No need to explicitly define a base class
class Person
{
}
44. Classes
class Jordan
{
let name = "Jordan"
}
Properties
Swift provides the backing store for you
By default, all entities have internal access
class Jordan
{
let name = "Jordan"
private let movieMostWatchedPastMonth = "Frozen"
}
45. Classes
Use internal, or nothing at all
Exposing properties
class Jordan
{
let name = "Jordan"
internal var age = 25
private let movieMostWatchedPastMonth = "Frozen"
}
let aJordan = Jordan()
//Grew up quick during this talk
aJordan.age = 35
Notice you don’t need “new” in front of the type
46. Classes
You can define custom getters and setters
Computed properties
class Jordan
{
let name = "Jordan"
var myLocation:(x:Float,y:Float)
{
get
{
return (10,30)
}
set
{
self.myLocation.x = newValue.x
self.myLocation.y = newValue.y
}
}
}
…can even use tuples
Create a read only computed property - just omit setter
47. Classes
init() keyword
Initialization
class Jordan
{
let name = "Jordan"
var age = 25
init()
{
//No need to return self
}
}
Can also initialize constant values
class Jordan
{
let name = "Jordan"
let hobby = ""
init()
{
//No need to return self
}
init(hobby:String)
{
self.hobby = hobby
}
}
var aJordan = Jordan(hobby: "Basketball")
- if you are inheriting, call super.init()
48. Classes
Fires just before and right after value changes
Property Observers
class Bennett
{
private let setCurfew = 9 //p.m.
var curfew : Int
{
willSet
{
if curfew > setCurfew
{
println("GROUNDED")
}
}
didSet
{
if curfew < setCurfew
{
println("I am glad you obey.")
}
}
}
init()
{
self.curfew = setCurfew
}
}
49. Classes
Work the same way as functions
Methods
Only need to use self when property has the same
name as a parameter in the function’s signature
class Bennett
{
var nickName = "Benny"
func changeNickName(nickName: String)
{
self.nickName = nickName
println("Bennett's new nickname is (self.nickName)")
}
}
50. Classes
You don’t even need to specify one
A note on initializers
super.init needs to happen last in custom initializers
Sole purpose is to initialize values for the class
51. Structs
Still works the same way
Not much has changed
- Doesn’t support inheritance
- Value types
Think of them as you do in your OOP language of choice
52. Enumerations
Value types
Enums
They can have raw values (like in C)
enum BestNFLTeams:Int
{
case StLouisRams = 1, Patriots, Bucs, Chiefs
}
BestNFLTeams.StLouisRams.toRaw()
//Prints 1, obviously
53. Enumerations
Don’t always need underlying values
enum Directions
{
case North, South, East, West
}
//Compiler infers Directions as type
var directionToGo = Directions.North
Also, compiler will again infer the type
let lbl = UILabel()
lbl.textAlignment = .Right
Value type constants have all constant members
Reference type constants can have mutable members
54. Enumerations
Associate values within an enum
Associated Values
enum RamsVictory
{
case ByOnePoint
case ByPoints(Int)
}
var ramsWinBig = RamsVictory.ByPoints(24)
Even custom properties
enum RamsVictory
{
case ByOnePoint, ByPoints(Int)
var winSummary:String{
switch self{
case .ByOnePoint:
return "Rams by one."
case .ByPoints(let points):
return "Rams win big by (points)!"
}
}
}
var ramsWinBig = RamsVictory.ByOnePoint
println(ramsWinBig.winSummary) //Rams by one.
ramsWinBig = RamsVictory.ByPoints(14)
println(ramsWinBig.winSummary) //Rams win big by 14!
55. Access Modifiers
Three modifiers
Recently Added
- Private - Available only from within source file
- Internal - Available to entire module that includes
the definition (i.e. app or framework)
- Public - Intended for use with APIs, means entity
can be accessed by any file that imports the
module
56. There’s much more
Interoperability with Objective-C
Lots of new features
Extensions
Automatic Reference Counting
Pattern Matching
Functional Programming
57. Resources
- www.dreaminginbinary.co
- The Swift Programming Language (iBook)
- The Swift Blog
- WWDC Videos
- @dibsoftware
- @jordanmorgan10
- facebook/dreaminginbinary