# What's the pattern for modularizing / sharing your code?

**URL:** <https://www.ruby-forum.com/t/whats-the-pattern-for-modularizing-sharing-your-code/160008>\
**Category:** Rails\
**Created:** [February 10, 2009, 10:18pm UTC](https://www.ruby-forum.com/t/whats-the-pattern-for-modularizing-sharing-your-code/160008 "2009-02-10T22:18:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmorin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dmorin](https://www.ruby-forum.com/u/dmorin)\
**Post date:** [February 10, 2009, 10:18pm UTC](https://www.ruby-forum.com/t/whats-the-pattern-for-modularizing-sharing-your-code/160008/1 "2009-02-10T22:18:15Z")

</div>

Ok, this is the first time I’ve run across this, but I think they’re  
good problems to have :).

I’ve got a web app out in production. I’ve also got a tool for internal  
use that manages the reporting on that application.

Problem #1: What’s the best practice out there for sharing the model?  
They are entirely separate web apps with entirely different users,  
environments, and purpose - but they both manipulate the same business  
model. Surely there is a way to avoid repeating myself?

Problem #2: With the success of the first production webapp, the boss  
said “Ok, now tell us what it would take to do the exact same thing for  
our other, differently-branded web site.” Ummm…short of “clone all  
the source code” I was a bit stuck for an answer. Here it seems like  
there’d be even more overlap, but I’m not sure about the reality - it  
would be all new views, but also at the very least some new  
configuration to differentiate it from its twin in the database. Is  
there a better answer there?
