SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Computer Science Large Practical:

                    Feedback on Part 1 of the Practical

                                               Stephen Gilmore

                                               School of Informatics


                                          Friday 9th November, 2012




Stephen Gilmore (School of Informatics)      Computer Science Large Practical   Friday 9th November, 2012   1 / 24
Purpose of this lecture




         To provide general feedback about Part 1 of the practical.
         Give a general sense of how far people had got with Part 1, allowing
         you to gauge your progress with respect to the rest of the class.
         Identify some problems which people have been having.
         Provide clarification on some questions which arose in Part 1.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   2 / 24
Submissions for Part 1 of the practical




         There are 27 people taking the Computer Science Large Practical.
         There were 13 submissions for Part 1, and 14 non-submissions.
         Of the 13 submissions,
                 4   people were developing on Ubuntu/Linux;
                 6   people were developing on Mac OS X;
                 2   people were developing on Windows 7; and
                 1   person was developing on Windows 8.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   3 / 24
About the submissions for Part 1



         Please remember when submitting to submit your entire directory, not
         just the Objective-C sources.
         Your directory should contain Makefiles (if developing on
         Linux/Cygwin/Unix etc) or a .xcodeproj file (if developing on OS X).
         These files (and possibly others, if you created them) are used to
         compile your code.
         Please submit all such files, as in the instruction in the practical
         handout, otherwise I end up writing Makefiles to compile and run
         your code :-(




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   4 / 24
Range of submissions for the practical



         The submissions for Part 1 were obviously incomplete and
         work-in-progress, as requested by the practical description.
         Of the submissions for Part 1:
                 some     were just a list of files showing the structure of the project;
                 some     failed to compile;
                 some     compiled but produced warnings;
                 some     compiled and produced no warnings;
                 some     read the simulation script file;
                 some     performed a simulation.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   5 / 24
Uncertainties about the practical, and the marking

  Comment
         I used GNUstep on Windows 7 to run my simulator, and used the
         GCC compiler within GNUstep. I have attempted to compile my
         code on the DICE machines, however it does not seem to like the
         Objective-C specific elements of my code. I don’t know if there
         are problems with my code or with the compiler used on the
         DICE machines, but I could not get it to compile at all.


  Reply
 The version of GCC on DICE is an older version than most of us would
 have on our laptops so some Objective-C features are not supported, and
 there are other issues. As long as it compiles on your platform it is not a
 problem if your code does not compile on DICE.

Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   6 / 24
Uncertainties about the practical, and the marking


  Comment
         I am unsure of the fact that my application requires interaction
         with the user to proceed, as I don’t know if testing of the
         application for marking will be done automatically. In that case
         all command line output my application produces is, of course,
         useless.


  Reply
 Your application will not be tested automatically using a test harness; it
 will be tested by a human. It is perfectly OK to ask questions of the user,
 or ask them to type in the name of a file, or something else.


Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   7 / 24
Understanding the problem


 I received a submission with the following structure of header files and
 classes.

   compound.h               enzyme.h        parser.h             product.h       substrate.h
   compound.m               enzyme.m        parser.m             product.m       substrate.m

 This isn’t the right structure for this application. The enzyme/substrate
 example is one possible simulation script which could be simulated. There
 should not be Objective-C code in the simulator specifically for this
 example. Please consider other example scripts available from the course
 web page.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   8 / 24
Compiling and running under Ubuntu




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   9 / 24
Compile-time errors

         Compile-time errors in programs start with syntax errors and typos
         such as writing down the wrong identifier.
         Xcode suggests an alternative which is lexicographically close, a bit
         like a spelling checker does.




         Not that, somewhat arrogantly, Xcode shows you how your line of
         code would look after you accept the suggested fix, not before.
         That is, unlike Eclipse, it assumes that you’re going to accept its
         suggestion(!).
Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   10 / 24
Unfamiliar aspects of the language
         One problem when learning a new programming language is that we
         may bring expectations from the language which we know best.
         For example, we may assume that variables are given a default initial
         value (such as zero), as they are in Java.




         However, this isn’t the case in Objective-C. We need to initialise
         variables ourselves. (“Fix-it” in Xcode will suggest this.)




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   11 / 24
Unfamiliar error messages
“Duplicate symbols for architecture”



         Another problem when learning a new programming language is that
         the compilation process is different to the one we are used to, and
         error messages may be unhelpful.
         One example would be “duplicate symbols for architecture” which
         occurs late in the compilation process.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   12 / 24
StackOverflow wisdom
“Duplicate symbols for architecture”




  A StackOverflow post
         Whenever I have “duplicate symbol” errors, it is almost always
         because I have a circular #import in my headers. The solution
         is quite simple, use forward declarations where possible, and
         #import .h files from .m files instead.

 From http://stackoverflow.com/questions/11527439/i-am-having-all-the-time-this-issue-after-running-my-app

 Author: Chris Trahey




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   13 / 24
Diagnosis of the problem
“Duplicate symbols for architecture”




         This was the problem in this case: we should import header files, not
         implementation files. (That is, ”.h” files, not ”.m” files.)




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   14 / 24
Unfamiliar error messages
“Incomplete implementation”


         Another unfamiliar error message would be “incomplete
         implementation”. This message has the disadvantage of being short,
         and not particularly helpful.
         An implementation would be described as incomplete if methods
         declared in the interface were not implemented in the implementation.




         This applies even if the method was declared as a class method in the
         interface (i.e. +isUppercase), but defined as an instance method in
         the implementation (i.e. -isUppercase). This was the problem here.



Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   15 / 24
Conversions and coercions

         We use types in programming languages to discriminate values and to
         improve run-time efficiency.
         Often (e.g. with numeric types), a value of one type may be
         converted to another type explicitly (e.g. “floor” converts a float to
         an integer) or coerced silently (e.g. integer to float).
         In format strings we are also specifying the type of a value and should
         specify whether we are dealing with a long or an int.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   16 / 24
Conversions and coercions


         Implicit coercions occur in other contexts as well, such as when we
         pass a parameter to a method.
         In C, and languages descended from C, the problem is made slightly
         more complex because we also have unsigned integer types, which we
         do not have in Java.
         A conversion from long to int would lose precision, as would unsigned
         int to int or, as below, unsigned long to int.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   17 / 24
Incompatible pointer types
“How do I convert NSMutableArray to NSArray?”




         Again, as different from Java, Objective-C has two types of arrays,
         mutable and immutable.
         NSMutableArray* and NSArray* are incompatible pointer types.




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   18 / 24
StackOverflow wisdom
“How do I convert NSMutableArray to NSArray?”


  A StackOverflow post
         An NSMutableArray is a subclass of NSArray so you won’t
         always need to convert but if you want to make sure that the
         array can’t be modified you can create a NSArray either of these
         ways depending on whether you want it autoreleased or not:

      /* Not autoreleased */
      NSArray *array = [[NSArray alloc] initWithArray:mutableArray];

      /* Autoreleased array */
      NSArray *array = [NSArray arrayWithArray:mutableArray];


 From http://stackoverflow.com/questions/1768937/how-do-i-convert-nsmutablearray-to-nsarray

 Author: M Hallendal

Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   19 / 24
Other wisdom

  An iPhoneDevSDK post

      NSMutableArray *myMutableArray = [myArray mutableCopy];
      NSArray *myArray = [myMutableArray copy];

         There’s not much reason to do the second one since
         NSMutableArray does everything that NSArray does, unless you
         expect the mutable array to change and you want a copy of its
         current state. Two things to keep in mind: (1) both of these
         methods return an object with a retainCount of 1, just like
         alloc+init does. You own these objects and must release them
         somewhere. And (2) neither method makes copies of the items
         themselves, just the pointers.

 From http://iphonedevsdk.com/forum/iphone-sdk-development/62801-nsmutablearray-to-nsarray.html

  Author: smasher
Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   20 / 24
Learning to love static analysis
         Sometimes static analysis will complain about parts of your code
         where you are sure that there is nothing wrong.
         The way you see your code:




         The way static analysis sees your code:




         Think of static analysis as “your slightly less clever friend” and try to
         help it to see that your code will never produce a run-time error. (You
         can do this by, for example, initialising variables.)
Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   21 / 24
Learning to love static analysis
         It’s not always easy for you to see the problems in your code.
         Sometimes the definition site for a variable is many lines away from
         the use site.




         Static analysis provides an over-approximation of your program’s
         behaviour. It reports potential problems which might not occur in
         practice (but “your slightly less clever friend” can’t see that).
Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   22 / 24
Some run-time exceptions




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   23 / 24
Some run-time exceptions




Stephen Gilmore (School of Informatics)   Computer Science Large Practical   Friday 9th November, 2012   24 / 24

Contenu connexe

Tendances

Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesBruno Bossola
 
Clean Code summary
Clean Code summaryClean Code summary
Clean Code summaryJan de Vries
 
Evolve Your Code
Evolve Your CodeEvolve Your Code
Evolve Your CodeRookieOne
 
GPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask LearnersGPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask LearnersYoung Seok Kim
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency InjectionTheo Jungeblut
 
Refactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeRefactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeValerio Maggio
 
Design for testability as a way to good coding (SOLID and IoC)
Design for testability as a way to good coding (SOLID and IoC)Design for testability as a way to good coding (SOLID and IoC)
Design for testability as a way to good coding (SOLID and IoC)Simone Chiaretta
 
Is there a future for Model Transformation Languages?
Is there a future for Model Transformation Languages?Is there a future for Model Transformation Languages?
Is there a future for Model Transformation Languages?Jordi Cabot
 
Solid principles of oo design
Solid principles of oo designSolid principles of oo design
Solid principles of oo designConfiz
 
Generic Tools, Specific Laguages
Generic Tools, Specific LaguagesGeneric Tools, Specific Laguages
Generic Tools, Specific LaguagesMarkus Voelter
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingYoung Seok Kim
 

Tendances (20)

Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
 
Clean code-v2.2
Clean code-v2.2Clean code-v2.2
Clean code-v2.2
 
BDD Primer
BDD PrimerBDD Primer
BDD Primer
 
Clean Code summary
Clean Code summaryClean Code summary
Clean Code summary
 
Do Bugs Reside in Complex Code?
Do Bugs Reside in Complex Code?Do Bugs Reside in Complex Code?
Do Bugs Reside in Complex Code?
 
Evolve Your Code
Evolve Your CodeEvolve Your Code
Evolve Your Code
 
Code Smells
Code SmellsCode Smells
Code Smells
 
Ch06lect1 ud
Ch06lect1 udCh06lect1 ud
Ch06lect1 ud
 
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
 
On Impact in Software Engineering Research (HU Berlin 2021)
On Impact in Software Engineering Research (HU Berlin 2021)On Impact in Software Engineering Research (HU Berlin 2021)
On Impact in Software Engineering Research (HU Berlin 2021)
 
GPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask LearnersGPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask Learners
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
 
Code Smell
Code SmellCode Smell
Code Smell
 
Refactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeRefactoring: Improve the design of existing code
Refactoring: Improve the design of existing code
 
Design for testability as a way to good coding (SOLID and IoC)
Design for testability as a way to good coding (SOLID and IoC)Design for testability as a way to good coding (SOLID and IoC)
Design for testability as a way to good coding (SOLID and IoC)
 
Is there a future for Model Transformation Languages?
Is there a future for Model Transformation Languages?Is there a future for Model Transformation Languages?
Is there a future for Model Transformation Languages?
 
Solid principles of oo design
Solid principles of oo designSolid principles of oo design
Solid principles of oo design
 
Ch10lect1 ud
Ch10lect1 udCh10lect1 ud
Ch10lect1 ud
 
Generic Tools, Specific Laguages
Generic Tools, Specific LaguagesGeneric Tools, Specific Laguages
Generic Tools, Specific Laguages
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
 

En vedette

Computer Science Large Practical coursework
Computer Science Large Practical courseworkComputer Science Large Practical coursework
Computer Science Large Practical courseworkStephen Gilmore
 
The Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmThe Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmStephen Gilmore
 
Foundations and methods of stochastic simulation
Foundations and methods of stochastic simulationFoundations and methods of stochastic simulation
Foundations and methods of stochastic simulationSpringer
 
Ee2201 measurement-and-instrumentation-lecture-notes
Ee2201 measurement-and-instrumentation-lecture-notesEe2201 measurement-and-instrumentation-lecture-notes
Ee2201 measurement-and-instrumentation-lecture-notesJayakumar T
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation ExamplesStephen Gilmore
 
Discrete And Continuous Simulation
Discrete And Continuous SimulationDiscrete And Continuous Simulation
Discrete And Continuous SimulationNguyen Chien
 
Elements Of Stochastic Processes
Elements Of Stochastic ProcessesElements Of Stochastic Processes
Elements Of Stochastic ProcessesMALAKI12003
 
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)Eklavya Sharma
 
