Scala is a programming language that blends object-oriented and functional programming styles. It is designed to interoperate with Java code and runs on the Java Virtual Machine. Some key features of Scala include case classes, pattern matching, traits for mixing functionality, and immutable data structures. Scala code compiles to Java bytecode, allowing seamless use of Java libraries and tools.
This was a short introduction to Scala programming language.
me and my colleague lectured these slides in Programming Language Design and Implementation course in K.N. Toosi University of Technology.
As the author of an open-source serialization library in Scala, I've undergone a lot of struggle to understand and harness the power of Scala's type system. My library was based on parsing pickled Scala signatures, which was a subterranean and sparely documented feature of Scala 2.8. I wanted to serialize and deserialize options, lists and maps, which required defeating type erasure when serializing while skating by on type erasure when deserializing. I struggled with multiple constructors, checking for annotation types, specialization, more. The new reflection libraries introduced in Scala 2.10 provided easier access to the same information I had been getting from the pickled signatures. This talk will address practical aspects of type mining, providing a library of hands-on examples using the Scala 2.10 reflection API.
Advanced Scala reflection & runtime meta-programming. The Scala compiler toolbox. Reading Scala Annotations and overcoming type erasure with some real world use cases.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
This was a short introduction to Scala programming language.
me and my colleague lectured these slides in Programming Language Design and Implementation course in K.N. Toosi University of Technology.
As the author of an open-source serialization library in Scala, I've undergone a lot of struggle to understand and harness the power of Scala's type system. My library was based on parsing pickled Scala signatures, which was a subterranean and sparely documented feature of Scala 2.8. I wanted to serialize and deserialize options, lists and maps, which required defeating type erasure when serializing while skating by on type erasure when deserializing. I struggled with multiple constructors, checking for annotation types, specialization, more. The new reflection libraries introduced in Scala 2.10 provided easier access to the same information I had been getting from the pickled signatures. This talk will address practical aspects of type mining, providing a library of hands-on examples using the Scala 2.10 reflection API.
Advanced Scala reflection & runtime meta-programming. The Scala compiler toolbox. Reading Scala Annotations and overcoming type erasure with some real world use cases.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
The Scala programming language has been gaining momentum recently as an alternative (and some might say successor) to Java on the JVM. This talk will start with an introduction to basic Scala syntax and concepts, then delve into some of Scala's more interesting and unique features. At the end we'll show a brief example of how Scala is used by the Lift web framework to simplify dynamic web apps.
Scala: Object-Oriented Meets Functional, by Iulian Dragos3Pillar Global
A presentation from Iulian Dragos of Typesafe that gives an overview of the Scala programming language. The presentation was given at a Functional Angle conference in Timisoara, Romania sponsored by 3Pillar. Iulian Dragos has been working on Scala since 2004. He currently works for Typesafe, a start-up that was co-founded by Scala’s creator, Martin Odersky.
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.
Qcon2011 functions rockpresentation_scalaMichael Stal
This is the part I of the tutorial I planned to give at QCon 2011 on Functional Programming with Scala. It also includes Scala 2.8 as well as upcoming features
Similar to A Brief Introduction to Scala for Java Developers (20)
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
A Brief Introduction to Scala for Java Developers
1. A Brief Introduction to Scala
for Java Developers
Miles Sabin, Chuusai Ltd.
http://www.chuusai.com/
http://uk.linkedin.com/in/milessabin
http://twitter.com/milessabin
2. Outline
●
Background
●
Object-Oriented Features
●
Functional Features
●
Selected Highlights
●
Tools and Frameworks
●
Roadmap
3. Background
●
Designed by Martin Odersky (Pizza, GJ and
Java 5) of EPFL as the successor to Funnel
●
Objectives,
●
Blend object-oriented and functional styles
●
Seamless interoperability with Java (and .Net?)
●
Project started in 2003
●
First public release in 2004
●
Currently at 2.7.7
●
2.8 release due very soon
4. Scala is the Future of Java
●
Scala can be thought of as a superset of
current Java
●
It has all the object-oriented features of
current Java (some in a slightly different and
improved form)
●
It already has many of the most desirable
proposed extensions to Java (eg. true closures)
●
Nevertheless, it compiles to Java bytecode
●
Flawless interopability with Java, leverages the
mature Hotspot JIT
5. Interoperbility with Java
●
There are many alternative JVM languages.
Some also strongly “Java-compatible”
●
Close source and binary mapping to Java
– Scala, Groovy, JavaFX, AspectJ
●
This holds out the prospect that most Java
tools, libraries and frameworks will Just
Work, or work with only minor adaptation
●
Additional promise of gradual migration of
existing Java projects
6. Who's Using It?
●
A rapidly growing list of companies and
projects,
●
Twitter (infrastructure)
●
LinkedIn (analytics, infrastructure)
●
EDF Trading (analytics, infrastructure)
●
Sony Pictures Imageworks (infrastructure)
●
SAP/Siemens (ESME, enterprise messaging)
●
Novell (Pulse, enterprise messaging)
7. Why Mix OO and FP?
●
Each has complementary strengths —
●
OO provides excellent support for,
– Subtyping and inheritance
– Modular components
– Classes as partial abstractions
●
FP provides excellent support for,
– Higher order functions
– ADTs, structural recursion and pattern matching
– Parametric polymorphism
●
They've been converging for a while now
8. Scala has a REPL
●
Common in scripting and functional
languages
●
Great for exploratory programming
●
We'll be using it as we go along
9. Scala Cleans Up Java Syntax
●
Semi-colons are optional, equals is ==
●
All statements are expressions and have a
value
●
Type inference eliminates the most
annoying explicit typing annotations
●
Case-classes have minimal boilerplate
●
Closures and by name arguments allow
libraries to define specialized control
structures
10. Scala is Object Oriented
●
Scala has a uniform object model: no
primitive types
11. Scala is Object Oriented
●
Operators aren't special, they're methods
like any other,
val x = 23
x + 1 // equivalent to x.+(1)
●
Similarly, methods can be invoked in
operator form,
val s = "Hello world"
s length // equivalent to s.length
s contains "world" // equivalent to s.contains("world")
12. No Statics
●
No static fields or methods
●
Instead we have first-class "object” entities
similar to singletons and ML modules
// Java
public class User {
public static newUser(String name, String pass) {
return new User(name, pass);
}
// Non-static methods ...
}
// Scala
object User {
def apply(name : String, pass : String) =
new User(name, pass)
}
val joe = User("Joe Bloggs", "<secret>")
13. Vals, Vars and Uniform Access
●
Scala makes immutable definitions easy,
val s : String = "Hello immutable world"
s = "Bye ..." // Error
var t : String = "Hello mutable world"
t = "Bye ..." // OK
●
(Im)mutable properties can be
implemented by vals, vars or methods
class User {
val name : String // Immutable
var email : String // Mutable
def pass : String // Computed
def pass_=(s : String) //
}
user.pass = "<secret>" // Sugar for user.pass_=("<secret>")
14. Statically Typed with Inference
●
All definitions must have a static type
val m : Map[Int, String]
●
However these types are typically inferred
scala> val m = Map(1 -> "one", 2 -> "two")
m : Map[Int, String] = Map(1 -> one, 2 -> two)
●
Method return types are also inferred
scala> def twice(i : Int) = i*2
twice: (i: Int)Int
Argument types must be explicit, also the
return types for recursive functions
15. Named and Default Arguments
●
Arguments can be specified at call sites by
name
def coord(x : Double, y : Double)
coord(y = 1.0, x = 0.7)
Allows them to be provided naturally for
the call site, and eliminates ambiguity
●
Arguments can also be given default values
def printList(l : List[Int], sep : String =", ") { ... }
val l = List(1, 2, 3)
printList(l) // equivalent to printList(l, ", ")
16. Case Classes are Lightweight
●
Eliminate a lot of the boilerplate associated
with Java implementations of simple data
types
public class User {
private final String name;
private final String pass;
public User(String name_, String pass_) {
name = name_;
pass = pass_;
}
public boolean equals(Object other) {
// Stuff ...
}
public int hashCode() {
// More stuff ...
}
}
17. Case Classes are Lightweight
●
The Scala equivalent
case class User(name : String, pass : String)
●
Accessors, equals, hashCode and toString
are provided automatically
●
“new” is optional
val joe = User("Joe Bloggs", "<secret>")
●
“Copy with changes” supports immutable
functional objects
val joeUpdated = joe.copy(pass = "<still secret>")
18. Pattern Matching
●
Case classes model ADTs from functional
languages and support pattern matching
sealed trait Tree[T]
case class Leaf[T](elem : T) extends Tree[T]
case class Node[T](left : Tree[T], right : Tree[T])
val t = Node(Node(Leaf("bar"), Leaf("baz")), Leaf("foo"))
def find[T](tree : Tree[T], elem : T) : Boolean =
tree match {
case Node(l, r) => find(l, elem) || find(r, elem)
case Leaf(`elem`) => true
case _ => false
}
●
Matching is the inverse of construction
19. The Option Type
●
“Null References: The Billion Dollar
Mistake” — Tony Hoare
●
Scala provides a safe alternative
scala> List(1, 2, 3) find (_ == 2)
res0: Option[Int] = Some(2)
scala> List(1, 2, 3) find (_ == 4)
res0: Option[Int] = None
●
Option interacts nicely with matching
List(1, 2, 3) find (_ == 2) match {
case Some(i) => println("Found "+i)
case None => println("Not found")
}
20. Tuples
●
Scala has tuple types and literals
val coord : (Double, Double) = (1.0, 0.5)
println("x = "+coord._1+", y ="+coord._2)
●
These are first-class types like any other
val coords = new ListBuffer[(Double, Double)]
coords += coord
●
Provide ad hoc grouping and multiple
return values
def firstWord(s : String) = {
val i = s+" " indexOf ' '
(s.substring(0, i), s.substring(i, s.length))
}
val (first, rest) = firstWord("The quick brown fox ...")
21. Mixin Composition
●
Java interfaces are replaced by traits and
mixin composition
●
Traits can provide method implementations
●
Traits can provide fields
trait UserId {
val name : String
var pass : String = "change me"
def display = name+":"+pass
}
class User(val name : String) extends UserId
val joe = new User("Joe Bloggs")
println(joe.display)
22. Mixin Composition
●
Traits support multiple inheritance whilst
avoiding the problems of “diamond”
inheritance
trait Email {
val address : String
def send(message : String {
// Concrete implementation
}
}
class User(val name : String, val address : String)
extends UserId with Email
val joe = new User("Joe Bloggs", "joe@gmail.com")
println(joe.display)
joe.send("Don't forget to change your password!")
23. Laziness and By-Name Args
●
Values can be declared to be initialized
lazily
val (title, givenName, surname) = ("Mr.", "John", "Smith")
lazy val fullName = title+" "+givenName+" "+surname
The value is computed the first time it is
used (if at all)
val displayName = if (full) fullName else givenName
●
Can be used to create circular structures
abstract class Link { val next : Link }
val (a : Link, b : Link) =
(new Link { lazy val next = b },
new Link { lazy val next = a })
24. Laziness and By-Name Args
●
Arguments can be passed by name
●
Similar to laziness in that evaluation is deferred
until use
●
Can be used to build specialized control
structures and enables internal DSLs
def locked[T](l : Lock)(op : => T) = {
l.lock
try { op } finally { l.unlock }
}
val lock = new ReentrantLock
var shared = ...
locked(lock) {
/* Use shared while holding lock */
}
25. Structural Typing
●
Scala has a form of statically checkable
duck-typing
●
We can use this to generalize libraries to
pre-existing types
type Closeable = { def close() }
def using[R <: Closeable, T](res : R)(op : R => T) =
try { op(res) } finally { res.close() }
val b = using(new FileInputStream("test.txt")) { _.read }
26. Implicits
●
Implicit functions provide a way to attach
new behaviours to exisiting types
●
Invoked automatically if needed to satisfy
the typechecker
trait Closeable { def close : Unit }
def using[R <% Closeable, T](res : R)(op : R => T) =
try { op(res) } finally { res.close() }
implicit def InputStreamIsCloseable(is : InputStream) =
new Closeable { def close = in.close }
val b = using(new FileInputStream("test.txt")) { _.read }
27. First-Class Functions
●
Scala allows the definition of functions
def plusOne(x : Int) = x+1
●
Functions can be arguments and results
def applyTwice(x : Int, f : Int => Int) = f(f(x))
applyTwice(3, plusOne) // == 5
●
Can be anonymous and close over their
environment
def twice(f : Int => Int) = (x : Int) => f(f(x))
twice(plusOne)(3) // == 5
●
Function literal syntax is concise
twice(_+1)(3) // == 5
29. For Comprehensions
●
Scala's “for comprehensions” capture
common patterns of use of map, flatMap
and filter
val l1 = List(0, 1)
val l2 = List(2, 3)
scala> for (x <- l1; y <- l2) yield (x, y)
res0: List[(Int, Int)] = List((0,2), (0,3), (1,2), (1,3))
The for expression desugars to,
l.flatMap(x => l2.map(y => (x, y))
●
These patterns are the monad laws for the
subject type
30. For Comprehensions
●
Option implements map, flatMap and Filter
so works nicely with for comprehensions
def goodPair(x : Int, y : Int) =
for(fst <- recip(x); snd <- recip(y))
yield (x, y)
scala> goodPair(1, 2)
res0: Option[(Int, Int)] = Some((1,2))
scala> goodPair(1, 0)
res0: Option[(Int, Int)] = None
●
Using Option rather than null has clear
benefits when used in this way
31. Language-Level XML Support
●
Scala has language level support for XML
via XML literals, XPath and pattern
matching,
val book =
<book>
<author>Martin Odersky</author>
<title>Programming in Scala</title>
</book>
val title = book “title” text // == “Programming in ... “
for (elem <- book.child) elem match {
case <author>{name}</author> => println(name)
case _ =>
} // Prints “Martin Odersky”
32. Actor-based Concurrency
●
Scala has library level support for actor-
based, message-passing concurrency
●
An embarrassment of riches —
– scala.actors
– Lift actors
– Akka
●
Not obligatory, these are all libraries, and
all the traditional Java approaches to
concurrency are available
33. Tools and Frameworks
●
Most Java tools and frameworks work with
Scala Out Of The Box
●
Testing frameworks —
●
Specs, ScalaTest, ScalaCheck
●
Web frameworks —
●
Lift
●
Wicket and Play recently added Scala support
●
IDE support — the big three (Eclipse,
Netbeans, IDEA) all actively developed
34. Roadmap
●
Upcoming releases,
●
Beta of 2.8 now available
●
First 2.8 Release Candidate expected in March
●
2.8 Final expected June/July
●
Subsequent 2.8-series releases will
continue current exploratory work,
●
Type specialization (still needs library support)
●
Continuations (currently a compiler plugin)
●
Linear/immutable/non-null types
35. Find Out More
●
Scala's home at EPFL
http://www.scala-lang.org
●
See also the scala and scala-user mailing list
●
The London Scala Users' Group
http://www.meetup.com/london-scala
●
Publications
●
Programming in Scala
Odersky, Venners and Spoon
●
Programming in Scala
Wampler and Payne
36. A Brief Introduction to Scala
for Java Developers
Miles Sabin, Chuusai Ltd.
http://www.chuusai.com/
http://uk.linkedin.com/in/milessabin
http://twitter.com/milessabin