r/javascript • • Jul 28 '15

I'm all in.

Post image
746 Upvotes

120 comments sorted by

View all comments

Show parent comments

7

u/[deleted] Jul 28 '15

I just started a JS job after 7 years as an AS3 dev. The transition has been pretty painless.

I love Flash and AIR. But the well is dry. I'll still tinker at home with them for fun though.

1

u/[deleted] Jul 29 '15

Same... still there are plenty of things I miss about Flex like creating quick UI's of any type without having to strangle CSS for hours.

1

u/umilmi81 Jul 29 '15

I got a job as an ASP web developer after being a Unix and Windows application developer for 15 years. I hadn't used JavaScript since it was called LiveScript.

I was shocked at the conventions used. Anonymous functions and single letter variables like "a", "g", and "s" are not only commonplace they are encouraged.

I learned to write self documenting code. Descriptive variables and function names. I tried to buck tradition and declare functions but jquery and knockout are built specifically to use anonymous functions so I have to jump through extra hoops to use them.

I really see the power of JavaScript, but I'm just having a hard time making the transition from a traditional language.

5

u/vexii Jul 29 '15

you only see single letter variables in minified code (i hope)

1

u/umilmi81 Jul 29 '15

Google Analytics and Adobe Omniture both use single letter variables in their example code. I could rename them but again it seems common practice in the industry so I keep the same names.

8

u/vexii Jul 29 '15

i dont know the adobe thing, but GA is just the snippet to paste for analytics.
it common to see single letter variables in most code that gets delivered as "don't read it, just paste it" snippets.

no one writes code like that, we use tools to transform/minify the code after (and use source maps if we need to reverse it)

2

u/[deleted] Jul 29 '15

jquery and knockout are built specifically to use anonymous functions

BS, just because a lot examples (and sadly also a lot of real code) don't name their functions, that doesn't mean it's "build specifically" to use it that way.

No lib I know off encourages, or even enforces, the usage of anonymous functions.

And if you'd ask me, or anyone who'd ever needed to debug js code that's a bit more complex, you should name all your functions.