SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Disclaimer

-  The views expressed in this presentation are my personal
   views.


-  Any opinions, comments, solutions or other commentary
   expressed by me are based on my experience.


-  This presentation is presented for educational purposes
   and is therefore supplementary and not to be considered
   exhaustive.



                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Building
Swing vs. Android
  Applications
                    By Johnny Hujol
Who am I

-  A French leaving in Boston.
-  Software Engineer for a US pharmaceuticals company.

-  10+ years in Biotech/Pharmaceuticals sector developing
   scientific applications.
-  10+ years in Java.
-  1+ year in Android.

-  Co-published book on Java called
‘Java for Bioinformatics and Biomedical Applications’.

•  10+ years kitesurfing 
•  4th time in Taiba, Ceara, Brasil.
                              Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Agenda

-  History

-  Swing Application

-  Android Application

-  Development Environment

-  Comparison

-  Building Applications

-  Conclusion

                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
History

-  1995: Oak (Java) was released for Sun machines.

-  1996: Java 1 initial release.

-  1998: Swing part of JDK 1.2.

-  September 23, 2008: Android 1.0.

-  July 28, 2011: JSE 7.0.

-  October 2011: Android 4.0 (Ice Cream Sandwich).


                             Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App




            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App - Anatomy

-  JFrame, JButton, custom Java classes, events,
   exceptions, etc.

-  Implement algorithms, business rules, etc.

-  Connect to some storage to deal with data i.e. database,
   web service, file system, memory, etc.

-  Might have multiple background tasks running.

-  Offline or online app.

-  Goal: help people to do things better.
                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App - Life Cycle

-  Main() method as starting point of program.




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App – Multi-Threaded

-  A Swing application is multi-threaded by nature.

-  Single thread model for Event Dispatching Thread (EDT).

-  Importance of (EDT) for UI responsiveness.

-  EventQueue.invokeLater(Runnable).

-  SwingWorker doInBackground() and done().




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App – Multi-Threaded




                Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App – Multi-Threaded

-  Do heavy work in the background.

-  More fine and advanced control with java.util.concurrent
   package.

-  Executors to do background works to keep UI responsive.

-  FutureTask (java.util.concurrent).




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App – Multi-Threaded




                Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App - More

-  Exception handling policy based on requirements.

-  Custom exceptions.

-  Asynchronous messaging mechanism with java.awt.event
   i.e. event classes and listener classes.

-  System events i.e. MouseEvent, KeyboardEvent, screen,
   etc.

-  Semantic events i.e. ActionEvent, TextEvent, etc.

-  Events are always fired in the EDT.
                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Swing App – And More

-  Internationalization.

-  2D/3D/OpenGL, Media APIs, etc…

-  Debugging tools.

-  Logging, Tests, Profiling APIs.

-  Compilers, JVMs.

-  Encryption.

-  More…
                             Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android Application




                 Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - Anatomy

-  Activity, TextView, custom Java classes, exceptions, etc.

-  Implement algorithms, business rules, etc.

-  Connect to some storage to deal with data i.e. database,
   web service, file system, SD card, etc.

-  Might have multiple background tasks running.

-  Offline or online app.

-  Goal: help people to do things better.

                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - Components

-  Activity = UI.

-  Service = background tasks.

-  Content Provider: sharing data uniformly from multiple
   apps.

-  Broadcast receiver = big announcer across components or
   apps i.e. a broader event mechanism.




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App – Life Cycle

-  Components Life Cycle well defined.

-  Activity (UI) starts with onCreate() in UI thread.




-  Visible lifetime between onStart() and onStop().

-  Foreground lifetime between onResume() and onPause().

                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App – Activity




                 Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - Multi-Threaded

-  Single thread model for UI toolkit.

-  The Andoid UI toolkit is not thread-safe.

-  Do not block the UI thread.

-  Do not access the Android UI toolkit outside the UI
   thread.




                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - Multi-Threaded

-  Activity.runOnUiThread(Runnable)




-  View.post(Runnable)

-  View.postDelayed(Runnable, long)

                          Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - Multi-Threaded

-  AsyncTask similar to SwingWorker.




-  Package java.util.concurrent for Executors, etc.



                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App - More

-  Exception handling policy based on requirements.

-  Custom exceptions.

-  Separation of layout from UI logic with XML.

-  Notifications with Toast, Status Bar and Progress.

-  Listeners.

