Wednesday, July 24, 2013

Angular Part 2

So, two months ago I started my Angular Journey. One of my co-workers today asked if I still liked it and I have to say: yes!



Not everyone in my organization loves it though.

The Criticisms
"It is too magical", "The docs kinda suck", "What a weird style", "It hides too much", "It does too much". These are the things that I have heard after introducing it to my fellow coders. These are all people I respect and are all what I consider programmers first. They are generally used to either jQuery or YUI and much more comfortable than I with the innards of Javascript. As a JS n00b and a pragmatist at heart I suppose I don't have the same perception on how things have been done nor should be done in JS. I merely wanted to get things done, period.

To be fair there, Angular can be pretty hard to wrap your brain around: the rendering pipeline and stages are starting to become more obvious in docs and talks but can be pretty strange; data sharing outside nested controllers is not readily apparent; the docs in general need some updating and improving. The underlying architecture is a complicated and crazy beast with timings and event handlers  and is still non-obvious. I have seen the question for how to do something after the directive renders a lot for example.

Part of the problem is also angular-ui(at least for my co-workers). They have built some CRAZY awesome directives and tools that do some very advanced things with not a lot of code. On the flips side, trying to explain the innards of angular-ui to these folks(looking at you $dialog) along with 'resolve' and the rest of it was a major challenge and I don't think I completely succeeded. I have to give the UI folks credit though. It is still a young project that was going through a significant restructure during the course of my project.

I also have to take a good chunk of the responsibility myself. I didn't really understand the framework, nor my audience really, before I tried to evangelize them. Angular is a full complex framework, but it is very well done and well led.

The Positives
The overall structure of the application, and encouraged by angular-generator, plus the clear separation of responsibilities and shear lack of code was a major hit. Also, while I am still learning it, the emphasis on testability was heartily hailed. We like tests here, and have several TDD zealots so I have a feeling that I need to spend more time learning that piece in general. One thing that seemed to calm concerns has been the awesome and active community. The fact that there is so much excitement by the wider community on top of the support from Google gives me confidence that it won't disappear like other frameworks.

My Final Take
After all of this I still really enjoy using this framework. The community, the improving docs, the design and coding standards all allow me to be very productive in not a lot of time. I do wish that the project leads were a little more transparent though. We got lots of fun information about 1.2 and lots of great code is in the unstable 1.1.x series but there has been no RC and no timeline released. I just simply prefer developing against stable branches than unstable ones but there are so many fixes and features in 1.1.x that it makes me impatient. All in all though, as I look back at this and also look at the code we have currently on the site and the lack of code that I had to write my thoughts settle on this:

I am sure glad the Angular people do!

Wednesday, May 1, 2013

The Destro Slacker learns AngularJS pt. 1

(I swear that gif should be my mascot)
Ok, yes I have slacked on my blog. Considering I only had one post, that is a pretty low bar that I managed to miss, but anyway. Today I will start describing my journey with AngularJS.

So, in the interest of full disclosure, I am a front end n00b. My programming background is primarily steeped in the nasty sections of data processing/operations and reporting(humans suck, and so does Microsoft Word). My Javascript and HTML experience at my current gig has been mercifully confined to constructing small widgets and minor template changes. That has changed on my curent project.

Project Setup
Obviously can't get into too much detail but basically the project is an internal tool that will accept a properly formatted CSV file and import it into the Database. The frontend has the responsibility of providing the current database state, displaying available custom pieces of data to paste into said CSV like image locations, and abilities to download the current state of the database into CSV form. The division of labor on this project is not necessarily optimal. The developer working on the background is much better, and much more comfortable, working on the frontend JS than I. She is perfectly capable of doing outstanding work on the backend, but normally that becomes my role because I am so comfortable, however you gotta grow! Now, you may say to yourself(in full Emeril Lagasse voice, though I maybe the only one who remembers him doing this), "Self! Why the f are you making a big production over such a simple app!?" Well, my primary reason is to learn as much as possible. Plus, I am a little "coo coo for cocoa puffs" over Angular. Thankfully my boss is giving me a bit of a leash.

For The Love of the Yeoman
I'll detail my crazy process that seems to occur when evaluating and learning new things later(more really for my own cathartic benefit) but let me just say first that I love Yeoman and Bower and the fun, yet weirdly named, Grunt. Since I am such a n00b these tools have made discoverability and use of web frameworks much nicer and close to backend dev. The only prereqs are Node and its package manager, NPM. One HUGE thing to be aware of, at least on OS X, is that there is a wee permissions issue. After you install Yeoman, check the .npm directory in your home dir. Mine was set to root as the owner and made the rest of the angular uses not work. Other than that Yeoman has provided a very sensible default layout, great support(via Bower) to add other js items easily, and great testing and running of code support via Grunt.

The Zen of Angular
My initial impression of Angular after reading the docs, the tutorial and the great book was that this finally fit my brain. Javascript has always seemed weird and somewhat ugly compared to the happy land of Python. This framework made everything make a lot more sense. However, I was still not prepared for the brain melt that can be Angular. It is a very powerful framework that relies heavily on Dependency Injection and custom HTML attributes and was very orthogonal to any examples that I could find in our codebase. Not to say that is easy to grok either. Our existing structure is, on a spectrum from horrid to nice, based on jQuery and all that entails. Callbacks, custom templates, and heavy heavy DOM manipulation, you get the drift. All on top of, what I feel, is an awkward straddling of server side and client side templates.

Angular on the other hand is a full MVC(or MVVM) framework that even separates itself from others, like EmberJS. It's primary focus seems to be on extending HTML through custom directives and the lovely secret sauce of data binding. The Zen of Angular is all about stopping yourself from pure jQuery style programming and really forcing you to separate DOM modifications(Directives) from view building and population(Controllers) and your base DATA(Models).


More Meat
I promise, seriously, to post more on my journey through Angular Land. Today was officially day 2 of being immersed in a real project for it so my impressions are all rather raw. On a side note, I would like to thank irc user michealw for talking me through some of the issues I was having fitting Angular into my brain. Not only does it seem like it is a great framework, but it has a good community behind it too.



Saturday, March 23, 2013

PyCon is chance to start anew


The 2013 PyCon in Santa Clara was my second ever and my first where I felt like a real programmer. The previous year my company had not released anything running Python yet(though it was working through deployment). Now I have helped pull two large projects through. So, in a way PyCon is my New Year, or a programmer's New Year. It is a time to learn, to celebrate, and to reconnect with the people behind the IRC nicknames. It is also a time to reflect on the past year and dream big dreams for the year ahead. My plan for this blog is to share my journey to realize one of my big dreams: start my own site. I'll share what technology decisions I make, why I make them and the overall journey from the idea and successes to the boneheaded mistakes. Should be fun!