cakephp or ruby on rails - ruby-on-rails

I've put some of my free time on reading/learning about cakephp but now I'm wondering if will not be better to switch completely to ruby on rails.
Can you give me the good and the bad of those tools, when is about web-development?
many thx

Why switch? Since you've got a head start on CakePHP, take a little break.
Learn some Ruby on Rails for a while, then switch back to CakePHP when the mood strikes you.
That way, in the end, you'll end up knowing two languages/frameworks rather than just one. It's always better to get as much exposure as possible. Each has its benefits and downsides, but why not learn enough to make the decision yourself?

Neither is better than the other. While one may be more suited to particular applications than the other, they are certainly both good frameworks.
PHP is said to be faster, Ruby is objectively a better designed language. These probably make more of a difference than the framework itself - you can always modify the libraries or write your own classes to make the framework do what you want it to.
My advice is to stick with what you know if you are happy with it - learning a new framework is a long process. If you have issues with Cake or you're keen to try something different, Rails is definitely worthwhile.

I recently read a good article from a developer with a CakePHP base who just completed a large Ruby on Rails project.
http://www.jimmycuadra.com/blog/10-from-cake-to-rails
He details where Rails is stronger than Cake but also the other way around. Another blog here compares Ruby and PHP.
http://developingwithstyle.com/articles/2009/06/09/10-reasons-why-ruby-is-better-than-php-reason-5.html

personally i would choose cakephp at this moment. php and mysql are very common on most web hosting packages, even free ones. it is based on php and there is a huge amount of resources to learn and get help from. you can reuse many already written classes.
regarding the speed of cakephp, there are ways how to speed up cakephp in the production environment through the ways you code and caching.

I would choose ruby on rails because
ruby is fun to write
there is a great community
there are more high quality resources like www.railscasts.com and teachmetocode.com

Related

Did we really always need to use Ruby/ rails plugin?

I been intersted in ruby and rails lately but what I always encounter in blog/ podcast / book is they will always teach how to use ruby or rails plugin/ ruby instead of writing one. Did we really always need to use plugin, even thing like authorization? Authenticate? Is it really waste time Or hard to write from start? Then if it hard and waste time why rails say make web development less painful?
Or I was wrong in term of concept? Goal ? Or anything else? Of rails? Anyone can guide me ?
It can be a good learning experience to write your own tagging system, or authentication system, or what have you. That's one argument for "rolling your own".
The argument for using libraries is the "standing on the shoulders of giants" concept. By using popular, actively-developed libraries, you can be reasonably sure that they're well-tested in multiple production environments and are extremely stable. And it gives you more time to focus on your actual application.
As an example, I would be very wary of writing my own system to process credit card payments when there are already full-featured, well-tested alternatives.
I think it really has to do with edge cases. With something you build yourself, you can think of many of the edge cases up front, but there are just as many that you will not be able to think of until you come to them. That's where the time savings comes in.
That being said, if you don't understand how to write an authentication system, then you should probably write your own. Conceptually you should fully understand how the parts of your app work, and if you don't, writing from scratch is a good way to learn. But with things that you already understand, I recommend using a gem.

Rails learn's confusion

