简体   繁体   中英

Is it weird to develop in ruby on rails without using any additional gems

I have always found that a lot of rails developer will usually defer a lot of tasks to gems rather writing code themselves, and sometimes I find myself not using them at all due to the fact that the gems doesn't behave exactly like how I wanted to in some minor way, is this weird to any of you?

Btw, I do use gems that perform cryptographic tasks like bcrypt and mysql2 for database connections but I never find myself using gems like Devise/Authlogic for authentication.

You can forget about Rails and ask yourself - "whether I need standard libraries or do I need to create my own?"

Reuse of existence code is a good practice in the software development.

It is in the Rails philosophy to use gems to not reinvent the wheel and above all to do more with less.

Good gems should be configurable as you could use it for your needs.

You asked whether it's weird?

No, it is not. I often have the same problem to solve. When you use a gem, you often need to adapt it to your needs. When you update this gem, you may need to apply your changes again, or you have a problem when the gem starts to act in a different way you want it.

When you create your own solution, you know it well (so, you don't need to deal with other persons' bugs, just with your own ones), the solution always exactly matches your needs and you change it whenever you need.

The examples of gems you use (bcrypt and mysql2) are the good examples of some very general tasks, which do not need any modifications in the lifetime of your application. You will not need to change the crypto protocols, neither the database connections need application-specific changes.

But the authentication system may require adaptations, so it's better to depend on your own, independent solution. However, you may want to copy 'their' solutions, without making your project dependent on 'foreign' code. The project gnulib takes a similar approach.

UPDATE:

See the article http://www.aidanf.net/rails_user_authentication_tutorial . There you will find a few reasons for writing your own authentication system, explained much better than I tried ;)

I think I agree with the position to not use plugins/gems every time you want to add a functionality in your rails apps.

I feel like some gems or plugins may behave oddly when there are associated with others gems or plugins. I think about the act_as_*, authentification systems..

For example, to build your own tag system, which is quite easy, you can study act_as_taggable and try to write your own. I think the time spent will be the same than having to learn the plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM