On Github drublic / takeoff-awesome-code
Front-End Developer, Freiburg/Germany
and others: github.com/drublic
Good code style is what matters in your team!
Code smell weakens your project!
Be practical.
2013 is the year you will write awesome code.
To change behavior you need to understand
Biological reasons and logical thinking.
Choice and models of agency.
Social belonging.
Goals and feedback.
Maintenance.
Improve readbility and understanding.
Best practices.
Use resources.
is the year to focus on your coding conventions.
"Bad Code"
not a bug - not technically incorrect
error prone
weaknesses in design
deeper problem in your code
div.gray-button.button-big { color: #bada55; } .button-big { color: hotpink !important; }
$('.class-1').data('select', 1) .text('Select 1').hide(); $('.class-2').data('select', 2) .text('Select 2').hide(); $('.class-3').data('field', 'indication') .text('Select 1');
If it stinks, change it.
citet by Kent Beck in "Refactoring: Improving the Design of Existing Code"
Simplicity
Correctness
Consistency
Completeness
Awww, this is so smart!
var ಠ_ಠ = ლ_ಠ益ಠ_ლ === ☃ ? (☃ + π == 0 ? "\u2603" : ß) : 3.1415926535897931159979634685
Build it awesome.
<div class="article"> <div class="article-header"> <div class="article-headline">Some stupid headline</div> <span class="article-date">04.10.2012</span> </div> <div class="article-body">...</div> </div>
<article> <header> <h1>Some stupid headline</h1> <time>04.10.2012</time> </header> <div class="article-body">...</div> </article>
Naming conventions & robust patterns.
Re-use code.
Use naming conventions.
Decouple things.
var peter = "<div class=\"person\">\ <div class=\"some-classname\">\ </div></div>"; $peter = $('body').css({ display: "block" }).append(peter); var classText = "Douchy Text"; var text = $('.person').find('.some-classname').text(classText);
"Easier to read"-code.
Faster development.
Prevents confusion.
More "real" work.
Set up coding conventions
Detect and eliminate potential code smells
Improve consistently
Writing Awesome Code • TakeOff Conference 2013 • Hans Chr. Reinl / @drublic