This is a beginner's rails learning confusion. When I learn rails, from time to time, I feel frustrated on rails' principle "Convention over Configuration". Rails uses heavily on conventions. A lot of them are just naming conventions. If I forget a convention, I will either use the wrong naming and get unexpected result or get things magically done but don't understand how. Sometimes, I think of configuration. At least configuration lists everything clearly and nothing is in fog. In rails, there seems a hidden, dark contract between you and the machine. If you follow the contract, you communicate well. But a beginner usually forgets items listed on the contract and this usually leads to confusion.
That's why when I first pick up rails, I feel like it is somehow difficult to learn. Besides, there are many other things that could be new to a learner, such as using git, using plugins from community, using RESTful routing style, using RSpec. All these are new and come together in learning ruby and rails. This definitely adds up difficulties for a beginner.
In contrast, if you learn php, it wouldn't be that bad. You can forget many things and focus on learning php itself. You don't need to learn database handling if you know SQL already(in rails, you need to learn a whole new concept migration), you don't have to learn a new decent unit test(in rails, usually they teach RSpec along the way because rails is agile and you should learn test-driven development in the early learning stage), you don't have to learn a new version control(in rails, you will be taught about git anyway), you don't have to use complicated plugins(in rails, they usually use third-party plugins in textbook examples! what the hell? why not teach how to do a simplified similar thing in rails?), you don't have to worry RESTful style.
All in all, when I learn php, I learn it quick and soon I start to write things myself. Learning php is similar to learning C/java. It tastes like those traditional languages. When I learn rails, it is more difficult. And I need to learn ruby as well (I believe many of you learn ruby just because of rails).
Does anyone have the similar feeling as I have? How do you overcome it and start to master rails? Hints will be welcomed. Thank you.
You do need to learn Ruby. Ruby is a language. It has its own quirks. You don't need to learn a lot of Ruby, but you can't learn no ruby and expect to write anything decent.
Next, you do need to learn the Rails conventions. Learning the conventions means that you don't need to learn the Ruby networking classes. If you don't want to learn the conventions, then writing anything of value will be difficult.
It's really no different than learning C# (as a language), then learning an MVC framework, like ASP.NET MVC, or FubuMVC.
Yes, you throw up a anything in PHP, learning a lot less in the process. But investment is valuable. Your education is valuable.
Learning takes time. Modelling is important, and I've seen some ugly Rails code because the authors were poor modellers. Those poor models turned into ugly databases. But it still worked! It met that customer's needs.
You comparision Rails with PHP does not hold, since Rails is a framework and PHP is a language. You should compare Ruby with PHP, or Rails with some PHP framework (I am not familiar with PHP frameworks and do not know an example)
But you are right about the things that 'magically' happen with Rails. I too had problems understanding them and looked many things in the Rails code to see what was actually happening and why.
To learn Rails you should first learn the language on which it is build (like you should do with any framework IMHO), so learn Ruby first. Personally I liked Mr. Neighborly's Humble Little Ruby Book a lot. It is written in a easy and nice way and is not boring/serious like a lot of books on languages.
After that I read/did all tutorials/guides on http://guides.rubyonrails.org/ they covert the (important!) basics and tell about the Rails specific things you are writing about.
When I first heard of Rails the claim was that you could build a web app ten times faster than the other frameworks. I always thought this was an exaggeration.
Most of the conventions are hard to remember if you don't have ten years of doing it the 'configuration' way. So, for someone new to web development it is hard to remember all the conventions and to understand why they are important. I definitely did not see a ten time increase in productivity. Routing, for example, probably started nice and simple but grew more and more complex. I think some effort should be made (perhaps by the people writing Rails books) to not try and throw every capability out there to confuse newbies.

The last 20% in Ruby on Rails

