Mandatory Stuff

@dbackeus

github.com/dbackeus

Facing the FUD

Or how gaining confidence changed the way I code.

Actionscript

So I bought a book...

Colin Moock is a Flash and ActionScript expert, considered an 'ActionScript guru' - Wikipedia

Ruby (on Rails)


  • Optimized for programmer happiness!
  • Meta programming!
  • Monkey patching!
  • Reads like english and expresses our thoughts!
  • No ceremony, all action!
  • No semicolons!
  • String has 168 public methods! And that's ok!
  • ActiveSupported String has 271 of them! Even better!

what you say?

"person".capitalize.pluralize # "People"
2.days.ago.beginning_of_day # Sun, 31 May 2015 00:00:00
5.times { puts "Hello" } # for(var i=0; i<5; i++) { console.log("Hello") }
[1, 9, 32].sum # 42
ember_type = "text-module"
ember_type.classify # "TextModule"
ember_type.classify.constantize # TextModule
ember_type.classify.constantize.new # TextModule instance

Incredible people...

MINSWAN
Matz Is Nice So We're Nice
I’ll be straight with you. I want you to cry. To weep. To whimper sweetly. This book is a poignant guide to Ruby. That means code so beautiful that tears are shed.
TDD is dead.
Long live testing.

ActionScript revisited

The return of the jedi

It's not the language

It's the people and the community

And knocking down the barriers can be really hard.

I have been until now a fervent disciple of compositing a graphic instance into a class in every case, rather than making my class extend MovieClip...

But lately my devotion has been shaken and now I am seriously considering extending MovieClip when making any class which has a visual component. Whereas before I would always compose in a MovieClip instance, almost never make my class inherit from anything but my own superclass, and implement interfaces for polymorphism, now I think I will extend, although still implement interfaces for the usual other reasons. I also still plan to be a composition devotee in all other ways - I like composition more than inheritance...

JavaScript

The empire strikes back

Each line should contain at most one statement.
Put a ; (semicolon) at the end of every simple statement. Note that an assignment statement that is assigning a function literal or object literal is still an assignment statement and must end with a semicolon.

But what about your ASI?

JavaScript allows any expression to be used as a statement. This can mask some errors, particularly in the presence of semicolon insertion.
- Douglas Crockford

Relying on implicit insertion can cause subtle, hard to debug problems. Don't do it. You're better than that.
- Google Styleguide

A feeling of deja vu

But what happens if we omit them?

clearMenus()
!isActive && $parent.toggleClass('open')

Conclusion

FUD is not about whether we write semicolons or not.

It's about whether we write code out of conditioning
or express it in freedom through our innate creative force.

Community "gurus" are responsible
for killing or inspiring creativity.

And if someone is trying to bring you down...



When working with a team on a large project, making changes like this cause mass confusion and a lot of lost time. # usernames = YoutubeFeed.pluck(:username) usernames.uniq.sort_by(&:length).join("\n"); usernames.reduce(function(array, value) { if(array.indexOf(value) < 0) array.push(value) return array }, []).sort(function(a, b) { if(a.length < b.length) return -1 if(a.length > b.length) return 1 return 0 }).join("\n") _.(usernames).uniq().sortBy(function(username) { return username.length}).join("\n") _.(usernames).uniq().sortBy(_.property("length")).join("\n") _.(usernames).uniq().sortBy("length").join("\n") usernames.uniq.sortBy("length").join("\n") # feeds = YoutubeFeed.limit(20).all feeds.map(&:pressroom).compact.map(&:url).select { |url| open(url) rescue false } feeds = [ {pressroom: {url: "http://asdf.com"}}, {pressroom: null}, {pressroom: {url: "http://broken.broken"}} ] feeds .map(function(feed) { return feed.pressroom }) .filter(function(pressroom) { return pressroom }) .map(function(pressroom) { return pressroom.url }) .filter(function(url) { return url.indexOf("broken") == -1 }) _(feeds).map("pressroom").compact().map("url").filter(function(url) { return url.indexOf("broken") == -1 }).value() feeds.map("pressroom").compact().map("url").filter(function(url) { return url.indexOf("broken") == -1 })