Writing High Quality Code
Upcoming SlideShare
Loading in...5
×
 

Writing High Quality Code

on

  • 2,282 views

Jozef Sakalos at ModUX 2013

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

Statistics

Views

Total Views
2,282
Views on SlideShare
1,548
Embed Views
734

Actions

Likes
3
Downloads
6
Comments
0

5 Embeds 734

http://www.scoop.it 629
http://lanyrd.com 84
https://hootsuite.scoop.it 19
https://twitter.com 1
http://www.feedspot.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Writing High Quality Code Writing High Quality Code Presentation Transcript

  • Writing a high quality code
  • Saki Jozef Sakáloš •provide project consultancy and supervision •on-line consultancy, code review, extensions •deliver Sencha Ext and Touch Courses
  • Contact •jsakalos@extjs.eu, jsakalos@gmail.com •Facebook: jsakalos •Skype: jsakalos •Sencha Forums: jsakalos
  • Code Quality
  • 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
  • if(anyOfAbove === “yes”) { codeQuality !== “high enough”; }
  • Quality 1. is degree of perfection of a product 2. is the standard of something as measured against other things of a similar kind
  • High quality code is 1. pleasant to read and easy to grasp 2. abide by standards 3. modular 4. bug-free
  • High quality code is 5. finished 6. clean 7. documented 8. working
  • The code must be pleasant to read and easy to grasp
  • Write the code for another person
  • Ugly code
  • Ugliest code
  • Beautiful code
  • The code must abide by standards
  • Two kind of standards •JavaScript standards •your coding conventions
  • http://jslint.com
  • Do you have a written Code Style Guide?
  • Style Guide •naming conventions •spaces, indenting, commas •how to write docs •how to write file header footer •... and others
  • Sencha recommends naming conventions in The Class System guide
  • Code must be modular
  • Example
  • Task #1: Split the app into small modules.
  • Rule #1: Define and then abide by API of modules
  • Corollaries •controller must not know view internals •view must fire custom events •dynamic view must expose an API •view must not access another view
  • Don’t do it like this Controller View Button ListenHide/Show View Store Record/Field
  • ...but like this Controller View Button View Store setVisible handler custom event updateRecord
  • No more spaghetti code
  • The code must be bug-free
  • The code must be finished Finished === there is nothing more to be done on it if(code.indexOf(“@todo”) !== -1) { code !== “finished”; }
  • The code must be documented see http://github.com/senchalabs/jsduck
  • And, of course, the code must WORK!
  • Questions?
  • Happy quality coding!