4 stochastic processes
4 stochastic processes4 stochastic processes
4 stochastic processesSolo Hermelin
 
Stochastic modelling and its applications
Stochastic modelling and its applicationsStochastic modelling and its applications
Stochastic modelling and its applicationsKartavya Jain
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
Deterministic vs stochastic
Deterministic vs stochasticDeterministic vs stochastic
Deterministic vs stochasticsohail40
 
Computer science project work
Computer science project workComputer science project work
Computer science project workrahulchamp2345
 
Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Self-employed
 

En vedette (16)

Computer Science Large Practical coursework
Computer Science Large Practical courseworkComputer Science Large Practical coursework
Computer Science Large Practical coursework
 
The Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmThe Stochastic Simulation Algorithm
The Stochastic Simulation Algorithm
 
Foundations and methods of stochastic simulation
Foundations and methods of stochastic simulationFoundations and methods of stochastic simulation
Foundations and methods of stochastic simulation
 
Ee2201 measurement-and-instrumentation-lecture-notes
Ee2201 measurement-and-instrumentation-lecture-notesEe2201 measurement-and-instrumentation-lecture-notes
Ee2201 measurement-and-instrumentation-lecture-notes
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation Examples
 
Bridge ckt eim
Bridge ckt eimBridge ckt eim
Bridge ckt eim
 
