SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

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