loading...

How many Models == too many Models?

bizzibody profile image Ian bradbury ・1 min read

Question. How many models is considered too many?

20?
50?
100?

Discussion

markdown guide
 

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.

 

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.

 

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.

 

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.

 

That's really interesting. Thanks @fdoxyz .