Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object Oriented Design with Ruby

Tags:

oop

ruby

What are some of the best practices for OOD with Ruby? Mainly, how should files and code be organized?

I have a project that uses several classes and files and I am just wondering how it should all be organized, grouped and included.

like image 825
mikeycgto Avatar asked Jul 22 '09 14:07

mikeycgto


1 Answers

It sounds like you're asking which pieces go in which files.

Is your project a Web application? In that case you would most likely use the system of organization imposed by your framework (Rails, Merb, Sinatra, etc.)

Other kinds of projects also have their own typical structure that you can just follow. E.g. gems are usually set up in a certain way.

If it's a console app, there's no strict rule. Usually people put no more than one class or module in a file. You could have one main file that requires all the others.

like image 140
Ethan Avatar answered Nov 15 '22 11:11

Ethan