I am (quite) an experienced programmer but totally new to Ruby and Ruby on Rails.
RoR looks great to get working quickly, specially the automatic screen generation for CRUD operations.
It really it gets you productive quickly.
The questions is with the last 20% of the work, when I must finish my application. Won't RoR conventions stand in my way? Because not every database table must be available for all users, and not all users can edit all columns and/or all rows, and the views must be adapted to my site's look and feel, etc.
I understand RoR has been used successfully in live sites, but how exactly do you gain enough speed in RoR to escape gravity after the first phase has been burned out.
I don't think scaffolding gets you 80% there. Scaffolding is nice in that it shows you how the pieces of Rails fit together, but I wouldn't build my application off of scaffolding code. Now that you've been impressed by scaffolding it's best that you forget all about it. :)
Where Rails really shines in my mind is database migrations, the awesomeness of how dynamic ActiveRecord is, and the plugin ecosystem.
There's a lot to learn when deciding to go with Rails. You have a new language, new framework, and new plugins - but if you take the time to learn those things you can be very productive with Rails.
I've been doing ruby on rails for quite sometime. The 80/20 problem is not unique for rails. It applies generally to the entire world. I'm also not aware of any framework that can just do business logic for you.
To answer your specific questions. Conventions will not stand in your way while doing the 20%. Instead, conventions will help you to get through that 20% quicker.
Personally, for user authentication, I use Authlogic. For user authorization, I use Lockdown or Authorization plugin depending on customer need.
I also use inherited_resource in most of my projects to simplify controller code. This is another power of convention.
To increase speed of development, you will not only need to know Rails, but rails gems/plugins that does the right things for you, so you don't have to reinvent the wheels again. Also, knowing Ruby language is a must for quickly develop beyond the 80%.
Ruby Toolbox provides some of the most popular gems and plugins used in typical rails projects targeted at specific domains. You can look through the relevant categories and know what most people use. (And it's probably a good idea to use popular, well maintained gems)
TDD/BDD style development will also help you to speed up in the long run.
Lastly, a warning: If you stray away from rails convention, you will have a painful time in general.
P.S. I used Merb before. My feeling is that conventions helps you in merb, but you won't get too much penalty for not following them in merb. However, my experience with Rails is that if you decide not to follow rails convention while developing rails app, it will come back to bite you in one way or another! So think twice when you really attempted to stray away from rails conventions... (This is from my own experience, and of course subjective, but you can think of it as a warning...)
Won't RoR conventions stand in my way?
Because not every database table must
be available for all users, and not
all users can edit all columns and/or
all rows, and the views must be
adapted to my site's look and feel,
etc.
This is a bit of a non-sequitur. Rails is a framework that has been lifted from real world applications. Those applications had to deal with all those issues also, as well as others you may not have thought of yet. Generally, the conventions make life easier once you learn them.
Another point is that the conventions are merely conventions. You don't have to follow them. You do not even have to use RoR for everything, though I've yet to find a case where I didn't/couldn't, I do generally try to push as much into the DB or cache layers as possible.
I don't believe that you'll ever have a serious problem with Rails conventions. Just stick with the conventions and trust the RoR system. The people behind Rails put a lot of effort into these conventions to support 99% of the common usage scenarios.
If you really need to do something outside the conventions it will eventually get complicated quite fast. However, you are not alone. There are a lots of excellent resources on the net to get help (for example the StackOverflow community).
To sum it up:
Stick with the conventions whenever possible (excellent resource to get started: Rails Guides.
Don't reinvent the wheel. Look for Rails plugins and Ruby Gems instead (don't forget GitHub).
Consult the StackOverflow community if you need something out of the ordinary.
Test all the f***ing time (just for fun).

Django-like framework on Ruby?

Django as a framework is a neat little package. There are very few files (compared to Rails) and it's got a clean structure. The fact that you can plug and unplug apps between different projects is an extremely nifty feature. At the same time, Ruby's hacking ability is unparalleled. It's complete object-orientedness makes it more expressive and fun.
To cut the story short, is there a Django-like or Django inspired framework on Ruby?
If not, would be possible for an implementation of Django on Ruby? What would be the challenges?
If one were to create a Django-inspired framework for Ruby, how would it's Domain Specific Language (DSL) nature come into play?
I've spent a good chunk of my past life using Symfony, which is a PHP framework heavily inspired from Rails. When I saw Django, it came as a bout of fresh air. I'm really curious to know what you guys think and have to say on this.
Update: I stumbled on a framework call Ramaze for Ruby. It seems to be a bare-bones MVC framework with pluggable components for the JS framework, ORM layer and the templating engine. So you could use Prototype / Sequel / Sass, or Mootools / ActiveRecord / XSLT, or any other combination of your choice! As a side-note, Merb is an interesting choice too.
Update 2: I'm sticking to PHP for big-ass commercial projects and Django for my personal projects. Reason why I decided to side with Django was the amount of flexibility it offered. That said, I realized that with greater power comes greater responsibility.
My advice to others: if you know exactly what you want - go with Django. It's probably easier to define things explicitly in it than in Rails. Merb may have been a good choice too, but I didn't have the time to explore it. Django seemed like a good fit and so I stopped being anal about the language I'm using. Thanks for all the help guys!
Try merb, merb-slices, and datamapper is probably the closest you can get in ruby.
I think you need to define a little closer what you mean by "Django-like". Depending on your exact definition, any of these might fit the bill:
Ruby on Rails
Mack
Waves
Merb
Iowa
Is having less files really a deciding factor on choosing a framework?
I agree that keeping track of a smaller number of files is easier on the brain, but I would choose a framework on:
documentation
size of community
maturity
before I woried about file count.

can users who have used both Django and Ruby on Rails give a little comparison of using them?

Duplicate: Django or Ruby-On-Rails?
I have been reading on Ruby on Rails, and it seems like on some threads, some users like Django a lot too?
Can someone who have used both give some insight about using them, such as
ease of use
productivity
fun factor
deployment issues
or any other framework you'd highly recommend?
Both are excellent frameworks. Though, I've found Rails to be more suited for the agile developer. For the most part, you'll run some generators to get the files you need as placeholders for your code. Things will work right away, and you just build up from these conventions. It's really flexible and has a large community, lots of innovation and interesting practices are being put into Rails. It's development cycle seems faster paced than Django.
After only touching the surface with Django, it has some interesting differences. As far as I know, you don't get the schema migrations like Rails has out of the box. But you get an extremely simple CRUD mechanism for your models with the extensible admin interface, which is great for testing/managing content. The entire project is documented really well, from the Django Book to the vast amount of information on docs.djangoproject.com.
I personally prefer the Rails way of doing things. But honestly, you need to try them both to see what works for you, and since we're talking about two very good, yet totally different frameworks, it's a tough decision to make either way. So, if you already know Ruby or Python well enough, start with what you know and just go from there. Once you understand how one works, you'll be able to evaluate the smaller differences yourself. Hope that helps.

Resources