SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Software Engineering Large Practical

Common Java problems when coding for
Android and advice for dealing with them

                     Stephen Gilmore

        School of Informatics, University of Edinburgh


                  October 24th, 2012




                Stephen Gilmore   Software Engineering Large Practical
Java problems




   For some, developing for the Android platform might provide their
   first experience of working with a complex, modern Java API. This
   may test your knowledge of the Java programming language,
   especially with regard to features such as generics. The Android
   APIs make use of generics throughout and so you will have to
   know how to create and handle generic classes.




                        Stephen Gilmore   Software Engineering Large Practical
Raw types




  Raw types are a backwards compatibility feature which allowed
  new generic Java code to use old non-generic libraries and to allow
  non-generic Java code to continue to compile and work on modern
  Java versions. Raw types are not needed when working with the
  Android API and your project should not contain them.




                        Stephen Gilmore   Software Engineering Large Practical
Common Java problems: raw types, 8 warnings




                  Stephen Gilmore   Software Engineering Large Practical
Quick fix: a bad suggestion




                   Stephen Gilmore   Software Engineering Large Practical
Check the constructor documentation




                   Stephen Gilmore   Software Engineering Large Practical
Check the class documentation




                   Stephen Gilmore   Software Engineering Large Practical
What type of array are we adapting?




                   Stephen Gilmore   Software Engineering Large Practical
Type parameter added, 6 warnings




                   Stephen Gilmore   Software Engineering Large Practical
Raw type parameters




   Raw types need special treatment in method headers when
   instances of generic classes are being passed as parameters to
   methods. A special syntax is used to specify when we do not know
   the type of the parameter to the generic class.




                        Stephen Gilmore   Software Engineering Large Practical
Raw type in method header, 5 warnings




                   Stephen Gilmore   Software Engineering Large Practical
Consult the Java documentation




                   Stephen Gilmore   Software Engineering Large Practical
Adapter doesn’t work here




                   Stephen Gilmore   Software Engineering Large Practical
Adapter is an interface




                    Stephen Gilmore   Software Engineering Large Practical
T is not a class




                   Stephen Gilmore   Software Engineering Large Practical
Object: the goto class




                    Stephen Gilmore   Software Engineering Large Practical
T extends Adapter doesn’t work




                   Stephen Gilmore   Software Engineering Large Practical
“?” — the wild card parameter, 3 warnings




                   Stephen Gilmore   Software Engineering Large Practical
“Quick fix” would have worked here




                  Stephen Gilmore   Software Engineering Large Practical
Same result




              Stephen Gilmore   Software Engineering Large Practical
Working with the Java compiler



   The Java compiler used Eclipse allows you to tune the level of
   checking which your program receives during compilation. This
   checking (“static analysis”) evaluates the correctness of your
   program without executing it.

   The default settings do not apply particularly strict checking. We
   recommend tightening the default settings to detect errors in your
   Java code which you may otherwise miss.




                         Stephen Gilmore   Software Engineering Large Practical
Setting Java compiler preferences




                    Stephen Gilmore   Software Engineering Large Practical
Changing defaults




                    Stephen Gilmore   Software Engineering Large Practical
Potential programming problems




                  Stephen Gilmore   Software Engineering Large Practical
Tighter checking




                   Stephen Gilmore   Software Engineering Large Practical
Bug found




            Stephen Gilmore   Software Engineering Large Practical
Remembering and forgetting while developing




   Leaving an empty block is a classic “I must remember to do that
   later” error. By turning on stricter checking with the static
   analysis tools in the Java compiler we get automatic reminders in
   the form of Java problems. These will persist in our project until
   we do go back and write the remaining code block.




                         Stephen Gilmore   Software Engineering Large Practical
Logging




   As we have seen, the Android emulator occupies all of the screen
   real estate of our virtual device, in order to allow us to test apps as
   they will be used in practice. If we want to log informational
   messages for our own purposes then we should use the Android
   logging API.




                          Stephen Gilmore   Software Engineering Large Practical
Don’t forget to add logging . . .