-  Sensor APIs for GPS, camera, telephony, accelerometer,
   etc.

                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Android App – And More

-  Internalionalization.

-  2D/3D, OpenGL, etc.

-  Database, SD card, FS access.

-  Configuration for multiple device specs.

-  Encryption.

-  And More…


                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Questions so far?




      Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Development Environment

-  I use IntelliJ IDEA for Swing and Android apps.

-  Ant.

-  Android command line to build initial Android project.

-  Adb for interacting with USB plugged devices.

-  XML layout profiler with Hierarchy Viewer.

-  Android project libraries to share between apps.


                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Development Environment

-  LogCat.

-  Junit for testing, logging APIs.

-  Monkey and monkeyrunner.

-  Emulator.

-  SensorSimulator.

-  AndroidScreencast.


                             Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Development Environment




               Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Life Cycle

-  Life Cycle for Android is well defined.

-  All Android activities changes through states the same
   way.

-  Save/restore state in the foreground lifetime onResume()
   and onPause().

-  Important to release resources and kill background tasks
   when going on onPause().

-  Save state in onPause() needs to execute quickly.

                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Life Cycle

-  Cannot ‘quit’ an Android application.

-  Allow fast switching to Android apps.

-  Users use many apps back and forth.

-  Similar to opening lots of apps on computer when
   working.




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Multi-Threaded

-  Transfer knowledge of Swing multi-threaded apps.

-  Less frequent cases on Android apps than Swing apps.

-  Simpler Android apps = less synchronization.

-  New methods runOnUiThread, AsyncTack (SwingWorker).

-  Cancelling policy more important on Android apps.

-  Does user allow background services.


                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Storage

-  API for local Database (DB) like SQLLite.

-  API for Web Services like Amazon S3.

-  File System (FS) on device or remote.

-  Harder to test web services on the emulator.




                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Storage

-  Internal storage with Context class.



-  External storage i.e. SD card.




                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Device Resources

-  Battery is the most precious resource on Android devices.

-  Do not write intensive computation in the background.

-  Screen size very small with 2 mode landscape & portrait.

-  Memory because no ‘quit’ manage the listeners i.e. like
   GPS location manager, etc.




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Device Resources

-  Code impact on memory.

-  Extends listener instead of creating inner class.




-  Use primitive int instead of Enum class = less memory.



                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Network

-  Checking availability.




                            Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Development Cycle

-  Emulator might not be consistent to real device.

-  Test directly on device more than emulator.

-  Faster release because less features.

-  Simpler application architecture on Android.

-  Send logging info to network.

-  Once deployed on production harder to debug.


                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Comparison – Sensors

-  Native support on Android devices.

-  Available on Swing through integration.

-  Can have different specs depending on device.

-  Getting easier with WiFi-Direct, Bluetooth, etc.

-  Location based application more natural on Android.




                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Questions so far?




      Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Building Apps

-  Mobile nature of Android apps.

-  New mobile paradigms to manipulate UI.

-  Swing will adopt mobile paradigms.

-  Android devices, computers and the cloud.

-  Component model of Android apps.

-  Similarity between 2 platforms.


                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Building Apps - Architecture

-  Importance of separation of UI, business logic and storage
   in design of an app.

-  Can reuse non-UI logic from Swing i.e. Data Access
   Object, etc.

-  Easier to build an Android app from a multi-tier Swing
   apps, no need to test business logic again.

-  Allow offline vs. online mode.

-  Develop and reuse libraries.

                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Building Apps - Software Engineering

-  Get your users involved.

-  Deploy often.

-  Continuously testing the system.

-  Design Patterns.

-  Design for reusability and maintenance.

-  Network back-end for intensive computation tasks.

-  Use primitive int in Android apps.
                              Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Building Apps - Assurance Quality

-  Mock, Unit Test, MonkeyTest (Android), etc.

-  Code static analysis.

-  Use code reviews.

-  Performance on memory with profiler.

-  Multi-threaded apps easier on Android.

-  Use logging API.


                           Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Conclusion

-  Easy transition from Swing to/from Android.

-  Faster to develop Android app.

-  Well defined Life Cycle of Android app.

-  Keep a design of apps simple.

-  Allow offline and online mode for apps.

-  Design apps more in a mobile way.

-  Cloud based applications.
                               Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
Questions & Answers




       Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
References

•  Android
  –  http://developer.android.com


•  Screencast
  –  http://code.google.com/p/androidscreencast/



