Ruby On Rails - webdevelopment wordt weer leuk!
-
Upload
martin-hietkamp -
Category
Technology
-
view
856 -
download
1
description
Transcript of Ruby On Rails - webdevelopment wordt weer leuk!
Ruby on Rails
Webdevelopment wordt weer leuk!
2006
Ruby
Yukihiro Matsumoto
Japan, 1993 …
Ruby
=
object oriented
Class.class
Time.now - 1.day
5.times {print “Hello world!"}
['toast','cheese', 'wine'].each {
|food| print food.capitalize }
Ruby
=
interpreted
Ruby
=
dynamic
metaprogramming / DSL’s
metaprogramming / DSL’s
Filosofie achter Rails
productiviteit
happiness
productiviteit
Optimize forprogrammerhappiness
flow
happiness
productiviteit
Flow = Geen besef van tijd en jezelf meer
Flow = Directe feedback
programmeur
programmeur
Rails:
Change = instant
Flow = Balans vaardigheden en uitdaging
Full-stack MVC framework
Principes
Convention over configuration
Less and more beautiful code
DRY
Flow = Intrinsieke motivatie
flow
happiness
productiviteit
Demo
(eindelijk … )
project structuur(conventions over configuration)
Datamodel demo
Commentsbodycreated_at
1 0..*
Articletitlebodycreated_at
Java Model (Hibernate)
<hibernate-mapping>
<class name="models.Article" table=“ARTICLES">
<id name="id" column="id" type="java.lang.Long">
<generator class="identity"/>
</id>
<property name=“body " column=“body"/>
<property name=“description“ column=“description"/>
<set name=“comments" table=“COMMENTS”>
<key column="id"/>
<one-to-many class="models.Comments"/>
</set>
</class>
</hibernate-mapping>
Article.hbm.xml
public class Article{
private Long id;
private String title;
private String body;
private Set comments;
public Set getComments() {
return markets;
}
public void setComments(Set comments){
this.comments = comments;
}
// getters en setters van andere
// properties
}
Article.java
+ configuratie (o.a. Hibernate)
Rails model
beautiful, agile ...
migrations(tegen de migraine)
unit tests(zijn ingebakken)
Scaffolding
Sagrada Familia (Gaudi), Barcelona
Controller
articles_controller.rb:
class ArticlesController < ApplicationController
def show
@article = Article.find(params[:id])
end
end
URL
http://localhost:3000/articles/show/2
View
app/views/articles/show.rhtml
validations(when you do it, do it safe)
Ajax(it’s magic)
RESTful webservices(constraints are liberating)
Maar?
Schaalt het?
> 500.000 requests / dag> 100.000 users> Draait op 3 servers
11000 requests / seconde!
Rails schaalt toch niet?
11000 requests / seconde!
Niet out-of-the box 11000 request / seconde, maar wel met enige aanpassingen!
Iets voor Wisdom?( ik denk het wel )
Rails sweetspots (volgens de heren @ThoughtWorks …)
• Web 2.0 applications that make use of REST and/or AJAX designs
• Small to medium web-based applications with aggressive time-to-market goals
• Low-cost internal prototypes and pilot applications• So-called "soft layer" APIs on hardened transactional systems
Vragen?