KEMBAR78
Introduction to meteor | PPTX
Meteor
An Introduction
Things to discuss
What is Meteor
What is inside
What is reactivity
Reactivity in Meteor
DDP
Minimongo
To use or Not to use
Meteor ?
Full-stack platform, capable for developing modern web and mobile
applications.
Reactive, very useful for realtime applications (messaging system)
Javascript everywhere
What is inside?
Node.js
MongoDB
Socket.io(WebSocket)
Blaze/Angular/React
Lots of packages
What is Reactivity?
Suppose a = b+c
In conventional(imperative) programming, above means a is being assigned the
result of b+c and later, the values of b and c can be changed, with no effect on the
value of a (unless code was called again).
In reactive programming, the value of a would be automatically updated
whenever the values of b and c change.
Example
Imperative Reactive
b=2, c=1 then a= 3 3
b=4, c=1 then a= 3 (unless explicit re-execution) 5
Reactive Style Programming
Is about writing code that
renders values when they are delivered
Not code that
retrieves values so they can be rendered
Data is pushed, not pulled
Reactivity in Meteor
Database (MongoDB)
Server (Publish)
DDP
MiniMongo (Subscribe)
(Client)
DDP (Distributed Data Protocol)
client-server protocol for querying and updating a server-side database and for
synchronizing such updates among clients.
uses the publish-subscribe messaging pattern.
was created for use by the Meteor JavaScript framework.
MiniMongo
Minimongo is reimplementation of (almost) the entire MongoDB API, against an
in-memory JavaScript database.
It is like a copy of MongoDB that runs inside your web browser.
You can insert data into it and search, sort, and update that data.
Minimongo is used as a temporary data cache in the standard Meteor stack.
Advantages/When to use
Reactive data, the data in the templates automatically gets updated, as soon as
changes to the data are made.
Develop with a single language so it works the same way for both client and
server.
Large community, so availability of various open source packages which helps
in developing the app very quickly.
Scalable, meteor comes with its own hosting service, named galaxy, which is
specifically made for meteor, but still a lot more can be done.
Can build mobile and web app, with same lines of code.
Shortcomings/When not to use
Meteor ships all template, CSS and JavaScript code to the client, which means it
may take a few seconds for the first page to be rendered so it is more suited
for a web application, than a website.
In case, the backend functionality is already there, it is better to use some
frontend library than to rewrite server code in JavaScript.
In case, the need is for building a web-service / REST API, without a client.
In case, the web app is not needed to be real-time and since there is a RAM and
CPU cost for providing real-time data sync between the server and subscribed
clients.
Structure
client # client entry point, imports all client code
server # server entry point, imports all server code
imports # is accessible by both client and server
lib # is accessible by both client and server
public # is accessible by client (includes images etc)
private # is accessible by server (includes files etc)
Meteor.isClient #To run in client only,
Imports Structure
startup # startup code, routes, db initialization etc
client
server
api # server methods, publication etc
ui
components # all reusable components in the application
layouts # layout of the application
pages # template
Load Order
1. HTML template files are always loaded before everything else
2. Files beginning with main. are loaded last
3. Files inside any lib/ directory are loaded next
4. Files with deeper paths are loaded next
5. Files are then loaded in alphabetical order of the entire path
nav.html
main.html
client/lib/methods.js
lib/feature/styles.js
client/feature-y.js
client/main.js
Questions ?
Talk is cheap. Show me some
code.