Discrete And Continuous Simulation
Discrete And Continuous SimulationDiscrete And Continuous Simulation
Discrete And Continuous Simulation
 
Elements Of Stochastic Processes
Elements Of Stochastic ProcessesElements Of Stochastic Processes
Elements Of Stochastic Processes
 
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)
AC bridges ( Weins bridge, Desauty bridge, Maxwell's inductance bridge)
 
4 stochastic processes
4 stochastic processes4 stochastic processes
4 stochastic processes
 
Stochastic modelling and its applications
Stochastic modelling and its applicationsStochastic modelling and its applications
Stochastic modelling and its applications
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
Deterministic vs stochastic
Deterministic vs stochasticDeterministic vs stochastic
Deterministic vs stochastic
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12
 

Similaire à Feedback on Part 1 of the CSLP

Inventing The Next Business Programming Language
Inventing The Next Business Programming LanguageInventing The Next Business Programming Language
Inventing The Next Business Programming LanguageRichard Green
 
01 computer programming
01 computer programming01 computer programming
01 computer programmingmanish aryal
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software designTech_MX
 
OOP_chapter _1.pptx
OOP_chapter _1.pptxOOP_chapter _1.pptx
OOP_chapter _1.pptxAbdexAliyi
 
Crash Course in Objective-C
Crash Course in Objective-CCrash Course in Objective-C
Crash Course in Objective-CStephen Gilmore
 
Computer Science Is The Study Of Principals And How The...
Computer Science Is The Study Of Principals And How The...Computer Science Is The Study Of Principals And How The...
Computer Science Is The Study Of Principals And How The...Laura Martin
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Softwaresvilen.ivanov
 
The Economics of OptimJ
The Economics of OptimJThe Economics of OptimJ
The Economics of OptimJPatrick Viry
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi pptmark-asoi
 
Testing and TDD - KoJUG
Testing and TDD - KoJUGTesting and TDD - KoJUG
Testing and TDD - KoJUGlburdz
 
Interactive Development Environments
Interactive Development EnvironmentsInteractive Development Environments
Interactive Development EnvironmentsPhilip Johnson
 
Brief introduction into dependencies
Brief introduction into dependenciesBrief introduction into dependencies
Brief introduction into dependenciesJoel Krebs
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...Wagdy Mohamed
 
Agile principles and practices
Agile principles and practicesAgile principles and practices
Agile principles and practicesVipin Jose
 

Similaire à Feedback on Part 1 of the CSLP (20)

Intro1
Intro1Intro1
Intro1
 
Inventing The Next Business Programming Language
Inventing The Next Business Programming LanguageInventing The Next Business Programming Language
Inventing The Next Business Programming Language
 
01 computer programming
01 computer programming01 computer programming
01 computer programming
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software design
 
Class (1)
Class (1)Class (1)
Class (1)
 
OOP_chapter _1.pptx
OOP_chapter _1.pptxOOP_chapter _1.pptx
OOP_chapter _1.pptx
 
Crash Course in Objective-C
Crash Course in Objective-CCrash Course in Objective-C
Crash Course in Objective-C
 
Computer Science Is The Study Of Principals And How The...
Computer Science Is The Study Of Principals And How The...Computer Science Is The Study Of Principals And How The...
Computer Science Is The Study Of Principals And How The...
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Software
 
The Economics of OptimJ
The Economics of OptimJThe Economics of OptimJ
The Economics of OptimJ
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
 
Testing and TDD - KoJUG
Testing and TDD - KoJUGTesting and TDD - KoJUG
Testing and TDD - KoJUG
 
Interactive Development Environments
Interactive Development EnvironmentsInteractive Development Environments
Interactive Development Environments
 
Brief introduction into dependencies
Brief introduction into dependenciesBrief introduction into dependencies
Brief introduction into dependencies
 
50120140507013
5012014050701350120140507013
50120140507013
 
50120140507013
5012014050701350120140507013
50120140507013
 
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " First...
 
Agile principles and practices
Agile principles and practicesAgile principles and practices
Agile principles and practices
 
Debugging
DebuggingDebugging
Debugging
 

Plus de Stephen Gilmore

Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with RobotiumStephen Gilmore
 
Common Java problems when developing with Android
Common Java problems when developing with AndroidCommon Java problems when developing with Android
Common Java problems when developing with AndroidStephen Gilmore
 
Quick quiz on Objective-C
Quick quiz on Objective-CQuick quiz on Objective-C
Quick quiz on Objective-CStephen Gilmore
 
Getting started with Xcode
Getting started with XcodeGetting started with Xcode
Getting started with XcodeStephen Gilmore
 
Working with databases in Android
Working with databases in AndroidWorking with databases in Android
Working with databases in AndroidStephen Gilmore
 
SELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsSELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsStephen Gilmore
 
Beginning Android Development
Beginning Android DevelopmentBeginning Android Development
Beginning Android DevelopmentStephen 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
 

Plus de Stephen Gilmore (16)

Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with Robotium
 
Common Java problems when developing with Android
Common Java problems when developing with AndroidCommon Java problems when developing with Android
Common Java problems when developing with Android
 
Quick quiz on Objective-C
Quick quiz on Objective-CQuick quiz on Objective-C
Quick quiz on Objective-C
 
Getting started with Xcode
Getting started with XcodeGetting started with Xcode
Getting started with Xcode
 
Working with databases in Android
Working with databases in AndroidWorking with databases in Android
Working with databases in Android
 
SELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsSELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and Manifests
 
Beginning Android Development
Beginning Android DevelopmentBeginning Android Development
Beginning Android Development
 
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
 

Dernier

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 

Dernier (20)

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 

Feedback on Part 1 of the CSLP

  • 1. Computer Science Large Practical: Feedback on Part 1 of the Practical Stephen Gilmore School of Informatics Friday 9th November, 2012 Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 1 / 24
  • 2. Purpose of this lecture To provide general feedback about Part 1 of the practical. Give a general sense of how far people had got with Part 1, allowing you to gauge your progress with respect to the rest of the class. Identify some problems which people have been having. Provide clarification on some questions which arose in Part 1. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 2 / 24
  • 3. Submissions for Part 1 of the practical There are 27 people taking the Computer Science Large Practical. There were 13 submissions for Part 1, and 14 non-submissions. Of the 13 submissions, 4 people were developing on Ubuntu/Linux; 6 people were developing on Mac OS X; 2 people were developing on Windows 7; and 1 person was developing on Windows 8. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 3 / 24
  • 4. About the submissions for Part 1 Please remember when submitting to submit your entire directory, not just the Objective-C sources. Your directory should contain Makefiles (if developing on Linux/Cygwin/Unix etc) or a .xcodeproj file (if developing on OS X). These files (and possibly others, if you created them) are used to compile your code. Please submit all such files, as in the instruction in the practical handout, otherwise I end up writing Makefiles to compile and run your code :-( Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 4 / 24
  • 5. Range of submissions for the practical The submissions for Part 1 were obviously incomplete and work-in-progress, as requested by the practical description. Of the submissions for Part 1: some were just a list of files showing the structure of the project; some failed to compile; some compiled but produced warnings; some compiled and produced no warnings; some read the simulation script file; some performed a simulation. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 5 / 24
  • 6. Uncertainties about the practical, and the marking Comment I used GNUstep on Windows 7 to run my simulator, and used the GCC compiler within GNUstep. I have attempted to compile my code on the DICE machines, however it does not seem to like the Objective-C specific elements of my code. I don’t know if there are problems with my code or with the compiler used on the DICE machines, but I could not get it to compile at all. Reply The version of GCC on DICE is an older version than most of us would have on our laptops so some Objective-C features are not supported, and there are other issues. As long as it compiles on your platform it is not a problem if your code does not compile on DICE. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 6 / 24
  • 7. Uncertainties about the practical, and the marking Comment I am unsure of the fact that my application requires interaction with the user to proceed, as I don’t know if testing of the application for marking will be done automatically. In that case all command line output my application produces is, of course, useless. Reply Your application will not be tested automatically using a test harness; it will be tested by a human. It is perfectly OK to ask questions of the user, or ask them to type in the name of a file, or something else. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 7 / 24
  • 8. Understanding the problem I received a submission with the following structure of header files and classes. compound.h enzyme.h parser.h product.h substrate.h compound.m enzyme.m parser.m product.m substrate.m This isn’t the right structure for this application. The enzyme/substrate example is one possible simulation script which could be simulated. There should not be Objective-C code in the simulator specifically for this example. Please consider other example scripts available from the course web page. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 8 / 24
  • 9. Compiling and running under Ubuntu Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 9 / 24
  • 10. Compile-time errors Compile-time errors in programs start with syntax errors and typos such as writing down the wrong identifier. Xcode suggests an alternative which is lexicographically close, a bit like a spelling checker does. Not that, somewhat arrogantly, Xcode shows you how your line of code would look after you accept the suggested fix, not before. That is, unlike Eclipse, it assumes that you’re going to accept its suggestion(!). Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 10 / 24
  • 11. Unfamiliar aspects of the language One problem when learning a new programming language is that we may bring expectations from the language which we know best. For example, we may assume that variables are given a default initial value (such as zero), as they are in Java. However, this isn’t the case in Objective-C. We need to initialise variables ourselves. (“Fix-it” in Xcode will suggest this.) Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 11 / 24
  • 12. Unfamiliar error messages “Duplicate symbols for architecture” Another problem when learning a new programming language is that the compilation process is different to the one we are used to, and error messages may be unhelpful. One example would be “duplicate symbols for architecture” which occurs late in the compilation process. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 12 / 24
  • 13. StackOverflow wisdom “Duplicate symbols for architecture” A StackOverflow post Whenever I have “duplicate symbol” errors, it is almost always because I have a circular #import in my headers. The solution is quite simple, use forward declarations where possible, and #import .h files from .m files instead. From http://stackoverflow.com/questions/11527439/i-am-having-all-the-time-this-issue-after-running-my-app Author: Chris Trahey Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 13 / 24
  • 14. Diagnosis of the problem “Duplicate symbols for architecture” This was the problem in this case: we should import header files, not implementation files. (That is, ”.h” files, not ”.m” files.) Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 14 / 24
  • 15. Unfamiliar error messages “Incomplete implementation” Another unfamiliar error message would be “incomplete implementation”. This message has the disadvantage of being short, and not particularly helpful. An implementation would be described as incomplete if methods declared in the interface were not implemented in the implementation. This applies even if the method was declared as a class method in the interface (i.e. +isUppercase), but defined as an instance method in the implementation (i.e. -isUppercase). This was the problem here. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 15 / 24
  • 16. Conversions and coercions We use types in programming languages to discriminate values and to improve run-time efficiency. Often (e.g. with numeric types), a value of one type may be converted to another type explicitly (e.g. “floor” converts a float to an integer) or coerced silently (e.g. integer to float). In format strings we are also specifying the type of a value and should specify whether we are dealing with a long or an int. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 16 / 24
  • 17. Conversions and coercions Implicit coercions occur in other contexts as well, such as when we pass a parameter to a method. In C, and languages descended from C, the problem is made slightly more complex because we also have unsigned integer types, which we do not have in Java. A conversion from long to int would lose precision, as would unsigned int to int or, as below, unsigned long to int. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 17 / 24
  • 18. Incompatible pointer types “How do I convert NSMutableArray to NSArray?” Again, as different from Java, Objective-C has two types of arrays, mutable and immutable. NSMutableArray* and NSArray* are incompatible pointer types. Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 18 / 24
  • 19. StackOverflow wisdom “How do I convert NSMutableArray to NSArray?” A StackOverflow post An NSMutableArray is a subclass of NSArray so you won’t always need to convert but if you want to make sure that the array can’t be modified you can create a NSArray either of these ways depending on whether you want it autoreleased or not: /* Not autoreleased */ NSArray *array = [[NSArray alloc] initWithArray:mutableArray]; /* Autoreleased array */ NSArray *array = [NSArray arrayWithArray:mutableArray]; From http://stackoverflow.com/questions/1768937/how-do-i-convert-nsmutablearray-to-nsarray Author: M Hallendal Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 19 / 24
  • 20. Other wisdom An iPhoneDevSDK post NSMutableArray *myMutableArray = [myArray mutableCopy]; NSArray *myArray = [myMutableArray copy]; There’s not much reason to do the second one since NSMutableArray does everything that NSArray does, unless you expect the mutable array to change and you want a copy of its current state. Two things to keep in mind: (1) both of these methods return an object with a retainCount of 1, just like alloc+init does. You own these objects and must release them somewhere. And (2) neither method makes copies of the items themselves, just the pointers. From http://iphonedevsdk.com/forum/iphone-sdk-development/62801-nsmutablearray-to-nsarray.html Author: smasher Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 20 / 24
  • 21. Learning to love static analysis Sometimes static analysis will complain about parts of your code where you are sure that there is nothing wrong. The way you see your code: The way static analysis sees your code: Think of static analysis as “your slightly less clever friend” and try to help it to see that your code will never produce a run-time error. (You can do this by, for example, initialising variables.) Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 21 / 24
  • 22. Learning to love static analysis It’s not always easy for you to see the problems in your code. Sometimes the definition site for a variable is many lines away from the use site. Static analysis provides an over-approximation of your program’s behaviour. It reports potential problems which might not occur in practice (but “your slightly less clever friend” can’t see that). Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 22 / 24
  • 23. Some run-time exceptions Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 23 / 24
  • 24. Some run-time exceptions Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 9th November, 2012 24 / 24