SlideShare a Scribd company logo
1 of 26
Scala,
a practical approach
By: Deepak Kumar
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
Installation in Windows
▪ Download the Zip from scala-lang.org
▪ Set JAVA_HOME & SCALA_HOME & update the path variable
▪ Make sure you have proper Java environment variable setting. As
Scala runs on JVM.
Installation in Linux
▪ Download tgz file and unzip it
▪ Set JAVA_HOME & SCALA_HOME & update the path variable
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
Why Scala…?
▪ Solving business problem instead of writing boiler plate code
▪ Support for functional programming.
▪ REPL : 60% code reduction.
▪ Design patterns are encapsulated in the Language itself
▪ Truly Object Oriented . Even functions are Objects: All the value in Scala are
object inherited from ANY class
▪ Runs on JVM So existing code is not necessarily to be scrap
▪ ; is optional. Only needed if you want to evaluate two or more expr in same
line.
▪ Value variable(immutable & default REPL) & variable variable (mutable val )
Everything is an Object…Method, variable
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
Scala in action (Interactive Mode)
▪ REPL (Read, Evaluate, Print, in a loop)
▪ Even you can do println(res2)
REPL contd…..
Scala in action (Script Mode)
▪ Create a file in notepad, write the following code and save it with
.scala extension .
▪ Compile it & run it with scalac & scala respectively
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
▪ Install the simple build tool (sbt) & eclipse IDE/plugin for scala.
▪ Fire console
Eclipse Supports Scala
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
Basic Syntax of Scala
Object type Syntax Example
Variable var <variableName>=<value> var x=12; var x:Double=12 (ExplicitType)
Constant val <variableName>=<value> val x=12
Funcation def <functionName> (<Variable Name> :<VariableType>) ={
<function definition>}
Basic Syntax of Scala
For Syntax in detail please check the scala cheetsheet @ http://docs.scala-
lang.org/cheatsheets/index.html
Object Name Syntax Example
Index
▪ Installation of Scala.
▪ Why Scala ?
▪ Interactive Mode & Script Mode
▪ Ease your work with tools
▪ Basic Syntax
▪ Collection in Scala
▪ ScalaTrait
▪ Scala Exception Handling
▪ Design Pattern in Scala
▪ Question/Query
Introduction of String in Scala
Group A
• Task 1
• Task 2
Group B
• Task 1
• Task 2
Group C
• Task 1
▪ First bullet point here
▪ Second bullet point here
▪ Third bullet point here
Add a Slide Title - 1
Add a Slide Title - 2
Add a Slide Title - 3
Add a Slide Title - 4
References
▪ http://docs.scala-lang.org/tour/tour-of-scala.html
▪ https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.h
tml
▪ Pluralsight Articles:
justin-pihony
Scala,a practicle approach

More Related Content

What's hot

What's hot (20)

Composable Futures with Akka 2.0
Composable Futures with Akka 2.0Composable Futures with Akka 2.0
Composable Futures with Akka 2.0
 
Scala elegant and exotic part 1
Scala  elegant and exotic part 1Scala  elegant and exotic part 1
Scala elegant and exotic part 1
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016
 
Scala Matsuri 2017
Scala Matsuri 2017Scala Matsuri 2017
Scala Matsuri 2017
 
Why scala - executive overview
Why scala - executive overviewWhy scala - executive overview
Why scala - executive overview
 
Rails on JRuby
Rails on JRubyRails on JRuby
Rails on JRuby
 
Building Enterprise Search Engines using Open Source Technologies
Building Enterprise Search Engines using Open Source TechnologiesBuilding Enterprise Search Engines using Open Source Technologies
Building Enterprise Search Engines using Open Source Technologies
 
Ow
OwOw
Ow
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Ruby on Rails All Hands Meeting
Ruby on Rails All Hands MeetingRuby on Rails All Hands Meeting
Ruby on Rails All Hands Meeting
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Beginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_cccBeginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_ccc
 
Scala in the Wild
Scala in the WildScala in the Wild
Scala in the Wild
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKA
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
Display earthquakes with Akka-http
Display earthquakes with Akka-httpDisplay earthquakes with Akka-http
Display earthquakes with Akka-http
 
Core FP Concepts
Core FP ConceptsCore FP Concepts
Core FP Concepts
 
