SlideShare une entreprise Scribd logo
1  sur  24
Java and the JVM



                Manish Pandit
              IGN Engineering
Java Echosystem
• Java as a programming language
• Java as runtime platform/virtual machine
• Java libraries (collections, database drivers..)
Java the programming language
•   Object Oriented
•   Multi-threaded, Concurrent
•   Strongly typed
•   Garbage collection
•   No multiple inheritance
•   2nd most popular language after C at 16%
IDEs
• Please, no vim, emacs, pico etc. I completely
  get it that you’re rock awesome when you
  code on the command line with these tools.
• The IDEs were built to make you productive.
• I use Eclipse, the team uses IntelliJ IDEA. Both
  are good.
• Use anything as long as it’s a real IDE
Code Organization
•   Package Declaration
•   Imports
•   Class or Interface Declaration
•   Members
    – Class variables
    – Methods
Imports
• To use classes from a binary distribution or
  source
• Can be wildcarded (discouraged)
• Auto cleanup – Eclipse Ctl-Shift-O
• Unused Imports
Packages
• To namespace the Class or Interface
• Act as modules containing groups of Classes or
  Interfaces
• Convention
  – dot-separated
  – com., net., sf., org.
• Can contain subpackages
• Packaging can impact visibility if default scope
  is used.
Classes
• Have to have the same file name as the public
  class
• May or may not be a part of a package
• Can be abstract or concrete and/or final
• Acts as a template to create Objects
Classes
• Have a constructor
  – Can be private (for singletons)
  – Default no-args constructor
  – Objects created by using new

     <T> varName = new <? extends T>(args);
     String myName = new String(“Manish”);
Control Structures
•   if-else
•   for loops
•   ternary operator (: ?)
•    while loops
•   switch/case
•   try/catch/finally
•   break/continue for loop control
Using this
• this provides a reference to the current
  instance
• Static members cannot use this, as they do
  not have instances (think Class, not Object)
Typed Collections and Classes
• Introduced in Java 1.5
• Add strong typing via declaration, so the
  compile time checks can be performed
• Syntax:
           Collection myCollection = new ArrayList<String>();
Annotations
• Declarative programming
  – @SuppressWarnings
  – @Override
  – @Deprecated
• Custom annotations
  – An annotation is an @interface
Threading
• Two ways
  – Implement Runnable Interface
  – Extend Thread class
• In both cases, you put the implementation in a
  method called run()
• A thread is started by instantiating the Thread
  and calling start() on it. Never call run()
  directly.
Concurrent Code
• synchornized method
  – Makes a method thread safe
  – You cannot synchronize a constructor
• synchronized block
  – You can acquire a lock on an object, and write
    your code as synchronized(lock) {…}
  – All synchronized methods of a class use the same
    lock if you use synchronize(this) so be careful!
Exceptions
• Checked
• Runtime
Dependency Injection
• Is used to specify dependencies at runtime,
  which get injected (instantiated, associated)
  on class initialization.
• Popular Frameworks
  – Spring DI
  – Google guice
• Declared via configuration, or annotations
Maven
• Maven (and Ant, and Gradle..) are build tools
  used to manage (large) java projects
• Helps manage dependencies declaratively
• Rich set of plugins to run tests, generate
  javadocs, build sites and artifacts
• Everything comes together in pom.xml file.
JVM
•   A very efficient, tuned virtual machine
•   Runs bytecode
•   Runtime garbage collection
•   Supports monitoring via JMX
•   Concurrent
•   Target VM for Groovy, Scala and Clojure
JVM Memory Model
• Heap
  – Where the instance, static variables and Objects
    go
  – Shared across all threads in the VM
  – Automatically garbage collected
• Stack
  – Where the methods and local variables go
  – Every thread gets its own stack
JVM Performance Management
•   Heap and stack sizes
•   GC algorithm tuning
•   Heap monitoring (jprofiler)
•   Deadlocks
•   JMX (jconsole)
Java Libraries
• Utilities
   – Apache Commons
   – JodaTime
   – Google collections
• Web Frameworks
   – JSF
   – Struts
• Application Frameworks
   – Spring
   – Play! Framework
Common java packages
Package           Description
Java.lang.*       Has the core classes like threading, runtime, Data types..
Java.net.*        Has networking classes and adapters (think URL)
Java.util.*       Hash Collections, Calendar, Time/Locale classes
Java.io.*         Has Stream and Buffer handling classes for I/O
Javax.swing.*     Thick Client (UI) classes
Further reading
• Javadocs
• Java Language Specification
• Wikipedia

Contenu connexe

Tendances

Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java coursePreeti Agarwal
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)Jadavsejal
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Lock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesLock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programmingLeah Stephens
 
Java 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala StoryJava 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala StoryTomer Gabel
 
