[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Objects vs Model Objects

Is there a difference between custom objects and model objects? I see that with ASP.NET MVC they have very streamlined object classes, which they usually hold in the Model Folder. The classes seem to be made-up mainly of Properties, and no real methods. A while back, I learned that objects are made of Properties and Methods, so with Web Forms, should my custom objects be essentially Properties as with many MVC Models, or should I have all my Object specific methods defined in the class?
0
userTester
Asked:
userTester
  • 3
1 Solution
 
käµfm³d 👽Commented:
It depends on your goal. There are various schools of thought on whether or not data objects should have behavior. The main thing would be to pick an approach and stick to it throughout your solutions.

Generally speaking, models don't have methods save for maybe an IsValid method or similar.
0
 
userTesterAuthor Commented:
Thanks for that kaufmed.

So the methods that relate to a data object could be put in a web pages code behind, and the model could be in a separate object.cs file that holds mainly properties?

For example: a Product database table could have a Products web page (.aspx and .aspx.cs), and a separate Product.cs page that holds the model?

There could also be other Helper type classes which might contain methods used by many different objects of the application?
0
 
userTesterAuthor Commented:
Is there any more feedback you can give me with respect to my last comment?
0
 
userTesterAuthor Commented:
Thanks, appreciate your reply!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now