ten commandments
play

Ten Commandments for iPhone Software Development Adrian - PowerPoint PPT Presentation

Ten Commandments for iPhone Software Development Adrian Kosmaczewski akosma software akosma.com github.com/akosma linkedin.com/in/akosma formspring.me/akosma twitter.com/akosma slideshare.com/akosma Some questions Who s new to iOS?


  1. Ten Commandments for iPhone Software Development

  2. Adrian Kosmaczewski

  3. akosma software

  4. akosma.com github.com/akosma linkedin.com/in/akosma formspring.me/akosma twitter.com/akosma slideshare.com/akosma

  5. Some questions

  6. Who ʼ s new to iOS?

  7. Which technologies?

  8. J2EE J2ME .NET Ruby / Rails others?

  9. Which programming languages?

  10. C / C++? Java, C#? Ruby, Python, Lua? JavaScript? Fortran, Lisp, COBOL?

  11. 10 Commandments

  12. http://www.flickr.com/photos/oseillo/345879263/

  13. http://www.flickr.com/photos/justdrew1985/4348527596/

  14. 1

  15. Thou shalt manage memory properly

  16. http://www.flickr.com/photos/blakespot/3030107382/

  17. • iPhone 3G: 128 MB RAM • iPhone 3GS, iPad: 256 MB RAM • iPhone 4: 512 MB RAM

  18. ±70 MB for the OS!

  19. no swap file

  20. (no virtual memory)

  21. http://www.flickr.com/photos/cheek/699407283/

  22. no garbage collection

  23. objects have a “retain count”

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

  25. basic rule:

  26. for every [alloc], [retain], [copy] there must be a [release]

  27. beware:

  28. Objective-C only allows objects on the heap

  29. http://linguiniontheceiling.blogspot.com/2008/10/thats-madame-trash-heap-to-you.html

  30. No automatic objects on the stack (C++)

  31. http://www.futuregov.net/photologue/photo/2008/aug/30/stack-papers/

  32. // C++ // Memory freed when out of scope std::string name(“Adrian”); std::string *name = NULL; name = new std::string(“Adrian”); delete name;

  33. iPhone OS memory warnings

  34. http://www.flickr.com/photos/tbuser/2763035540/

  35. http://akosma.com/2009/01/28/10-iphone-memory-management-tips/

  36. 2

  37. Thou shalt remove all compiler warnings

  38. GCC_TREAT_WARNINGS_AS_ERRORS -Werror

  39. Why Warnings?

  40. • Using deprecated symbols; • Calling method names not declared in included headers; • Calling methods belonging to implicit protocols; • Forgetting to return a result in methods not returning “void”; • Forgetting to #import the header file of a class declared as a forward “@class”; • Downcasting values and pointers implicitly.

  41. Solutions

  42. Make your intentions explicit to the compiler

  43. • Make implicit protocols explicit • Create categories for private methods • Turn implicit type conversions and casts into explicit ones • Use @class in the @interface, #import on the @implementation

  44. http://akosma.com/2009/07/16/objective-c-compiler-warnings/

  45. 3

  46. Honor the Human Interface Guidelines

  47. http://developer.apple.com/iphone/ library/documentation/ userexperience/conceptual/ mobilehig/

  48. Your Objective:

  49. avoid rejections

  50. http://flyosity.com/application-design/iphone-application-design-patterns.php

  51. http://www.smashingmagazine.com/2009/07/21/iphone-apps-design- mistakes-overblown-visuals/

  52. http://www.mobileorchard.com/avoiding-iphone-app-rejection-from-apple/

  53. http://www.apprejected.com/

  54. http://appreview.tumblr.com/

  55. http://kosmaczewski.net/2009/08/03/risk-management-in-iphone-projects/

  56. Your Objective:

  57. avoid this

  58. http://www.flickr.com/photos/gruber/2635257578/

  59. and this

  60. http://smokingapples.com/iphone/app-store-iphone/the-worst-twitter-client-ever/

  61. “ I can ʼ t find one redeeming quality about this app. It ʼ s slow to start [on a 3GS], doesn ʼ t respond to taps while it ʼ s trying to load other things, and crashes if you try to change modes a lot . It ʼ s limited to only timeline, replies, and messages. It has no other functionality. Oh wait… I forgot its killer feature, you can have custom backgrounds and choose the color of your tweets. That totally makes up for its lack of useful features and sluggish performance . I ʼ m not sure why someone would bother building such an inferior app other than that they wanted to find some suckers and score a quick buck. It seems even more insane to me that they ʼ d be actively seeking out reviewers to cover this. I was given a promo code for ChillTwit, and even for free I didn ʼ t want it on my phone . I was sad just from looking at screenshots. Actually seeing it running confirmed all of my fears. If it was a free app, I might forgive the developer, but the fact that he ʼ s trying to get $0.99 out of people pisses me off to no end . Go buy Tweetie. If you somehow weren ʼ t scared away by all my bitching and whinning, you can see ChillTwit on the app store here. But seriously, if you buy this, we ʼ re not friends ” anymore .

  62. 4

  63. Thou shalt optimize for performance

  64. • Drawing and scrolling • Application launch • Files and data • Power and battery life

  65. Drawing and scrolling

  66. • UIView subclasses are already optimized • Custom views should use setNeedsDisplayInRect: whenever possible • Cache static objects

  67. • Use opaque views • Avoid allocating while scrolling • Reuse table cells • Collapse view hierarchies

  68. Application Launch

  69. • Design apps for quick launch and short use • Load data lazily • Load only images needed

  70. Files and Data

  71. • Use Core Data for large datasets • Avoid loading large files in memory • Use plist files for structured static data

  72. Power management

  73. • 3G communications are expensive • Wi-Fi slightly cheaper • Send small chunks of data at low frequency • Prefer “chunky” to “chatty” protocols • Better performance == longer battery life

  74. 5

  75. Thou shalt test in the device

  76. http://blogs.tech-recipes.com/itouchmyiphone/2008/03/26/from-iphone-sdk-to-simple- app-in-less-than-452-seconds/

  77. http://www.flickr.com/photos/edans/1526393678/

  78. • Camera • Accelerometer http://www.flickr.com/photos/tensafefrogs/728581345/ • GPS • Compass • Battery • Network • ... Speed!

  79. http://www.flickr.com/photos/schill/969088410/

  80. http://www.flickr.com/photos/jaytamboli/3788327603/

  81. Keep your old 3G(S) or iPod touches!

  82. 6

  83. Remember your developer tools

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend