intro to meteor @py gotham aug 15-16 2015
TRANSCRIPT
Intro to @PyGotham Aug 15-16
by @ewenchristie
3 Part Discussion
1. Introduction to2. Patterns in development3. Meteor + Python
What is ?
● 100% Pure Javascript Full Stack● Open Source● Web and Mobile Apps Dev Platform● Focus on apps, Not infrastructure● www.meteor.com
Who backs ?
● Meteor Development Group○ Active development by full time employees
● $20 Million series B - May 2015● Revenue Product: Galaxy (official host)● Meteor platform is opensource (MIT license)
○ You own the code; Host anywhere
The Basics
● Javascript (ES2015)● MongoDB: Node.js
○ https://university.mongodb.com/○ Schema-less Design
● HTML, CSS○ Bootstrap
● Git/GitHub● Node.JS (e.g., asynchronous, callbacks)
Code DEMO● curl https://install.meteor.com/ | sh● meteor create --example todos● cd todos● meteor● meteor mongo● meteor deploy PyGotham2015.meteor.com
Another example:
● meteor create --example localmarket
Architecture
Database Schema Design
Just build App → Let schema evolve
When to Denormalize○ 1 : 1 → embed○ 1 : few → embed○ many : many → link
Reactive Patterns using observeChanges
Meteor.startup(function() {observeChanges
})== OR ==
observeChanges in the top level code.
Example: publish / subscribe// SERVER
Meteor.publish("counts-by-room", function (roomId) {
var handle = Messages.find({roomId: roomId}).observeChanges({ added: function (_id) {
// Do something }, changed: function (_id) {
// Do something } });
})
// CLIENTTracker.autorun(function () {
Meteor.subscribe("counts-by-room", Session.get("roomId"));});
Observe and ObserveChanges
Function parametersmyCollection.find({}).observeChanges({
added: function(id, fields) {//Do something
}});
id = _id in the MongoDBfields → Changed fields only
AtmosphereJS.com
How to use packages
● meteor search <search-terms>● meteor add <package-name>● meteor list● gitHub
○ README.md
Search Patterns
● Search (Google, Yahoo!, Bing)● Find command (CTRL + f)
Page levelDirectory
● grep commandEx: “grep -R signIn --exclude-dir="\.meteor*”
Playgrounds
● Experiment queries on the command line○ meteor mongo
● Create small experiment applications○ meteor create myExperiment
CRUD
● Create● Read● Update● Delete
Production Servers
● yourApp.meteor.com● Digital Ocean● Modulus● Heroku● Galaxy (coming soon)
Meteor + Python
● https://pypi.python.org/pypi/python-meteor● http://meteorpedia.
com/read/DDP_Clients#Python● https://www.youtube.com/watch?
v=zzphV5C_20E
● pip install python-meteor
Challenges
● Unlearning ○ Relational vs. NoSQL○ Iterative vs. Reactive
● Documentation (need more official docs)● Scaling (similar to other platforms)● Keeping up with active changes● Accessibility to online information
Why Javascript?
Geoff Schmidt: Javascript State of the Union
Why learn a new platform?
● Learn a new programming language every year
● Opportunity to learn different points of view○ Examples such as Pythonic approaches○ LearnYouNode○ Security (Why Meteor doesn’t use cookies?)
What’s next?
● Meteor 1.2 (Summer 2015)● Galaxy (production meteor deploy)● REST, microservices, ES2015 modules, +● Reactive Database support for Redis & SQL ● Vote on Meteor’s Roadmap
○ https://trello.com/b/hjBDflxp/meteor-roadmap● Meteor-NY Meetup
Resources
AtmosphereJS.comGitHubATOM.iohttp://js2.coffee/https://www.meteor.com/tools/resourceshttps://github.com/awatson1978/meteor-cookbook
THANKS!