Introduction to meteor

  • 1.
  • 2.
    Things to discuss Whatis Meteor What is inside What is reactivity Reactivity in Meteor DDP Minimongo To use or Not to use
  • 3.
    Meteor ? Full-stack platform,capable for developing modern web and mobile applications. Reactive, very useful for realtime applications (messaging system) Javascript everywhere
  • 4.
  • 5.
    What is Reactivity? Supposea = b+c In conventional(imperative) programming, above means a is being assigned the result of b+c and later, the values of b and c can be changed, with no effect on the value of a (unless code was called again). In reactive programming, the value of a would be automatically updated whenever the values of b and c change.
  • 6.
    Example Imperative Reactive b=2, c=1then a= 3 3 b=4, c=1 then a= 3 (unless explicit re-execution) 5
  • 7.
    Reactive Style Programming Isabout writing code that renders values when they are delivered Not code that retrieves values so they can be rendered Data is pushed, not pulled
  • 8.
    Reactivity in Meteor Database(MongoDB) Server (Publish) DDP MiniMongo (Subscribe) (Client)
  • 9.
    DDP (Distributed DataProtocol) client-server protocol for querying and updating a server-side database and for synchronizing such updates among clients. uses the publish-subscribe messaging pattern. was created for use by the Meteor JavaScript framework.
  • 10.
    MiniMongo Minimongo is reimplementationof (almost) the entire MongoDB API, against an in-memory JavaScript database. It is like a copy of MongoDB that runs inside your web browser. You can insert data into it and search, sort, and update that data. Minimongo is used as a temporary data cache in the standard Meteor stack.
  • 11.
    Advantages/When to use Reactivedata, the data in the templates automatically gets updated, as soon as changes to the data are made. Develop with a single language so it works the same way for both client and server. Large community, so availability of various open source packages which helps in developing the app very quickly. Scalable, meteor comes with its own hosting service, named galaxy, which is specifically made for meteor, but still a lot more can be done. Can build mobile and web app, with same lines of code.
  • 12.
    Shortcomings/When not touse Meteor ships all template, CSS and JavaScript code to the client, which means it may take a few seconds for the first page to be rendered so it is more suited for a web application, than a website. In case, the backend functionality is already there, it is better to use some frontend library than to rewrite server code in JavaScript. In case, the need is for building a web-service / REST API, without a client. In case, the web app is not needed to be real-time and since there is a RAM and CPU cost for providing real-time data sync between the server and subscribed clients.
  • 13.
    Structure client # cliententry point, imports all client code server # server entry point, imports all server code imports # is accessible by both client and server lib # is accessible by both client and server public # is accessible by client (includes images etc) private # is accessible by server (includes files etc) Meteor.isClient #To run in client only,
  • 14.
    Imports Structure startup #startup code, routes, db initialization etc client server api # server methods, publication etc ui components # all reusable components in the application layouts # layout of the application pages # template
  • 15.
    Load Order 1. HTMLtemplate files are always loaded before everything else 2. Files beginning with main. are loaded last 3. Files inside any lib/ directory are loaded next 4. Files with deeper paths are loaded next 5. Files are then loaded in alphabetical order of the entire path nav.html main.html client/lib/methods.js lib/feature/styles.js client/feature-y.js client/main.js
  • 16.
  • 17.
    Talk is cheap.Show me some code.

Editor's Notes

  • #4 Explain current application schema: PHP - Server Angular - Client Mysql - DB
  • #7 https://www.discovermeteor.com/blog/reactivity-basics-meteors-magic-demystified/ http://stackoverflow.com/a/10293760/1371636
  • #8 https://www.slideshare.net/fitc_slideshare/meteor-reactivestyle Client requests and pulls data from server. Server pushes/publishes the data and client subscribes it.
  • #9 https://docs.google.com/presentation/d/1KqPoL2h28ebHSBdm_sHYLAfSSM951d1J-HcXS2jIVec/edit?usp=sharing
  • #10 https://meteorhacks.com/introduction-to-ddp/ Meteor.call Meteor.publish
  • #12 Easy to learn 1 click deployment Easy to install Node is notoriously scalable - 1 million concurrent connections laughs at C10K and in raw terms, Node is faster than PHP. PayPal rewrote with Node.js their account overview page, one of the most trafficked apps on the website and formerly written in Java. The result: double the requests per second, 35% decrease in the average response time, and built almost twice as fast thanks to engineers being able to work full-stack in JavaScript. MongoDB is also highly scalable - used to store petabytes of data and perform billions of operations daily at eBay, FIFA, Adobe, Craigslist, McAffee, Foursquare and others. https://wiki.dandascalescu.com/essays/why_meteor
  • #13 https://wiki.dandascalescu.com/essays/why_meteor https://wiki.dandascalescu.com/essays/meteor_js_vs_the_mean_stack
  • #14 client, server : main.js https://guide.meteor.com/structure.html#javascript-structure