ng
                          Stephen Gilmore   Software Engineering Large Practical

Mais conteúdo relacionado

Mais procurados

Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Lemi Orhan Ergin
 
Scrum Events and Artifacts in Action
Scrum Events and Artifacts in ActionScrum Events and Artifacts in Action
Scrum Events and Artifacts in ActionLemi Orhan Ergin
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of codeShwe Yee
 
Code Review
Code ReviewCode Review
Code Reviewrantav
 
GDG Morgantown, WV: Write code you can depend on!
GDG Morgantown, WV: Write code you can depend on!GDG Morgantown, WV: Write code you can depend on!
GDG Morgantown, WV: Write code you can depend on!Logan Spears
 
DevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to PracticeDevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to PracticeLemi Orhan Ergin
 
Professional iOS development
Professional iOS developmentProfessional iOS development
Professional iOS developmentAline Borges
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsRon Munitz
 
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Lemi Orhan Ergin
 
Unwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingUnwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingLemi Orhan Ergin
 
Code Review
Code ReviewCode Review
Code ReviewRavi Raj
 
Global Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventGlobal Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventLemi Orhan Ergin
 
Code-Review-Principles-Process-and-Tools (1)
Code-Review-Principles-Process-and-Tools (1)Code-Review-Principles-Process-and-Tools (1)
Code-Review-Principles-Process-and-Tools (1)Aditya Bhuyan
 
Beginning Android Development
Beginning Android DevelopmentBeginning Android Development
Beginning Android DevelopmentStephen Gilmore
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and WhenPaul Gower
 
Peer Code Review An Agile Process
Peer Code Review An Agile ProcessPeer Code Review An Agile Process
Peer Code Review An Agile Processgsporar
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...VincitOy
 
Test Driven Development Part 1
Test Driven Development Part 1Test Driven Development Part 1
Test Driven Development Part 1Gamal Shaban
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 

Mais procurados (20)

Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017
 
Scrum Events and Artifacts in Action
Scrum Events and Artifacts in ActionScrum Events and Artifacts in Action
Scrum Events and Artifacts in Action
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of code
 
Code Review
Code ReviewCode Review
Code Review
 
GDG Morgantown, WV: Write code you can depend on!
GDG Morgantown, WV: Write code you can depend on!GDG Morgantown, WV: Write code you can depend on!
GDG Morgantown, WV: Write code you can depend on!
 
DevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to PracticeDevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to Practice
 
Professional iOS development
Professional iOS developmentProfessional iOS development
Professional iOS development
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android Apps
 
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016
 
Unwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingUnwritten Manual for Pair Programming
Unwritten Manual for Pair Programming
 
Code Review
Code ReviewCode Review
Code Review
 
Global Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventGlobal Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul Event
 
Code-Review-Principles-Process-and-Tools (1)
Code-Review-Principles-Process-and-Tools (1)Code-Review-Principles-Process-and-Tools (1)
Code-Review-Principles-Process-and-Tools (1)
 
Beginning Android Development
Beginning Android DevelopmentBeginning Android Development
Beginning Android Development
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Peer Code Review An Agile Process
Peer Code Review An Agile ProcessPeer Code Review An Agile Process
Peer Code Review An Agile Process
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
 
Test Driven Development Part 1
Test Driven Development Part 1Test Driven Development Part 1
Test Driven Development Part 1
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Code Quality
Code QualityCode Quality
Code Quality
 

Destaque

Quick quiz on Objective-C
Quick quiz on Objective-CQuick quiz on Objective-C
Quick quiz on Objective-CStephen Gilmore
 
Technical quiz conducted at EDC to Group-III Executives
Technical quiz conducted at EDC to Group-III ExecutivesTechnical quiz conducted at EDC to Group-III Executives
Technical quiz conducted at EDC to Group-III ExecutivesNTPC
 
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM Mayyil
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM MayyilIT Quiz Final @ eRz eRDeN 15, IT Fest, ITM Mayyil
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM MayyilShyju Chathampalli
 
