I think this is a good question for here but I\'m not 100% sure. Please flag if
ID: 643766 • Letter: I
Question
I think this is a good question for here but I'm not 100% sure. Please flag if it's too vague.
I've worked on many websites where common framework classes are overridden.
Since I work mostly in .net these days examples would include Page, Masterpage, UserControl, DbContext ect. I believe this could apply to any language though.
Sometimes I can see why it's done, I overrode entity framework's DbContext to include some logging code.
Allot of the time though I don't see why these base classes were created. Because I've inherited most of the sites I can't really ask why.
My question: Is it a good idea/practice when creating a new site to Override the common framework classes mentioned above? Would doing so be considered more of an old style?
Explanation / Answer
No it is not a good idea. Unless you are doing a very special job you don't need overriding framework main classes. Problem with rich frameworks i.g. .net and java is understanding the framework takes time based on the parts you mostly use. Only after that, frameworks reduce your work load. These frameworks are designed by top engineers so if you need to overwrite a lot of them, probably you don't know where the feature you are looking for is or how to implement it. I read somewhere time is like money:
You can spend it (doing something)
You can save it (using proper tools)
You can invest it (spending some of it now, to save much more later)