Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tips & Tricks for iPhone Application Development

Tips & Tricks for iPhone Application Development

Presentation shown in Copenhagen, Denmark.

88dd97cf2dc7f06cc51a01d450f0b1e5?s=128

Adrian Kosmaczewski
PRO

August 27, 2009
Tweet

Transcript

  1. tips & tricks for iPhone application development

  2. None
  3. adrian kosmaczewski

  4. akosma software akosma.com akosma.tumblr.com github.com/akosma linkedin.com/in/akosma facebook.com/akosma

  5. @akosma

  6. None
  7. some questions

  8. @perlausten? @supermouse? @williwu?

  9. new to iPhone?

  10. technologies?

  11. J2EE, J2ME, .NET, RoR, others?

  12. programming languages?

  13. C / C++? Java, C#? Ruby, Python, Lua? JavaScript?

  14. None
  15. iPhone dev ≠ web dev

  16. None
  17. Cocoa & Objective-C

  18. born in the 80s

  19. None
  20. None
  21. None
  22. None
  23. Objective-C

  24. Objective-C Java @interface & @implementation class @protocol interface #import //

    files! import // classes! categories n/a id n/a
  25. • Thin layer around C • Message-dispatch runtime • Static

    and dynamic (you choose) • The “real” father of Java: • http://cs.gmu.edu/~sean/stuff/java-objc.html
  26. • Single inheritance + interfaces (“@protocols”) • @protocols can have

    optional methods • Fields protected by default • All methods are virtual and overridable • Methods can be added to existing classes • Full introspection / reflection • Messages can be intercepted and forwarded • à la AOP!
  27. Cocoa Touch

  28. None
  29. None
  30. iPhone Specifics

  31. None
  32. 128 or 256 MB RAM

  33. ~70 MB for the OS!

  34. no swap file

  35. (no virtual memory)

  36. no garbage collector

  37. (manual memory management)

  38. http://cocoadevcentral.com/d/learn_objectivec/

  39. no automatic objects on the stack (C++)

  40. // C++ // Memory freed when out of scope std::string

    name(“Adrian”); std::string *name = NULL; name = new std::string(“Adrian”); delete name;
  41. hygiene

  42. None
  43. memory warnings

  44. None
  45. avoid autorelease

  46. None
  47. None
  48. lazy-loading & reuse

  49. None
  50. custom table cells & reuse

  51. None
  52. override setters properly

  53. None
  54. beware of delegation

  55. None
  56. instruments & static analysis

  57. None
  58. warnings as errors

  59. None
  60. code organization

  61. (cheaper maintenance)

  62. None
  63. iPhone ≠ computer

  64. http://www.flickr.com/photos/oskay/365607662/

  65. http://www.flickr.com/photos/blakespot/2379207825/

  66. http://www.flickr.com/photos/oskay/365607591/

  67. None
  68. books

  69. None
  70. None
  71. None
  72. None
  73. None
  74. None
  75. None
  76. None
  77. None
  78. thanks!

  79. questions?