Final Round Technical quiz at KMEA Engineering college by Electronics and com...
Final Round Technical quiz at KMEA Engineering college by Electronics and com...Final Round Technical quiz at KMEA Engineering college by Electronics and com...
Final Round Technical quiz at KMEA Engineering college by Electronics and com...Amal Augustine
 
Technical Quiz KAINOTOMIA
Technical Quiz KAINOTOMIATechnical Quiz KAINOTOMIA
Technical Quiz KAINOTOMIAAmal Augustine
 
Technical Quiz (Basic concepts of computers)
Technical Quiz (Basic concepts of computers)Technical Quiz (Basic concepts of computers)
Technical Quiz (Basic concepts of computers)Manpreet Kaur
 
TCS IT WIZ 2013 Prelims Questions
TCS IT WIZ 2013 Prelims QuestionsTCS IT WIZ 2013 Prelims Questions
TCS IT WIZ 2013 Prelims QuestionsVittal Pai
 
Technical Quiz conducted at calicut on kerala state IT quiz
Technical Quiz conducted at calicut on kerala state IT quizTechnical Quiz conducted at calicut on kerala state IT quiz
Technical Quiz conducted at calicut on kerala state IT quizAmal Augustine
 
IT Quiz Prelims
IT Quiz PrelimsIT Quiz Prelims
IT Quiz PrelimsSonal Raj
 
Tech Quiz
Tech QuizTech Quiz
Tech Quizssdcps8
 
General Quiz with answers
General Quiz with answersGeneral Quiz with answers
General Quiz with answersSekhar Barpanda
 
Computer quiz for primary classes
Computer quiz for primary classesComputer quiz for primary classes
Computer quiz for primary classesRajashekar_rs
 
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...mehboobanik
 
General Quiz Prelims with Answers
General Quiz Prelims with AnswersGeneral Quiz Prelims with Answers
General Quiz Prelims with AnswersQuest-SGGSCC
 

Destaque (20)

Kraken '16 It quiz final
Kraken '16 It quiz finalKraken '16 It quiz final
Kraken '16 It quiz final
 
Quick quiz on Objective-C
Quick quiz on Objective-CQuick quiz on Objective-C
Quick quiz on Objective-C
 
Technical quiz conducted at EDC to Group-III Executives
Technical quiz conducted at EDC to Group-III ExecutivesTechnical quiz conducted at EDC to Group-III Executives
Technical quiz conducted at EDC to Group-III Executives
 
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM Mayyil
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM MayyilIT Quiz Final @ eRz eRDeN 15, IT Fest, ITM Mayyil
IT Quiz Final @ eRz eRDeN 15, IT Fest, ITM Mayyil
 
Tech quiz prelims
Tech quiz prelimsTech quiz prelims
Tech quiz prelims
 
Final Round Technical quiz at KMEA Engineering college by Electronics and com...
Final Round Technical quiz at KMEA Engineering college by Electronics and com...Final Round Technical quiz at KMEA Engineering college by Electronics and com...
Final Round Technical quiz at KMEA Engineering college by Electronics and com...
 
Technical Quiz KAINOTOMIA
Technical Quiz KAINOTOMIATechnical Quiz KAINOTOMIA
Technical Quiz KAINOTOMIA
 
Technical Quiz (Basic concepts of computers)
Technical Quiz (Basic concepts of computers)Technical Quiz (Basic concepts of computers)
Technical Quiz (Basic concepts of computers)
 
TCS IT WIZ 2013 Prelims Questions
TCS IT WIZ 2013 Prelims QuestionsTCS IT WIZ 2013 Prelims Questions
TCS IT WIZ 2013 Prelims Questions
 
Technical Quiz conducted at calicut on kerala state IT quiz
Technical Quiz conducted at calicut on kerala state IT quizTechnical Quiz conducted at calicut on kerala state IT quiz
Technical Quiz conducted at calicut on kerala state IT quiz
 
IT Quiz Prelims
IT Quiz PrelimsIT Quiz Prelims
IT Quiz Prelims
 
