Mandatory Stuff – Facing the FUD – Actionscript



Mandatory Stuff – Facing the FUD – Actionscript

0 0


overcoming-fud-presentation


On Github dbackeus / overcoming-fud-presentation

Mandatory Stuff

@dbackeus

github.com/dbackeus

Facing the FUD

Or how gaining confidence changed the way I code.

FUD = Fear Uncertainty Doubt

Actionscript

Started my programming career about 10 years ago doing Flash development in Actionscript. It was around the time Actionscript 2.0 was released together with Flash 6.

So I bought a book...

Written by this guy who had worked at Macromedia since 2000. And I learnt a lot from this book (show code)
Colin Moock is a Flash and ActionScript expert, considered an 'ActionScript guru' - Wikipedia So naturally, being a noob, I took his words as gospel. And I tried to follow what he teached. At the same time I started feeling more and more that I was writing a lot of code which neither expressed anything useful, nor did it seem to add any necessary logic.

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...

MINSWANMatz 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

Show code difference...

It's not the language

It's the people and the community

And knocking down the barriers can be really hard.

Ruby and Javascript are fairly similar But the community leaders are extremely different

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 FUD detected, conditioning and ego tactics! Let's learn about semicolons!

A feeling of deja vu

https://goo.gl/BPNqLc

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.

Let's strive to be nice, patient, accepting and encouraging.

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

Be a Jedi!

Thank you 💗

Why's Poignant guide to Ruby: http://mislav.uniqpath.com/poignant-guide/

PR with Crockford bugfix refusal: https://github.com/twbs/bootstrap/issues/3057

Matz is nice so we are nice: http://blog.emmacodes.com/post/55841830917/minswan

JSHint asi option: http://jshint.com/docs/options/#asi

Semicolons technical overview: http://inimino.org/~inimino/blog/javascript_semicolons

Open letter to JS leaders: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding

Confessions to a guru: http://www.moock.org/blog/archives/000248.html

Semicolon walkthrough in Babel: http://goo.gl/qjYEJ7