•  SensorSimulator
  –  http://code.google.com/p/openintents/wiki/SensorSimulator

•  Android Way on Multitasking
  -  http://developer.android.com/resources/articles/multitasking-android-way.html




                                          Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09

Contenu connexe

Tendances

02 Chromosomes, Genes & Alleles
02 Chromosomes, Genes & Alleles02 Chromosomes, Genes & Alleles
02 Chromosomes, Genes & AllelesMartin Jellinek
 
Bioinformatics & its scope in biotech.
Bioinformatics & its scope in biotech.Bioinformatics & its scope in biotech.
Bioinformatics & its scope in biotech.Muhammad Hunan Faiz
 
Introduction, importance and Scope of horticulture.pptx
Introduction, importance and Scope of horticulture.pptxIntroduction, importance and Scope of horticulture.pptx
Introduction, importance and Scope of horticulture.pptxvinaynd
 
Presentation on Difference between GISH and FISH
Presentation on Difference between GISH and FISHPresentation on Difference between GISH and FISH
Presentation on Difference between GISH and FISHDr. Kaushik Kumar Panigrahi
 
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crosses
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crossesConjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crosses
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crossesSivasangari Shanmugam
 
Dolly the sheep
Dolly the sheepDolly the sheep
Dolly the sheepharshu18
 
XX-XO Sex Determination
XX-XO Sex DeterminationXX-XO Sex Determination
XX-XO Sex DeterminationAsr Cv
 
History of Biotechnology
History of BiotechnologyHistory of Biotechnology
History of BiotechnologyDwayne Squires
 
Transposable elements
Transposable elementsTransposable elements
Transposable elementsRajwantiSaran
 
Recombinant dna technology
Recombinant dna technologyRecombinant dna technology
Recombinant dna technologynasira jaffry
 
Introduction to Biotechnology
Introduction to BiotechnologyIntroduction to Biotechnology
Introduction to BiotechnologyTrixie Piloton
 
History and scope in bioinformatics
History and scope in bioinformaticsHistory and scope in bioinformatics
History and scope in bioinformaticsKAUSHAL SAHU
 
Semiconservative replication
Semiconservative replicationSemiconservative replication
Semiconservative replicationSyedaSadafWajahat
 

Tendances (20)

02 Chromosomes, Genes & Alleles
02 Chromosomes, Genes & Alleles02 Chromosomes, Genes & Alleles
02 Chromosomes, Genes & Alleles
 
Plant Tissue Culture
Plant Tissue CulturePlant Tissue Culture
Plant Tissue Culture
 
Dna shuffling
Dna shufflingDna shuffling
Dna shuffling
 
FLAVR SAVR tomato.pptx
FLAVR SAVR tomato.pptxFLAVR SAVR tomato.pptx
FLAVR SAVR tomato.pptx
 
Primary and Secondary Cell Line
Primary and Secondary Cell LinePrimary and Secondary Cell Line
Primary and Secondary Cell Line
 
Bioinformatics & its scope in biotech.
Bioinformatics & its scope in biotech.Bioinformatics & its scope in biotech.
Bioinformatics & its scope in biotech.
 
Introduction, importance and Scope of horticulture.pptx
Introduction, importance and Scope of horticulture.pptxIntroduction, importance and Scope of horticulture.pptx
Introduction, importance and Scope of horticulture.pptx
 
Presentation on Difference between GISH and FISH
Presentation on Difference between GISH and FISHPresentation on Difference between GISH and FISH
Presentation on Difference between GISH and FISH
 
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crosses
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crossesConjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crosses
Conjugation: Discovery, F+, F- and Hfr conjugation, F- genetic crosses
 
Dolly the sheep
Dolly the sheepDolly the sheep
Dolly the sheep
 
Genetic engineering
Genetic engineeringGenetic engineering
Genetic engineering
 
XX-XO Sex Determination
XX-XO Sex DeterminationXX-XO Sex Determination
XX-XO Sex Determination
 
History of Biotechnology
History of BiotechnologyHistory of Biotechnology
History of Biotechnology
 
Gene transformation methods
Gene transformation methodsGene transformation methods
Gene transformation methods
 
Transposable elements
Transposable elementsTransposable elements
Transposable elements
 
Recombinant dna technology
Recombinant dna technologyRecombinant dna technology
Recombinant dna technology
 