Galaxy 2014 General Quiz
Galaxy 2014 General QuizGalaxy 2014 General Quiz
Galaxy 2014 General Quiz
 
Tech Quiz
Tech QuizTech Quiz
Tech Quiz
 
General Quiz with answers
General Quiz with answersGeneral Quiz with answers
General Quiz with answers
 
IT Quiz
IT QuizIT Quiz
IT Quiz
 
Computer quiz for primary classes
Computer quiz for primary classesComputer quiz for primary classes
Computer quiz for primary classes
 
Gk quiz ppt avi
Gk quiz ppt aviGk quiz ppt avi
Gk quiz ppt avi
 
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...
quiz,Junior quiz, inter house quiz, school quiz, quiz show,mixed bag, audio v...
 
Technology Quiz
Technology QuizTechnology Quiz
Technology Quiz
 
General Quiz Prelims with Answers
General Quiz Prelims with AnswersGeneral Quiz Prelims with Answers
General Quiz Prelims with Answers
 

Semelhante a Common Java problems when developing with Android

SELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsSELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsStephen Gilmore
 
Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with RobotiumStephen Gilmore
 
Feedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large PracticalFeedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large PracticalStephen Gilmore
 
javabasics_ programming development chapter01
javabasics_ programming development chapter01javabasics_ programming development chapter01
javabasics_ programming development chapter01Udeshg90
 
Working with databases in Android
Working with databases in AndroidWorking with databases in Android
Working with databases in AndroidStephen Gilmore
 
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfDifferent Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfpCloudy
 
Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-testRoyce Haynes
 
Continuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyreContinuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyreSpark Summit
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...DicodingEvent
 
Bug hunting through_reverse_engineering
Bug hunting through_reverse_engineeringBug hunting through_reverse_engineering
Bug hunting through_reverse_engineeringarif
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020Abhijeet Vaikar
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Conceptswesovi
 
Java Programming 100 Programming Challenges
Java Programming 100 Programming ChallengesJava Programming 100 Programming Challenges
Java Programming 100 Programming ChallengesJavier Crisostomo
 
Janet Gregory presents Current Testing Challenges with SoftTest Ireland
Janet Gregory presents Current Testing Challenges with SoftTest IrelandJanet Gregory presents Current Testing Challenges with SoftTest Ireland
Janet Gregory presents Current Testing Challenges with SoftTest IrelandDavid O'Dowd
 
Current Testing Challenges Ireland
Current Testing Challenges IrelandCurrent Testing Challenges Ireland
Current Testing Challenges IrelandDavid O'Dowd
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testingcloud chen
 

Semelhante a Common Java problems when developing with Android (20)

SELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsSELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and Manifests
 
Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with Robotium
 
Feedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large PracticalFeedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large Practical
 
javabasics_ programming development chapter01
javabasics_ programming development chapter01javabasics_ programming development chapter01
javabasics_ programming development chapter01
 
Working with databases in Android
Working with databases in AndroidWorking with databases in Android
Working with databases in Android
 
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfDifferent Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
 
Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-test
 
Continuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyreContinuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyre
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
 
Bug hunting through_reverse_engineering
Bug hunting through_reverse_engineeringBug hunting through_reverse_engineering
Bug hunting through_reverse_engineering
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Jdj Foss Java Tools
Jdj Foss Java ToolsJdj Foss Java Tools
Jdj Foss Java Tools
 
Java Programming 100 Programming Challenges
Java Programming 100 Programming ChallengesJava Programming 100 Programming Challenges
Java Programming 100 Programming Challenges
 
Dagger 2
Dagger 2Dagger 2
Dagger 2
 
Android Dev Study Jam.pptx
Android Dev Study Jam.pptxAndroid Dev Study Jam.pptx
Android Dev Study Jam.pptx
 
Janet Gregory presents Current Testing Challenges with SoftTest Ireland
Janet Gregory presents Current Testing Challenges with SoftTest IrelandJanet Gregory presents Current Testing Challenges with SoftTest Ireland
Janet Gregory presents Current Testing Challenges with SoftTest Ireland
 