Bccon use notes objects in memory and other useful
Bccon   use notes objects in memory and other usefulBccon   use notes objects in memory and other useful
Bccon use notes objects in memory and other usefulFrank van der Linden
 
JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual MachineManasvi Mehta
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT studentsPartnered Health
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling SoftwareAbdelmonaim Remani
 
Ceylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudCeylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudUnFroMage
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryPray Desai
 

Tendances (20)

QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
 
Java
JavaJava
Java
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
 
Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java course
 
JVM
JVMJVM
JVM
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
JAVA BYTE CODE
JAVA BYTE CODEJAVA BYTE CODE
JAVA BYTE CODE
 
Lock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin CoroutinesLock-free algorithms for Kotlin Coroutines
Lock-free algorithms for Kotlin Coroutines
 
Java 2
Java 2Java 2
Java 2
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programming
 
Java 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala StoryJava 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala Story
 
Bccon use notes objects in memory and other useful
Bccon   use notes objects in memory and other usefulBccon   use notes objects in memory and other useful
Bccon use notes objects in memory and other useful
 
JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual Machine
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Jvm Architecture
Jvm ArchitectureJvm Architecture
Jvm Architecture
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
 
Dynamic Proxy by Java
Dynamic Proxy by JavaDynamic Proxy by Java
Dynamic Proxy by Java
 
Ceylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudCeylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane Épardaud
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 

En vedette

Political Cartoon
Political CartoonPolitical Cartoon
Political CartoonAmy
 
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίαςπώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίαςChristos Gotzaridis
 
發音相似度最佳化
發音相似度最佳化發音相似度最佳化
發音相似度最佳化jyhuangtc
 
Future Agenda Future Of Connectivity
Future Agenda   Future Of ConnectivityFuture Agenda   Future Of Connectivity
Future Agenda Future Of ConnectivityFuture Agenda
 
Future Agenda Future Of Work
Future Agenda   Future Of WorkFuture Agenda   Future Of Work
Future Agenda Future Of WorkFuture Agenda
 
Pp Kee Guard Web
Pp Kee Guard WebPp Kee Guard Web
Pp Kee Guard WebKee Safety
 
Animatic Feedbac Kf
Animatic Feedbac KfAnimatic Feedbac Kf
Animatic Feedbac Kf3246
 
Tet Powerpoint
Tet PowerpointTet Powerpoint
Tet PowerpointAmber08
 
Future Agenda Future Of Food
Future Agenda   Future Of FoodFuture Agenda   Future Of Food
Future Agenda Future Of FoodFuture Agenda
 
Where Media Meets Mobile May 2010
Where Media Meets Mobile   May 2010Where Media Meets Mobile   May 2010
Where Media Meets Mobile May 2010Hugh Griffiths
 
Tuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLienTuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLienLittleMissLien
 
Future Agenda Future Of Water
Future Agenda   Future Of WaterFuture Agenda   Future Of Water
Future Agenda Future Of WaterFuture Agenda
 
Phpカンファレンス関西2011 lt
Phpカンファレンス関西2011 ltPhpカンファレンス関西2011 lt
Phpカンファレンス関西2011 ltKaz Watanabe
 
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11Christos Gotzaridis
 
Filming- Day One
Filming- Day OneFilming- Day One
Filming- Day One3246
 
20151123 a future resilient – tracking the trends
20151123 a future resilient – tracking the trends20151123 a future resilient – tracking the trends
20151123 a future resilient – tracking the trendsdbyhundred
 

En vedette (20)

Political Cartoon
Political CartoonPolitical Cartoon
Political Cartoon
 
IGN's V3 API
IGN's V3 APIIGN's V3 API
IGN's V3 API
 
Google Chrome OS
Google Chrome OSGoogle Chrome OS
Google Chrome OS
 
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίαςπώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
 
發音相似度最佳化
發音相似度最佳化發音相似度最佳化
發音相似度最佳化
 
Acacia Research and Learning Forum Tutorial 2
Acacia Research and Learning Forum Tutorial 2Acacia Research and Learning Forum Tutorial 2
Acacia Research and Learning Forum Tutorial 2
 
Future Agenda Future Of Connectivity
Future Agenda   Future Of ConnectivityFuture Agenda   Future Of Connectivity
Future Agenda Future Of Connectivity
 
Future Agenda Future Of Work
Future Agenda   Future Of WorkFuture Agenda   Future Of Work
Future Agenda Future Of Work
 
Pp Kee Guard Web
Pp Kee Guard WebPp Kee Guard Web
Pp Kee Guard Web
 
Animatic Feedbac Kf
Animatic Feedbac KfAnimatic Feedbac Kf
Animatic Feedbac Kf
 
Tet Powerpoint
Tet PowerpointTet Powerpoint
Tet Powerpoint
 