Introduction to Biotechnology
Introduction to BiotechnologyIntroduction to Biotechnology
Introduction to Biotechnology
 
History and scope in bioinformatics
History and scope in bioinformaticsHistory and scope in bioinformatics
History and scope in bioinformatics
 
Semiconservative replication
Semiconservative replicationSemiconservative replication
Semiconservative replication
 
Anther culture & its importance in vegetable crops
Anther culture & its importance in vegetable cropsAnther culture & its importance in vegetable crops
Anther culture & its importance in vegetable crops
 

Similaire à Building Swing and Android Apps

Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 mayLuciano Amodio
 
NaazAfrinResume (2)
NaazAfrinResume (2)NaazAfrinResume (2)
NaazAfrinResume (2)Naaz Afrin
 
UrvashiShrivastavaResumeLatest2017
UrvashiShrivastavaResumeLatest2017UrvashiShrivastavaResumeLatest2017
UrvashiShrivastavaResumeLatest2017Urvashi Shrivastava
 
Videogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha TouchVideogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha TouchAlexander Wilhelm
 
Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Kenneth van Rumste
 
Mobile web application development
Mobile web application developmentMobile web application development
Mobile web application developmentVince Aggrippino
 
Gnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Bocha
 
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARIMOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARISivaSankari36
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011sullis
 
NaazAfrinResume (2)
NaazAfrinResume (2)NaazAfrinResume (2)
NaazAfrinResume (2)Naaz Afrin
 
Karthik Balasubramanian (Resume)
Karthik Balasubramanian (Resume)Karthik Balasubramanian (Resume)
Karthik Balasubramanian (Resume)karthik_bala
 
Python for the Mobile and Web
Python for the Mobile and WebPython for the Mobile and Web
Python for the Mobile and WebDerek Kiong
 
Cross platform app a comparative study
Cross platform app  a comparative studyCross platform app  a comparative study
Cross platform app a comparative studyijcsit
 
Research on Comparative Study of Different Mobile Operating System_Part-2
Research on Comparative Study of Different Mobile Operating System_Part-2Research on Comparative Study of Different Mobile Operating System_Part-2
Research on Comparative Study of Different Mobile Operating System_Part-2Zulkar Naim
 
iOS vs android .pptx
iOS  vs android .pptxiOS  vs android .pptx
iOS vs android .pptxabid masood
 

Similaire à Building Swing and Android Apps (20)

Ramesh iOS Profile
Ramesh iOS ProfileRamesh iOS Profile
Ramesh iOS Profile
 
Projects
ProjectsProjects
Projects
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 
NaazAfrinResume (2)
NaazAfrinResume (2)NaazAfrinResume (2)
NaazAfrinResume (2)
 
UrvashiShrivastavaResumeLatest2017
UrvashiShrivastavaResumeLatest2017UrvashiShrivastavaResumeLatest2017
UrvashiShrivastavaResumeLatest2017
 
Videogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha TouchVideogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha Touch
 
Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011
 
Mobile web application development
Mobile web application developmentMobile web application development
Mobile web application development
 
Gnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 years
 
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARIMOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
 
Resume
ResumeResume
Resume
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
NaazAfrinResume (2)
NaazAfrinResume (2)NaazAfrinResume (2)
NaazAfrinResume (2)
 
Karthik Balasubramanian (Resume)
Karthik Balasubramanian (Resume)Karthik Balasubramanian (Resume)
Karthik Balasubramanian (Resume)
 
Python for the Mobile and Web
Python for the Mobile and WebPython for the Mobile and Web
Python for the Mobile and Web
 
Cross platform app a comparative study
Cross platform app  a comparative studyCross platform app  a comparative study
Cross platform app a comparative study
 
Ravi Sundriyal
Ravi SundriyalRavi Sundriyal
Ravi Sundriyal
 
Research on Comparative Study of Different Mobile Operating System_Part-2
Research on Comparative Study of Different Mobile Operating System_Part-2Research on Comparative Study of Different Mobile Operating System_Part-2
Research on Comparative Study of Different Mobile Operating System_Part-2
 
iOS vs android .pptx
iOS  vs android .pptxiOS  vs android .pptx
iOS vs android .pptx
 
Android
AndroidAndroid
Android
 