Current Testing Challenges Ireland
Current Testing Challenges IrelandCurrent Testing Challenges Ireland
Current Testing Challenges Ireland
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testing
 

Mais de Stephen Gilmore

Feedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLPFeedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLPStephen Gilmore
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation ExamplesStephen Gilmore
 
Getting started with Xcode
Getting started with XcodeGetting started with Xcode
Getting started with XcodeStephen Gilmore
 
Crash Course in Objective-C
Crash Course in Objective-CCrash Course in Objective-C
Crash Course in Objective-CStephen Gilmore
 
The Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmThe Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmStephen Gilmore
 
Computer Science Large Practical coursework
Computer Science Large Practical courseworkComputer Science Large Practical coursework
Computer Science Large Practical courseworkStephen Gilmore
 
Software Engineering Large Practical coursework
Software Engineering Large Practical courseworkSoftware Engineering Large Practical coursework
Software Engineering Large Practical courseworkStephen Gilmore
 
Introduction to the CSLP and the SELP
Introduction to the CSLP and the SELPIntroduction to the CSLP and the SELP
Introduction to the CSLP and the SELPStephen Gilmore
 
Fixing errors in Android Java applications
Fixing errors in Android Java applicationsFixing errors in Android Java applications
Fixing errors in Android Java applicationsStephen Gilmore
 
Feedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual PracticalFeedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual PracticalStephen Gilmore
 
Creating and working with databases in Android
Creating and working with databases in AndroidCreating and working with databases in Android
Creating and working with databases in AndroidStephen Gilmore
 
Continuing Android development
Continuing Android developmentContinuing Android development
Continuing Android developmentStephen Gilmore
 
Project management for the individual practical
Project management for the individual practicalProject management for the individual practical
Project management for the individual practicalStephen Gilmore
 
Beginning Android development
Beginning Android developmentBeginning Android development
Beginning Android developmentStephen Gilmore
 
CS/SE Individual practical - DDMS and AVD
CS/SE Individual practical - DDMS and AVDCS/SE Individual practical - DDMS and AVD
CS/SE Individual practical - DDMS and AVDStephen Gilmore
 

Mais de Stephen Gilmore (16)

Feedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLPFeedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLP
 
Arrays in Objective-C
Arrays in Objective-CArrays in Objective-C
Arrays in Objective-C
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation Examples
 
Getting started with Xcode
Getting started with XcodeGetting started with Xcode
Getting started with Xcode
 
Crash Course in Objective-C
Crash Course in Objective-CCrash Course in Objective-C
Crash Course in Objective-C
 
The Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmThe Stochastic Simulation Algorithm
The Stochastic Simulation Algorithm
 
Computer Science Large Practical coursework
Computer Science Large Practical courseworkComputer Science Large Practical coursework
Computer Science Large Practical coursework
 
Software Engineering Large Practical coursework
Software Engineering Large Practical courseworkSoftware Engineering Large Practical coursework
Software Engineering Large Practical coursework
 
Introduction to the CSLP and the SELP
Introduction to the CSLP and the SELPIntroduction to the CSLP and the SELP
Introduction to the CSLP and the SELP
 
Fixing errors in Android Java applications
Fixing errors in Android Java applicationsFixing errors in Android Java applications
Fixing errors in Android Java applications
 
Feedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual PracticalFeedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual Practical
 
Creating and working with databases in Android
Creating and working with databases in AndroidCreating and working with databases in Android
Creating and working with databases in Android
 
Continuing Android development
Continuing Android developmentContinuing Android development
Continuing Android development
 
Project management for the individual practical
Project management for the individual practicalProject management for the individual practical
Project management for the individual practical
 
Beginning Android development
Beginning Android developmentBeginning Android development
Beginning Android development
 
CS/SE Individual practical - DDMS and AVD
CS/SE Individual practical - DDMS and AVDCS/SE Individual practical - DDMS and AVD
CS/SE Individual practical - DDMS and AVD
 

Último

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 

Último (20)

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 