Future Agenda Future Of Food
Future Agenda   Future Of FoodFuture Agenda   Future Of Food
Future Agenda Future Of Food
 
Where Media Meets Mobile May 2010
Where Media Meets Mobile   May 2010Where Media Meets Mobile   May 2010
Where Media Meets Mobile May 2010
 
Tuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLienTuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLien
 
Future Agenda Future Of Water
Future Agenda   Future Of WaterFuture Agenda   Future Of Water
Future Agenda Future Of Water
 
Phpカンファレンス関西2011 lt
Phpカンファレンス関西2011 ltPhpカンファレンス関西2011 lt
Phpカンファレンス関西2011 lt
 
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
 
Filming- Day One
Filming- Day OneFilming- Day One
Filming- Day One
 
Compu Lawye Rlucy
Compu Lawye RlucyCompu Lawye Rlucy
Compu Lawye Rlucy
 
20151123 a future resilient – tracking the trends
20151123 a future resilient – tracking the trends20151123 a future resilient – tracking the trends
20151123 a future resilient – tracking the trends
 

Similaire à Java and the JVM

Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developersAndrei Rinea
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
OOP with Java
OOP with JavaOOP with Java
OOP with JavaOmegaHub
 
Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Martijn Verburg
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdprat0ham
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptAayush Chimaniya
 
Learning from "Effective Scala"
Learning from "Effective Scala"Learning from "Effective Scala"
Learning from "Effective Scala"Kazuhiro Sera
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and FallaciesRoman Elizarov
 
Skillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Group
 
Playing with Java Classes and Bytecode
Playing with Java Classes and BytecodePlaying with Java Classes and Bytecode
Playing with Java Classes and BytecodeYoav Avrahami
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPrashant Rane
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Metosin Oy
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptAliyaJav
 

Similaire à Java and the JVM (20)

oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
 
Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
 
Learning from "Effective Scala"
Learning from "Effective Scala"Learning from "Effective Scala"
Learning from "Effective Scala"
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
 
Skillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Elementary Java Programming
Skillwise Elementary Java Programming
 
Playing with Java Classes and Bytecode
Playing with Java Classes and BytecodePlaying with Java Classes and Bytecode
Playing with Java Classes and Bytecode
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
gcdtmp
gcdtmpgcdtmp
gcdtmp
 
Java JVM
Java JVMJava JVM
Java JVM
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
 
ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).ppt
 

Plus de Manish Pandit

Disaster recovery - What, Why, and How
Disaster recovery - What, Why, and HowDisaster recovery - What, Why, and How
Disaster recovery - What, Why, and HowManish Pandit
 
Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018Manish Pandit
 
Disaster Recovery and Reliability
Disaster Recovery and ReliabilityDisaster Recovery and Reliability
Disaster Recovery and ReliabilityManish Pandit
 
Immutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsImmutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsManish Pandit
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaManish Pandit
 
AWS Primer and Quickstart
AWS Primer and QuickstartAWS Primer and Quickstart
AWS Primer and QuickstartManish Pandit
 
Securing your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID ConnectSecuring your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID ConnectManish Pandit
 
Silicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API AntipatternsSilicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API AntipatternsManish Pandit
 
Scalabay - API Design Antipatterns
Scalabay - API Design AntipatternsScalabay - API Design Antipatterns
Scalabay - API Design AntipatternsManish Pandit
 
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixManish Pandit
 
API Design Antipatterns - APICon SF
API Design Antipatterns - APICon SFAPI Design Antipatterns - APICon SF
API Design Antipatterns - APICon SFManish Pandit
 
Motivation : it Matters
Motivation : it MattersMotivation : it Matters
Motivation : it MattersManish Pandit
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Manish Pandit
 
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGNIntroducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGNManish Pandit
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with ScalaManish Pandit
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingManish Pandit
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTManish Pandit
 
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBSilicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBManish Pandit
 

Plus de Manish Pandit (20)

Disaster recovery - What, Why, and How
Disaster recovery - What, Why, and HowDisaster recovery - What, Why, and How
Disaster recovery - What, Why, and How
 
Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018Serverless Architectures on AWS in practice - OSCON 2018
Serverless Architectures on AWS in practice - OSCON 2018
 
Disaster Recovery and Reliability
Disaster Recovery and ReliabilityDisaster Recovery and Reliability
Disaster Recovery and Reliability
 
OAuth2 primer
OAuth2 primerOAuth2 primer
OAuth2 primer
 
Immutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsImmutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and Jenkins
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
 
AWS Primer and Quickstart
AWS Primer and QuickstartAWS Primer and Quickstart
AWS Primer and Quickstart
 
Securing your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID ConnectSecuring your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID Connect
 
Silicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API AntipatternsSilicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API Antipatterns
 