Dropwizard
DropwizardDropwizard
Dropwizard
 

Similar to Scala,a practicle approach

Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
e-Legion
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
ssusercd195b
 
An Introduction to Scala
An Introduction to ScalaAn Introduction to Scala
An Introduction to Scala
Brent Lemons
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
Vasil Remeniuk
 

Similar to Scala,a practicle approach (20)

Introduction to Scala language
Introduction to Scala languageIntroduction to Scala language
Introduction to Scala language
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin Odersky
 
Scala & Spark Online Training
Scala & Spark Online TrainingScala & Spark Online Training
Scala & Spark Online Training
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
 
An Introduction to Scala
An Introduction to ScalaAn Introduction to Scala
An Introduction to Scala
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Scala for java developers 6 may 2017 - yeni
Scala for java developers   6 may 2017 - yeniScala for java developers   6 may 2017 - yeni
Scala for java developers 6 may 2017 - yeni
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
 
Scala Frustrations
Scala FrustrationsScala Frustrations
Scala Frustrations
 
From java to scala at crowd mix
From java to scala at crowd mixFrom java to scala at crowd mix
From java to scala at crowd mix
 
Installing spark scala console in windows 10
Installing spark scala console in windows 10Installing spark scala console in windows 10
Installing spark scala console in windows 10
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanScala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Scala in Model-Driven development for Apparel Cloud Platform
Scala in Model-Driven development for Apparel Cloud PlatformScala in Model-Driven development for Apparel Cloud Platform
Scala in Model-Driven development for Apparel Cloud Platform
 
Scala Introduction.pptx
Scala Introduction.pptxScala Introduction.pptx
Scala Introduction.pptx
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

Scala,a practicle approach

  • 2. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 3. Installation in Windows ▪ Download the Zip from scala-lang.org ▪ Set JAVA_HOME & SCALA_HOME & update the path variable ▪ Make sure you have proper Java environment variable setting. As Scala runs on JVM.
  • 4. Installation in Linux ▪ Download tgz file and unzip it ▪ Set JAVA_HOME & SCALA_HOME & update the path variable
  • 5. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 6. Why Scala…? ▪ Solving business problem instead of writing boiler plate code ▪ Support for functional programming. ▪ REPL : 60% code reduction. ▪ Design patterns are encapsulated in the Language itself ▪ Truly Object Oriented . Even functions are Objects: All the value in Scala are object inherited from ANY class ▪ Runs on JVM So existing code is not necessarily to be scrap ▪ ; is optional. Only needed if you want to evaluate two or more expr in same line. ▪ Value variable(immutable & default REPL) & variable variable (mutable val )
  • 7. Everything is an Object…Method, variable
  • 8. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 9. Scala in action (Interactive Mode) ▪ REPL (Read, Evaluate, Print, in a loop) ▪ Even you can do println(res2)
  • 11. Scala in action (Script Mode) ▪ Create a file in notepad, write the following code and save it with .scala extension . ▪ Compile it & run it with scalac & scala respectively
  • 12. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 13. ▪ Install the simple build tool (sbt) & eclipse IDE/plugin for scala. ▪ Fire console
  • 15. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 16. Basic Syntax of Scala Object type Syntax Example Variable var <variableName>=<value> var x=12; var x:Double=12 (ExplicitType) Constant val <variableName>=<value> val x=12 Funcation def <functionName> (<Variable Name> :<VariableType>) ={ <function definition>}
  • 17. Basic Syntax of Scala For Syntax in detail please check the scala cheetsheet @ http://docs.scala- lang.org/cheatsheets/index.html Object Name Syntax Example
  • 18. Index ▪ Installation of Scala. ▪ Why Scala ? ▪ Interactive Mode & Script Mode ▪ Ease your work with tools ▪ Basic Syntax ▪ Collection in Scala ▪ ScalaTrait ▪ Scala Exception Handling ▪ Design Pattern in Scala ▪ Question/Query
  • 19. Introduction of String in Scala Group A • Task 1 • Task 2 Group B • Task 1 • Task 2 Group C • Task 1 ▪ First bullet point here ▪ Second bullet point here ▪ Third bullet point here
  • 20. Add a Slide Title - 1
  • 21. Add a Slide Title - 2
  • 22. Add a Slide Title - 3
  • 23.
  • 24. Add a Slide Title - 4