Common Java problems when developing with Android

  • 1. Software Engineering Large Practical Common Java problems when coding for Android and advice for dealing with them Stephen Gilmore School of Informatics, University of Edinburgh October 24th, 2012 Stephen Gilmore Software Engineering Large Practical
  • 2. Java problems For some, developing for the Android platform might provide their first experience of working with a complex, modern Java API. This may test your knowledge of the Java programming language, especially with regard to features such as generics. The Android APIs make use of generics throughout and so you will have to know how to create and handle generic classes. Stephen Gilmore Software Engineering Large Practical
  • 3. Raw types Raw types are a backwards compatibility feature which allowed new generic Java code to use old non-generic libraries and to allow non-generic Java code to continue to compile and work on modern Java versions. Raw types are not needed when working with the Android API and your project should not contain them. Stephen Gilmore Software Engineering Large Practical
  • 4. Common Java problems: raw types, 8 warnings Stephen Gilmore Software Engineering Large Practical
  • 5. Quick fix: a bad suggestion Stephen Gilmore Software Engineering Large Practical
  • 6. Check the constructor documentation Stephen Gilmore Software Engineering Large Practical
  • 7. Check the class documentation Stephen Gilmore Software Engineering Large Practical
  • 8. What type of array are we adapting? Stephen Gilmore Software Engineering Large Practical
  • 9. Type parameter added, 6 warnings Stephen Gilmore Software Engineering Large Practical
  • 10. Raw type parameters Raw types need special treatment in method headers when instances of generic classes are being passed as parameters to methods. A special syntax is used to specify when we do not know the type of the parameter to the generic class. Stephen Gilmore Software Engineering Large Practical
  • 11. Raw type in method header, 5 warnings Stephen Gilmore Software Engineering Large Practical
  • 12. Consult the Java documentation Stephen Gilmore Software Engineering Large Practical
  • 13. Adapter doesn’t work here Stephen Gilmore Software Engineering Large Practical
  • 14. Adapter is an interface Stephen Gilmore Software Engineering Large Practical
  • 15. T is not a class Stephen Gilmore Software Engineering Large Practical
  • 16. Object: the goto class Stephen Gilmore Software Engineering Large Practical
  • 17. T extends Adapter doesn’t work Stephen Gilmore Software Engineering Large Practical
  • 18. “?” — the wild card parameter, 3 warnings Stephen Gilmore Software Engineering Large Practical
  • 19. “Quick fix” would have worked here Stephen Gilmore Software Engineering Large Practical
  • 20. Same result Stephen Gilmore Software Engineering Large Practical
  • 21. Working with the Java compiler The Java compiler used Eclipse allows you to tune the level of checking which your program receives during compilation. This checking (“static analysis”) evaluates the correctness of your program without executing it. The default settings do not apply particularly strict checking. We recommend tightening the default settings to detect errors in your Java code which you may otherwise miss. Stephen Gilmore Software Engineering Large Practical
  • 22. Setting Java compiler preferences Stephen Gilmore Software Engineering Large Practical
  • 23. Changing defaults Stephen Gilmore Software Engineering Large Practical
  • 24. Potential programming problems Stephen Gilmore Software Engineering Large Practical
  • 25. Tighter checking Stephen Gilmore Software Engineering Large Practical
  • 26. Bug found Stephen Gilmore Software Engineering Large Practical
  • 27. Remembering and forgetting while developing Leaving an empty block is a classic “I must remember to do that later” error. By turning on stricter checking with the static analysis tools in the Java compiler we get automatic reminders in the form of Java problems. These will persist in our project until we do go back and write the remaining code block. Stephen Gilmore Software Engineering Large Practical
  • 28. Logging As we have seen, the Android emulator occupies all of the screen real estate of our virtual device, in order to allow us to test apps as they will be used in practice. If we want to log informational messages for our own purposes then we should use the Android logging API. Stephen Gilmore Software Engineering Large Practical
  • 29. Don’t forget to add logging . . . ng Stephen Gilmore Software Engineering Large Practical