Dernier

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.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
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Dernier (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
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
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.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)
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Building Swing and Android Apps

  • 1. Disclaimer -  The views expressed in this presentation are my personal views. -  Any opinions, comments, solutions or other commentary expressed by me are based on my experience. -  This presentation is presented for educational purposes and is therefore supplementary and not to be considered exhaustive. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 2. Building Swing vs. Android Applications By Johnny Hujol
  • 3. Who am I -  A French leaving in Boston. -  Software Engineer for a US pharmaceuticals company. -  10+ years in Biotech/Pharmaceuticals sector developing scientific applications. -  10+ years in Java. -  1+ year in Android. -  Co-published book on Java called ‘Java for Bioinformatics and Biomedical Applications’. •  10+ years kitesurfing  •  4th time in Taiba, Ceara, Brasil. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 4. Agenda -  History -  Swing Application -  Android Application -  Development Environment -  Comparison -  Building Applications -  Conclusion Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 5. History -  1995: Oak (Java) was released for Sun machines. -  1996: Java 1 initial release. -  1998: Swing part of JDK 1.2. -  September 23, 2008: Android 1.0. -  July 28, 2011: JSE 7.0. -  October 2011: Android 4.0 (Ice Cream Sandwich). Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 6. Swing App Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 7. Swing App - Anatomy -  JFrame, JButton, custom Java classes, events, exceptions, etc. -  Implement algorithms, business rules, etc. -  Connect to some storage to deal with data i.e. database, web service, file system, memory, etc. -  Might have multiple background tasks running. -  Offline or online app. -  Goal: help people to do things better. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 8. Swing App - Life Cycle -  Main() method as starting point of program. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 9. Swing App – Multi-Threaded -  A Swing application is multi-threaded by nature. -  Single thread model for Event Dispatching Thread (EDT). -  Importance of (EDT) for UI responsiveness. -  EventQueue.invokeLater(Runnable). -  SwingWorker doInBackground() and done(). Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 10. Swing App – Multi-Threaded Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 11. Swing App – Multi-Threaded -  Do heavy work in the background. -  More fine and advanced control with java.util.concurrent package. -  Executors to do background works to keep UI responsive. -  FutureTask (java.util.concurrent). Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 12. Swing App – Multi-Threaded Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 13. Swing App - More -  Exception handling policy based on requirements. -  Custom exceptions. -  Asynchronous messaging mechanism with java.awt.event i.e. event classes and listener classes. -  System events i.e. MouseEvent, KeyboardEvent, screen, etc. -  Semantic events i.e. ActionEvent, TextEvent, etc. -  Events are always fired in the EDT. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 14. Swing App – And More -  Internationalization. -  2D/3D/OpenGL, Media APIs, etc… -  Debugging tools. -  Logging, Tests, Profiling APIs. -  Compilers, JVMs. -  Encryption. -  More… Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 15. Android Application Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 16. Android App - Anatomy -  Activity, TextView, custom Java classes, exceptions, etc. -  Implement algorithms, business rules, etc. -  Connect to some storage to deal with data i.e. database, web service, file system, SD card, etc. -  Might have multiple background tasks running. -  Offline or online app. -  Goal: help people to do things better. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 17. Android App - Components -  Activity = UI. -  Service = background tasks. -  Content Provider: sharing data uniformly from multiple apps. -  Broadcast receiver = big announcer across components or apps i.e. a broader event mechanism. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 18. Android App – Life Cycle -  Components Life Cycle well defined. -  Activity (UI) starts with onCreate() in UI thread. -  Visible lifetime between onStart() and onStop(). -  Foreground lifetime between onResume() and onPause(). Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 19. Android App – Activity Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 20. Android App - Multi-Threaded -  Single thread model for UI toolkit. -  The Andoid UI toolkit is not thread-safe. -  Do not block the UI thread. -  Do not access the Android UI toolkit outside the UI thread. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 21. Android App - Multi-Threaded -  Activity.runOnUiThread(Runnable) -  View.post(Runnable) -  View.postDelayed(Runnable, long) Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 22. Android App - Multi-Threaded -  AsyncTask similar to SwingWorker. -  Package java.util.concurrent for Executors, etc. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 23. Android App - More -  Exception handling policy based on requirements. -  Custom exceptions. -  Separation of layout from UI logic with XML. -  Notifications with Toast, Status Bar and Progress. -  Listeners. -  Sensor APIs for GPS, camera, telephony, accelerometer, etc. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 24. Android App – And More -  Internalionalization. -  2D/3D, OpenGL, etc. -  Database, SD card, FS access. -  Configuration for multiple device specs. -  Encryption. -  And More… Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 25. Questions so far? Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 26. Development Environment -  I use IntelliJ IDEA for Swing and Android apps. -  Ant. -  Android command line to build initial Android project. -  Adb for interacting with USB plugged devices. -  XML layout profiler with Hierarchy Viewer. -  Android project libraries to share between apps. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 27. Development Environment -  LogCat. -  Junit for testing, logging APIs. -  Monkey and monkeyrunner. -  Emulator. -  SensorSimulator. -  AndroidScreencast. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 28. Development Environment Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 29. Comparison – Life Cycle -  Life Cycle for Android is well defined. -  All Android activities changes through states the same way. -  Save/restore state in the foreground lifetime onResume() and onPause(). -  Important to release resources and kill background tasks when going on onPause(). -  Save state in onPause() needs to execute quickly. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 30. Comparison – Life Cycle -  Cannot ‘quit’ an Android application. -  Allow fast switching to Android apps. -  Users use many apps back and forth. -  Similar to opening lots of apps on computer when working. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 31. Comparison – Multi-Threaded -  Transfer knowledge of Swing multi-threaded apps. -  Less frequent cases on Android apps than Swing apps. -  Simpler Android apps = less synchronization. -  New methods runOnUiThread, AsyncTack (SwingWorker). -  Cancelling policy more important on Android apps. -  Does user allow background services. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 32. Comparison – Storage -  API for local Database (DB) like SQLLite. -  API for Web Services like Amazon S3. -  File System (FS) on device or remote. -  Harder to test web services on the emulator. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 33. Comparison – Storage -  Internal storage with Context class. -  External storage i.e. SD card. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 34. Comparison – Device Resources -  Battery is the most precious resource on Android devices. -  Do not write intensive computation in the background. -  Screen size very small with 2 mode landscape & portrait. -  Memory because no ‘quit’ manage the listeners i.e. like GPS location manager, etc. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 35. Comparison – Device Resources -  Code impact on memory. -  Extends listener instead of creating inner class. -  Use primitive int instead of Enum class = less memory. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 36. Comparison – Network -  Checking availability. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 37. Comparison – Development Cycle -  Emulator might not be consistent to real device. -  Test directly on device more than emulator. -  Faster release because less features. -  Simpler application architecture on Android. -  Send logging info to network. -  Once deployed on production harder to debug. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 38. Comparison – Sensors -  Native support on Android devices. -  Available on Swing through integration. -  Can have different specs depending on device. -  Getting easier with WiFi-Direct, Bluetooth, etc. -  Location based application more natural on Android. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 39. Questions so far? Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 40. Building Apps -  Mobile nature of Android apps. -  New mobile paradigms to manipulate UI. -  Swing will adopt mobile paradigms. -  Android devices, computers and the cloud. -  Component model of Android apps. -  Similarity between 2 platforms. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 41. Building Apps - Architecture -  Importance of separation of UI, business logic and storage in design of an app. -  Can reuse non-UI logic from Swing i.e. Data Access Object, etc. -  Easier to build an Android app from a multi-tier Swing apps, no need to test business logic again. -  Allow offline vs. online mode. -  Develop and reuse libraries. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 42. Building Apps - Software Engineering -  Get your users involved. -  Deploy often. -  Continuously testing the system. -  Design Patterns. -  Design for reusability and maintenance. -  Network back-end for intensive computation tasks. -  Use primitive int in Android apps. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 43. Building Apps - Assurance Quality -  Mock, Unit Test, MonkeyTest (Android), etc. -  Code static analysis. -  Use code reviews. -  Performance on memory with profiler. -  Multi-threaded apps easier on Android. -  Use logging API. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 44. Conclusion -  Easy transition from Swing to/from Android. -  Faster to develop Android app. -  Well defined Life Cycle of Android app. -  Keep a design of apps simple. -  Allow offline and online mode for apps. -  Design apps more in a mobile way. -  Cloud based applications. Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 45. Questions & Answers Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09
  • 46. References •  Android –  http://developer.android.com •  Screencast –  http://code.google.com/p/androidscreencast/ •  SensorSimulator –  http://code.google.com/p/openintents/wiki/SensorSimulator •  Android Way on Multitasking -  http://developer.android.com/resources/articles/multitasking-android-way.html Swing vs. Android - Johnny Hujol - CEJUG Fortaleza, Brasil - 2011/12/09