The Ruby equivalent of java packages (i.e. namespaces)
is modules.

You can put many classes in the same file, that seems more
of a convenience than anything else. You basically separate
out classes into their own source files when the file becomes
too big.

Other than that you would package/modularize your app the
same way you organise these structures in other languages:

package classes that deal with the same problem domain
together (like UI, persistence, 'service/utility' etc.) and ensure
that the dependencies between packages are kept very clean.

Java has interfaces, (or 'emasculated abstract base classes' to
quote the pickaxe book), which are strongly used in structuring
applications across/within modular boundaries. Ruby doesn't have these
but has something very interesting called mixins - blocks of
implementation that can be incorporated into your classes. I would
encourage you to use these - as they fulfill the java interface role
of enforcing API consistency, despite being totally different.

In any case Ruby LOC metrics and lean syntax mean you are not
 as slavishly devoted to migrating code into other source files/modules just
to retain legibility.

Ultimately, you structure apps in much the same way, guarding against
namespace collisions, mixins add a new dimension that you may or
may not need depending on your application scale.

Rails has totally different packaging best practices however (it enforces
them).

On 8/8/06, Trans <transfire / gmail.com> wrote:
>
> Carl Jenkins wrote:
> > I am attempting to learn ruby and I can not seem to find how I would
> > structure a  ruby application. Not a rails app just a simple ruby app. I
> > mostly have played around by putting several classes in one file and
> > running that.
> >
> > Does one typically put rb files in a package structure like a java
> > application?
> > com.jenkins.util.MyClass?
> >
> > Thanks for your help!
>
> http://i.loveruby.net/en/projects/setup/doc/devel.html
>
> T.
>
>
>