ramaze

20
Ramaze Alternative Ruby Framework (ra-ma-ze) [email protected]

Upload: andrei-navarro

Post on 01-Nov-2014

4.475 views

Category:

Technology


0 download

DESCRIPTION

Proudcloud Talks presentation

TRANSCRIPT

Page 1: Ramaze

Ramaze Alternative Ruby Framework(ra-ma-ze)

[email protected]

Page 2: Ramaze

My Background

Used Ramaze in 2009 as an alternative to Rails Heterogenous team of developers Some ruby first-timers Problems/resistance with Rails

conventions Built a production app serving 10k+

users

Page 3: Ramaze

Ramaze

Simple, light, modular web framework

MVC Agnostic

Database/ORM (no default) Templating (default Etanni)

Based off of Nitro No set structure

prototypes Dependency: Rack

Page 4: Ramaze

Installation

http://github.com/ramaze/ramaze Maintained by 4 guys

gem install ramaze

Innate Core Ramaze Innate Rack Innate = Sinatra, Ramaze = Padrino

Page 5: Ramaze

Hello World

Simple. One file(4kb) vs Rails (900kb).

Listing 1: hello.rb

Page 6: Ramaze

Run

ramaze start ruby hello.rb thin start Pow, Passenger, Mongrel etc

Rack based

Page 7: Ramaze

POLS

Principle of Least Surprise Law of Least Astonishment It should work because I made it

work No “magic”

Page 8: Ramaze

Freedom

No set structure for organizing your files Flexible BUT: Could lead to messed up code Use what makes most sense to you (and

your team) Sensible defaults

Prototypes ramaze create project

Page 9: Ramaze

Views

Listing 2: view/index.rhtml (using Erubis)

By default Ramaze looks for the template in the path called ‘view’, but can beoverriden via setting Ramaze.options.views = ‘view_path’Add @message in controller

You could also add inline views in your really wanted to.

Page 10: Ramaze

Models

Use any ORM Sequel Active Record Standalone classes

Page 11: Ramaze

Models (cont.)

Simple Model: in hello.rb

*Modify controller to use this

Page 12: Ramaze

Organizing your code

Use prototype Allows opportunity to refactor and build

our code as we go along Ex:

Remove model and controller from hello.rb into separate files

Ramaze.acquire – broken in 1.9.2 as of 5/2011

Page 13: Ramaze

Routing

controllers/another_controller.rb

Looks for views in ‘view/bye/’ view_path/route_name

Page 14: Ramaze

Routing (cont.)

You can also specify routes via configuration regex routes

Page 15: Ramaze

Other Stuff

Layouts Placed in view path Just call layout ‘layout_name’ in controller

to set Helpers

paginate user flash https://github.com/Ramaze/ramaze/tree/master/lib/ramaze/helper

Middlewares

Page 16: Ramaze

Great things about Ramaze

Low memory usage Cheaper than Rails Uses 60% less memory vs Padrino

Freedom Simple codebase Focus on Ruby, rather than the

framework

Page 17: Ramaze

Cons

Outdated documentation Slightly slower compared to Padrino Can’t use Rails specific gems

You can but with slightly more work

Page 18: Ramaze

Still Great Things

Good community Freenode #ramaze Google groups

Know exactly what your code does Know where to place/find your code

(because you organized it)

Page 19: Ramaze

Conclusion

Great to use for smallish projects When server memory is an issue

Great way to help transition developers from other technologies who are used to their “own way of doing things”

Let’s you focus on Ruby Good alternative to Rails, use it when you

are sick of Rails In the end, Ramaze, Rails, Sinatra are tools:

It’s what’s in your heart that counts, use frameworks that make you happy.

Page 20: Ramaze

ENDQuestions?