Update notes.md - not finished

Creating an Application 
1. User Story  (no programming language) 
- describe application from perspective of the user "As a user I want to play a game that will prompt me do I want to go right or left? And if I go left I will encounter an alligator…. "
2. Design Doc (basic coding language like if, while, function)
- this is from your perspective of how you want to build what the user is going to do 
     - in order to do this I'm going to need a function to handle the fight aspect, and another one to repeatedly prompt them if they want to go right or left…. 
3. Comments in Code (more specific coding terms and instructions) 
- helps guide your code writing
    - "here I'm going to define a function and it will take these variables and define values"
4. Continually Update these as you change your program  



Front End = 
Browser
HTML, JS, CSS  -- run and compiled on browser locally (always retrieving the newest thing) 

Back End = 
Server
Always active - don't kill it like we do the browser
keeps track of user account and info (so when he logs in he gets whole new set of front in stuff and the same stored server account stuff) 
- what happens if server goes down? = lots of problems w saving data on server --> solve this by using database 

Node.js 
server layer, can host http easily, network communication, run fully in javascript, works nicely w Mongo and other databases
Npm - node package manager

Database  - (mySQL is one)
ACID - most conform to this 
Atomic, Consistent, Isolation, Durability 
Atomic = no half corrupted data, either completes or doesn't go through at all
compresses into small format
retrieve and write data quickly
very difficult to crash 
SQL = any database that takes SQL structured query language 
where username = "alex" --> returns all info that fits that command
every database has its own commands 
problems = if database is updated the code written for it won't work anymore (i.e. change of keywords) , moving all data to different database  

ORM = object relational model 
someone wrote code that will generate the SQL code for you which is huge when you update database

noSQL --> doesn't take SQL but JavaScript
Mongo = database   (Couch Database is another option)
disadvantage 100x slower for writing than SQL and 100x faster for readings but most applications are going to have vastly more readings than writings… if you have an app that does a lot of writing then you need mySQL

What is good code? 
Highly modular - one piece works in a lot of places and can work in other code (libraries are modular)
Separation of concerns - not overlapping interests, diff functions deal w diff parts of the code
Design patterns - common patterns that apply to diff prog languages and frameworks 
Dry - don't repeat yourself, create it once so if you need to change it it will change everywhere else in your code 

CRUD - create, read, update, delete = 4 main operations on any kind of data you will have 

1. Design Patters used to express common functionality 
   - main one we use in this class is (most widely known and used):   Model   View    Controller  --> MVC 
model = raw data 
view = user interface (HTML,CSS on front end, API on back end) 
controller = layer that translates btw model and view --> this one takes the action wanted 
routes = end point - this is user view of the server functionality 
- most of the time we don’t want the model and view to talk to each other (modular, separation of concerns), if you wanted to swap out Mongo database for mySQL it would be easy to do if these are separate which is why you use controller to connect the two instead of them being mixed up 
    - API application programming interface (new way all web architecture talks to each other - most use JSON
    - JSON = javascript option notation, is the format of the data that we transfer around the web
   - APIs allow programmers share code to create new things
   - RESTful - how we interact w APIs, common set of patterns for grabbing data --> get (receive) , post (create), puts (updates) delete (removes)  --> similar idea as CRUD but for APIs 

VIEW      CONTROLLER     MODEL   
Front End   <—   API   —>   Back End  

2.  Conventions that everyone uses but aren't enforced in language, just what community has decided is the best way to write code 

MEAN
framework, collection of library and tools used to create application 
mongoose - front end, a node library that makes connecting to mongo database really easy 
express - back end, abstraction of node (ie. more user friendly version), sits on top of node, it is a library of node, express creates REST verbs (post, put, get, delete)
angular - front end
node - back end
MEAN.js --> auto connects these things instead of having to do it manually --> open source , this is the one the original creator is still working on , has excellent documentation (at meanjs.org/docs.html)
MEAN.io --> split into .js from open source original 

**some of this will look like magic but its important to remember this happens around you in life all the time --> you don't know intimately how your car works but you can operate it 
- valuable to be able to recognize magic and not know what it does and assume it works and leave it be for right now until eventually you understand what it does but might not understand each piece ever. 



- yeoman is a program run through command line to create boilerplate code and you install generators on top of that to create modular code
- use the mean generator to create modules for program —> already creates users for you so you don’t have to make those w a CRUD module separately  
- boilerplate code = code you need every time and more or less all the time w some modifications - great starting place
- npm lets you install libraries on top of node , links your JS files together 
- name your module after the solid object your using like cars then it would be “car” —> generator will create the prompts for each thing (i.e. user module will create “list all users” and “create new user” and its smart and it understands plurals for these)