I have 3 classes
class Backup
end
class Database
end
Class App
end
The backup database has a reference to Database and App, like
class Backup
def getDatabase
Database.create
end
def getApp
App.create
end
end
Similarly Database has a reference to App. Practically, If I am creating a backup object, it create a Database object and an App object.
Today I am deriving only two references, in future I might add new references.
The nested objects I am creating, I might use them or I might not.
I think creating these many nested objects might show impact on performance, I hope you are seeing my point.
How can I avoid performance degradation overtime or do I have to modify my design ?
Any suggestions, much appreciated.
def getDatabase / Database.create / end- does this really create a new database object? Is this method supposed to return this new object? Shouldn't there be just one database object and one app object in your whole application?Database.createimplies a new database object is created each time this method is invoked. Is that true?