DEV Community

Ian bradbury
Ian bradbury

Posted on

How many Models == too many Models?

Question. How many models is considered too many?

20?
50?
100?

Top comments (5)

Collapse
 
dfockler profile image
Dan Fockler

It really depends on your data. If you have too few models you probably have a bunch of weird database columns that are used to check what type of model you have. If you have too many models you probably are abstracting too soon. Like others mentioned it's really what suits your specific project and code architecture.

Collapse
 
ben profile image
Ben Halpern

I don't think there's an upper bound if the broader problem you're solving is not creeping out of control. With success and expansion of the business goals I feel like the number would naturally creep.

Collapse
 
bizzibody profile image
Ian bradbury

I did take a look at the Dev.to code - approx' 70 models. I was starting to get worried as I approached the 40 mark - now I'm a bit more chilled.

Collapse
 
fdocr profile image
Fernando

For reference I still remember DHH shared the stats from Basecamp 3 (2016) and they had 183 models. I can't remember is there's a more recent update on that πŸ˜†

If it's a "small project" I find it very hard to believe there's a need to be closing in on ~100. This still feels like an arbitrary number though and there's always room for exceptions around these, just like setting limits on LOC for classes or methods.

Collapse
 
bizzibody profile image
Ian bradbury

That's really interesting. Thanks @fdoxyz .