SlideShare a Scribd company logo
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

More Related Content

What's hot

QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
Cognizant
 
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
Preeti 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 Coroutines
Roman Elizarov
 
Java 2
Java 2Java 2
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 Story
Tomer 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 useful
Frank van der Linden
 
JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual Machine
Manasvi 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 students
Partnered Health
 
Jvm Architecture
Jvm ArchitectureJvm Architecture
Jvm Architecture
ThirupathiReddy Vajjala
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
Abdelmonaim Remani
 
Dynamic Proxy by Java
Dynamic Proxy by JavaDynamic Proxy by Java
Dynamic Proxy by Java
Kan-Han (John) Lu
 
Ceylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudCeylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane Épardaud
UnFroMage
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
Pray Desai
 

What's hot (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
 

Viewers also liked

Political Cartoon
Political CartoonPolitical Cartoon
Political CartoonAmy
 
IGN's V3 API
IGN's V3 APIIGN's V3 API
IGN's V3 API
Manish Pandit
 
Google Chrome OS
Google Chrome OSGoogle Chrome OS
Google Chrome OS
Michele Pierangeli
 
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίαςπώς θα δημιουργήσετε ένα σενάριο διδασκαλίας
πώς θα δημιουργήσετε ένα σενάριο διδασκαλίαςChristos Gotzaridis
 
發音相似度最佳化
發音相似度最佳化發音相似度最佳化
發音相似度最佳化jyhuangtc
 
Future Agenda Future Of Connectivity
Future Agenda   Future Of ConnectivityFuture Agenda   Future Of Connectivity
Future Agenda Future Of Connectivity
Future Agenda
 
Future Agenda Future Of Work
Future Agenda   Future Of WorkFuture Agenda   Future Of Work
Future Agenda Future Of Work
Future 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 Food
Future Agenda
 
Where Media Meets Mobile May 2010
Where Media Meets Mobile   May 2010Where Media Meets Mobile   May 2010
Where Media Meets Mobile May 2010
Hugh Griffiths
 
Tuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLienTuinwedstrijd 2 inzending van LittleMissLien
Tuinwedstrijd 2 inzending van LittleMissLien
LittleMissLien
 
Future Agenda Future Of Water
Future Agenda   Future Of WaterFuture Agenda   Future Of Water
Future Agenda Future Of Water
Future Agenda
 
Phpカンファレンス関西2011 lt
Phpカンファレンス関西2011 ltPhpカンファレンス関西2011 lt
Phpカンファレンス関西2011 lt
Kaz Watanabe
 
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
οδηγιες & υλη φυσικων μαθηματων ημερ. και εσπ. γυμν. 2010 11
Christos 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 trends
dbyhundred
 

Viewers also liked (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
 

Similar to Java and the JVM

oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
sureshkumara29
 
CS8392 OOP
CS8392 OOPCS8392 OOP
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
Andrei Rinea
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
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 3rd
prat0ham
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
Aayush 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 Programming
Skillwise 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 GCD
Prashant Rane
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
Gal Marder
 
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptxchapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
FiromsaDine
 
Java JVM
Java JVMJava JVM
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
YakaviBalakrishnan
 
ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
MAYANKKUMAR492040
 
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
Metosin Oy
 

Similar to 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
 
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptxchapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
 
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
 

More from Manish Pandit

Disaster recovery - What, Why, and How
Disaster recovery - What, Why, and HowDisaster recovery - What, Why, and How
Disaster recovery - What, Why, and How
Manish 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 2018
Manish Pandit
 
Disaster Recovery and Reliability
Disaster Recovery and ReliabilityDisaster Recovery and Reliability
Disaster Recovery and Reliability
Manish Pandit
 
OAuth2 primer
OAuth2 primerOAuth2 primer
OAuth2 primer
Manish 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 Jenkins
Manish 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 Java
Manish Pandit
 
AWS Primer and Quickstart
AWS Primer and QuickstartAWS Primer and Quickstart
AWS Primer and Quickstart
Manish 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 Connect
Manish Pandit
 
Silicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API AntipatternsSilicon Valley 2014 - API Antipatterns
Silicon Valley 2014 - API Antipatterns
Manish Pandit
 
Scalabay - API Design Antipatterns
Scalabay - API Design AntipatternsScalabay - API Design Antipatterns
Scalabay - API Design Antipatterns
Manish 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 Netflix
Manish Pandit
 
API Design Antipatterns - APICon SF
API Design Antipatterns - APICon SFAPI Design Antipatterns - APICon SF
API Design Antipatterns - APICon SF
Manish Pandit
 
Motivation : it Matters
Motivation : it MattersMotivation : it Matters
Motivation : it Matters
Manish Pandit
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2
Manish Pandit
 
Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
Manish 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 IGN
Manish 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 Scala
Manish Pandit
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Manish 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 REST
Manish 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 MongoDB
Manish Pandit
 

More from 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
 

Recently uploaded

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

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