Scalabay - API Design Antipatterns
Scalabay - API Design AntipatternsScalabay - API Design Antipatterns
Scalabay - API Design Antipatterns
 
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
 
API Design Antipatterns - APICon SF
API Design Antipatterns - APICon SFAPI Design Antipatterns - APICon SF
API Design Antipatterns - APICon SF
 
Motivation : it Matters
Motivation : it MattersMotivation : it Matters
Motivation : it Matters
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2
 
Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
 
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGNIntroducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with Scala
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you REST
 
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBSilicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDB
 

Dernier

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Dernier (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Java and the JVM

  • 1. Java and the JVM Manish Pandit IGN Engineering
  • 2. Java Echosystem • Java as a programming language • Java as runtime platform/virtual machine • Java libraries (collections, database drivers..)
  • 3. Java the programming language • Object Oriented • Multi-threaded, Concurrent • Strongly typed • Garbage collection • No multiple inheritance • 2nd most popular language after C at 16%
  • 4. IDEs • Please, no vim, emacs, pico etc. I completely get it that you’re rock awesome when you code on the command line with these tools. • The IDEs were built to make you productive. • I use Eclipse, the team uses IntelliJ IDEA. Both are good. • Use anything as long as it’s a real IDE
  • 5. Code Organization • Package Declaration • Imports • Class or Interface Declaration • Members – Class variables – Methods
  • 6. Imports • To use classes from a binary distribution or source • Can be wildcarded (discouraged) • Auto cleanup – Eclipse Ctl-Shift-O • Unused Imports
  • 7. Packages • To namespace the Class or Interface • Act as modules containing groups of Classes or Interfaces • Convention – dot-separated – com., net., sf., org. • Can contain subpackages • Packaging can impact visibility if default scope is used.
  • 8. Classes • Have to have the same file name as the public class • May or may not be a part of a package • Can be abstract or concrete and/or final • Acts as a template to create Objects
  • 9. Classes • Have a constructor – Can be private (for singletons) – Default no-args constructor – Objects created by using new <T> varName = new <? extends T>(args); String myName = new String(“Manish”);
  • 10. Control Structures • if-else • for loops • ternary operator (: ?) • while loops • switch/case • try/catch/finally • break/continue for loop control
  • 11. Using this • this provides a reference to the current instance • Static members cannot use this, as they do not have instances (think Class, not Object)
  • 12. Typed Collections and Classes • Introduced in Java 1.5 • Add strong typing via declaration, so the compile time checks can be performed • Syntax: Collection myCollection = new ArrayList<String>();
  • 13. Annotations • Declarative programming – @SuppressWarnings – @Override – @Deprecated • Custom annotations – An annotation is an @interface
  • 14. Threading • Two ways – Implement Runnable Interface – Extend Thread class • In both cases, you put the implementation in a method called run() • A thread is started by instantiating the Thread and calling start() on it. Never call run() directly.
  • 15. Concurrent Code • synchornized method – Makes a method thread safe – You cannot synchronize a constructor • synchronized block – You can acquire a lock on an object, and write your code as synchronized(lock) {…} – All synchronized methods of a class use the same lock if you use synchronize(this) so be careful!
  • 17. Dependency Injection • Is used to specify dependencies at runtime, which get injected (instantiated, associated) on class initialization. • Popular Frameworks – Spring DI – Google guice • Declared via configuration, or annotations
  • 18. Maven • Maven (and Ant, and Gradle..) are build tools used to manage (large) java projects • Helps manage dependencies declaratively • Rich set of plugins to run tests, generate javadocs, build sites and artifacts • Everything comes together in pom.xml file.
  • 19. JVM • A very efficient, tuned virtual machine • Runs bytecode • Runtime garbage collection • Supports monitoring via JMX • Concurrent • Target VM for Groovy, Scala and Clojure
  • 20. JVM Memory Model • Heap – Where the instance, static variables and Objects go – Shared across all threads in the VM – Automatically garbage collected • Stack – Where the methods and local variables go – Every thread gets its own stack
  • 21. JVM Performance Management • Heap and stack sizes • GC algorithm tuning • Heap monitoring (jprofiler) • Deadlocks • JMX (jconsole)
  • 22. Java Libraries • Utilities – Apache Commons – JodaTime – Google collections • Web Frameworks – JSF – Struts • Application Frameworks – Spring – Play! Framework
  • 23. Common java packages Package Description Java.lang.* Has the core classes like threading, runtime, Data types.. Java.net.* Has networking classes and adapters (think URL) Java.util.* Hash Collections, Calendar, Time/Locale classes Java.io.* Has Stream and Buffer handling classes for I/O Javax.swing.* Thick Client (UI) classes
  • 24. Further reading • Javadocs • Java Language Specification • Wikipedia