Maximum number of classes in Java

Asked

Viewed 140 times

3

I was doing some exercises of the course and I came up with a question.

If I create a project in Eclipse and in it I will include my classes, assuming that each class is a specific exercise, each with its own methods.

I know that general classes and conventions serve to limit clutter and implement a well-architected structure so that code is easy to understand for maintenance and its own scalability.

But in the meantime...

Is there a class limit that can be included in a Java project in Eclipse? Or does it only depend on hardware limitations?

2 answers

6

There is no theoretical limit, only practical. Not even hardware is the limit, anyone bad will be able to climb well any project, no matter it is the largest in the history of mankind, the real problem is the human scalability to deal with this.

Well done code scale well even without classes, poorly done code scale up to, and mainly, with classes.

2


At first, there is no "limit", it depends on the complexity of your system.

Imagine a bank (financial, in this case). You have several types of accounts:

  • chain
  • saving
  • investment

They are all derived from a saving class, which is derived from an abstract class and a dozen other classes.

An account has an owner. This owner may be:

  • person
  • legal person

And both are derived from other classes. Look how many classes we’ve had so far.

Things get even more complex if we use graphical user interface, databases and the Oracle/Sun/devil API at four. A program can have up to a few hundred classes "per table". And that’s not necessarily good or bad, it all depends on the optimization of your own code and the goal it should accomplish. The only problem, as the Maniero user said, is the human being’s ability to deal with such complexity.

Imagination (and organization) is the limit...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.