Skip to content

Commit f66093b

Browse files
committed
angular writeups for codefellows
1 parent 7dc2c06 commit f66093b

5 files changed

Lines changed: 135 additions & 1 deletion

File tree

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
.grunt
3-
/_book/
3+
/_book/
4+
**/*.sw?

‎angular/angular_part_1.md‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Angular, Part 1: Why Choose Angular?
2+
=========================================
3+
Angular has a lot of advantages over other client side Javascript frameworks.
4+
Here are a handful of reasons that when building an app I turn to Angular first.
5+
6+
Flexibility
7+
-----------------
8+
It's possible to take almost any portion of Angular and use it on its own.
9+
For instance, my front end may not need a full router with the ability to access
10+
a REST api. Maybe I just need a single two way data binding on a single view
11+
and don't want the overhead of a full framework. This is a possiblity with
12+
Angular but not with frameworks like Ember.
13+
14+
Testability
15+
-------------------
16+
Angular was built from the ground with testing in mind. Angular's use of
17+
dependency injection makes it easy to replace any functionality with a mock
18+
or stub. This makes it easier to test a very specific piece of the application
19+
and not the entire framework or app.
20+
21+
Customizability
22+
----------------------
23+
The other advantage of Angular's dependecy injection is the ability to
24+
replace any piece of the framework. Any moving piece of Angular can be
25+
replaced simply by dependency injecting a custom peice of code or a third
26+
party piece of code instead of the pieces that ship with Angular.
27+
28+
Easy-to-Learnability
29+
----------------------------
30+
The learning curve on Angular is very gentle. A programmer can start out
31+
with just a handful of built in directives and some simple controller functions
32+
and add on the more advanced bits as needed. Unlike frameworks that require conventions
33+
in order to operate, Angular lets a developer pick his or her own conventions.
34+
This can potentially be both a curse and a blessing but it jives well with
35+
my particular learning and coding style. Also, Angular does not require a seperate
36+
data model but can use plain old Javascript objects. This means that data
37+
retrieved from an external source (such as a server) does not have to be converted
38+
to an Angular only model structure before Angular can start using it
39+
and there are no new data models and functionality to learn.
40+
41+
It-Stil-Just-Worksability
42+
----------------------------
43+
Despite Angular's flixible and customizable nature, all of the pieces work
44+
well with each other. A controller can easily access the view, a view can
45+
easily save new data to the model through the controller and routing is as simple as specifying
46+
a view, a controller and a url. The only part that has to be explicitly defined
47+
by the programmer is the interaction with the server/REST api. I actually
48+
view this as an advantage because not all problems lend themselves well to the
49+
GET/POST/PUT/DELETE pattern for a single resource. I often find myself needing
50+
just a single end point for a resource and Angular allows me to make that
51+
decision.
52+
53+
For me, Angular is a framework that places an emphasis on modularity, an
54+
iterative learning approach and fine grain testing. As a Node developer I feel
55+
at home while working with Angular. That said, there are always trade offs and
56+
the Rails developer in me wants conventions and structure but I prefer being
57+
able to establish them for myself rather than have someone else decide for me.

‎angular/angular_part_2.md‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Angular Part 2, Getting Started With Angular
2+
=============================================
3+
The easiest way to get started with Angular is to use a <a href="http://yeoman.io/">Yeoman generator</a>. The
4+
code and doccumentation for the Angular generator can be found <a href="https://github.com/yeoman/generator-angular">Here</a>.
5+
While I usually don't reccommend using generators it is a good way to see how the
6+
moving pieces of Angular interact without having to worry about the file structure
7+
or naming conventions of the app. If you don't have npm and node installed look for
8+
instructions for your operating system <a href="http://nodejs.org/">on their website</a>
9+
10+
The first step is to install Yeoman and the angular generator globally, along with
11+
bower and the grunt cli which are used for front end dependencies and build tools respectively:
12+
`npm install -g yo generator-angular bower grunt-cli`. Next create an empty directory and
13+
change into it. Then run `yo angular`, which will ask you a series of questions.
14+
When first starting out I would answer no to using sass/compass unless you already
15+
have it installed and have used it before. Answer no the bootstrap, primarily because
16+
Angular already adds a lot of classes and html bits and having the bootstrap classes
17+
in there as well will only make it more difficult to learn. The last question
18+
asks what other angular parts should be installed, get rid of everything except routes.
19+
20+
The generator will then create a full working Angular app. To run the app, use the command
21+
`grunt serve` which will build all of the assets, start the app and if possible will open the
22+
index page in your browser.
23+
24+
There are three major moving parts to pay attention to in this generated app. First,
25+
there's the app, located in app/scripts/app.js. This file contains the base level app
26+
and the routing information using $routeProvider. Each .when statement contains the
27+
url to watch for, and the view and controller to render when a user navigates to that
28+
url. The next parts to look for are the views and controllers. The view are located
29+
app/views and the controllers are located in app/controllers. To create a new view use the
30+
command `yo angular:view <name of your view>` this will create a .html file in app/views
31+
with the specified name. To create a new controller just use `yo angular:controller <name of controller>`.
32+
This will create a basic controller in app/controllers with the specified name.
33+
34+
These are the minimum three pieces needed to create a single page web application. A router, some views
35+
and some controllers. Angular doesn't have a specific model construct as it just uses
36+
plain old javascript objects. Beyond these basics Anuglar has a host of features
37+
designed to increase the modularity and reusability of your code. The most important
38+
of these features include filters for transforming data or information in views (such as displaying 5.2 as $5.20).
39+
There are services for performing tasks across controllers, views and any other place that
40+
needs some reusable code. Finally, there are directives, which allow programmers to write portable
41+
code that interacts directly with the DOM. Documentation on each of these mentioned
42+
pieces of code can be found at the <a href="https://angularjs.org/">official Angular website</a>
43+
and there are Yeoman generators for each.
44+
45+
That should get you started with Angular, obviously this doesn't inlcude everything or how
46+
to actually build full web application. Part 3 will be on how to find more information about
47+
Angular and how to stay up to date on the latest Angular trends and developments.
48+

‎angular/angular_part_3.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
10 resources for learning more and keeping up to date
2+
==============================================================
3+
* <a href="https://docs.angularjs.org/tutorial">Official Angular Tutorial</a> While not especially easy to follow this tutorial
4+
has a ton of great information in it.
5+
* <a href="https://www.ng-book.com/">The ng-book</a> This book isn't cheap but it is the most
6+
comprehensive book on Angular that I've found.
7+
* <a href="http://pluralsight.com/training/Courses/TableOfContents/angularjs-fundamentals">Plural Sight: Angular Fundamentals</a>
8+
A plural sight subscription also isn't cheap but this video series is great and they do have a free trial that will get you through most of it.
9+
* <a href="https://www.codeschool.com/courses/shaping-up-with-angular-js">Code School: Shaping up with Angular</a>
10+
Another subscription service with a free trial. This is a great interactive introduction to Angular.
11+
* <a href="http://todomvc.com/architecture-examples/angularjs/#/"Angular TODO MVC<a>
12+
TODO MVC is amazing, a great resource to learn any client side javascript framework.
13+
* <a href="http://www.thinkster.io/angularjs/GtaQ0oMGIl">A Better Way to Learn Angularjs</a>
14+
A great easy introduction to Angular with links to more in depth resources.
15+
* <a href="https://docs.angularjs.org/guide/di">Dependency Injection<a> One of the fundamental pieces of Angular is
16+
Dependency Injection and understanding how it works is a necessity for any serious Angular Developer
17+
* <a href="http://javascriptjabber.com/109-jsj-dependency-injection-in-javascript-with-vojta-jina-misko-hevery/">Javascript Jabber: Dependency Injection</a>
18+
An episode of the Javascript Jabber podcast with Misko Hevery, one of the original developers of Angular. This episode focuses on Dependency Injection both
19+
in Angular and as a general pattern.
20+
* <a href="https://egghead.io/">Egghead.io</a> Contains both free and subscription based "pro" videos on Angular and many other
21+
web development tools.
22+
* < href="https://github.com/jmcunningham/AngularJS-Learning">A Link to More Links</a>A github repository full of
23+
links to great Angular.js resources.

‎server.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var express = require('express');
2+
var app = express();
3+
app.use(express.static(__dirname + '/public'));
4+
5+
app.listen(process.env.PORT || 3000);

0 commit comments

Comments
 (0)