Your SlideShare is downloading. ×
Writing High Quality Code
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Writing High Quality Code

2,262
views

Published on

Jozef Sakalos at ModUX 2013 …

Jozef Sakalos at ModUX 2013
http://moduxcon.com

Published in: Technology

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,262
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
6
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Writing a high quality code
  • 2. Saki Jozef Sakáloš •provide project consultancy and supervision •on-line consultancy, code review, extensions •deliver Sencha Ext and Touch Courses
  • 3. Contact •jsakalos@extjs.eu, jsakalos@gmail.com •Facebook: jsakalos •Skype: jsakalos •Sencha Forums: jsakalos
  • 4. Code Quality
  • 5. Code must work, but •fixing a bug introduces (many) new bugs •a new developer cannot (easily) comprehend the code •implementing changes/features is (extremely) difficult •no, or not up-to-date documentation •cross browser problems
  • 6. if(anyOfAbove === “yes”) { codeQuality !== “high enough”; }
  • 7. Quality 1. is degree of perfection of a product 2. is the standard of something as measured against other things of a similar kind
  • 8. High quality code is 1. pleasant to read and easy to grasp 2. abide by standards 3. modular 4. bug-free
  • 9. High quality code is 5. finished 6. clean 7. documented 8. working
  • 10. The code must be pleasant to read and easy to grasp
  • 11. Write the code for another person
  • 12. Ugly code
  • 13. Ugliest code
  • 14. Beautiful code
  • 15. The code must abide by standards
  • 16. Two kind of standards •JavaScript standards •your coding conventions
  • 17. http://jslint.com
  • 18. Do you have a written Code Style Guide?
  • 19. Style Guide •naming conventions •spaces, indenting, commas •how to write docs •how to write file header footer •... and others
  • 20. Sencha recommends naming conventions in The Class System guide
  • 21. Code must be modular
  • 22. Example
  • 23. Task #1: Split the app into small modules.
  • 24. Rule #1: Define and then abide by API of modules
  • 25. Corollaries •controller must not know view internals •view must fire custom events •dynamic view must expose an API •view must not access another view
  • 26. Don’t do it like this Controller View Button ListenHide/Show View Store Record/Field
  • 27. ...but like this Controller View Button View Store setVisible handler custom event updateRecord
  • 28. No more spaghetti code
  • 29. The code must be bug-free
  • 30. The code must be finished Finished === there is nothing more to be done on it if(code.indexOf(“@todo”) !== -1) { code !== “finished”; }
  • 31. The code must be documented see http://github.com/senchalabs/jsduck
  • 32. And, of course, the code must WORK!
  • 33. Questions?
  • 34. Happy quality coding!