How many ASP.NET developers program using OO (e.g. using get, set)?

6 years ago I developed and maintained a .Net 1.1 Intranet application that had no get/set.

So how about today? Worth trying the pure OO route?



  • 3
    "Pure OO" is an overloaded term. For example, ruby programmers will tell you that you can't program "pure OO" in C# because int is not an object and + isn't a method. – nikie Feb 16 '11 at 11:11
  • 2
    Why limit it to ASP.NET, how many developers program in any language or environment in a 'pure OO style'. – GrumpyMonkey Feb 16 '11 at 11:35
  • 2
    Since when do you need get/set methods on classes to program OO? You can create your own (like in Java, right?) like getVariable1() and setVariable1(). Here's a summary of stuff which belongs to the OO mindset: en.wikipedia.org/wiki/Object-oriented_programming. – Jan_V Feb 16 '11 at 12:20
  • It's just I was reading this asp.net book, and it briefly went over OO in a few pages, and mentioned properties and get/set code examples. – TeaDrinkingGeek Feb 16 '11 at 14:12
  • Even if you decide to go the Public field route, why is that violation of OO principals? – Morons Feb 16 '11 at 15:29

Your question of "how many" is probably impossible to answer. In general it is certainly a viable option to use OO concepts with ASP.NET. I've worked on some fairly large ASP.NET applications that had many different assemblies divided into tiers with full-fledged OO concepts, patterns, etc. I've also worked with small ASP.NET projects that just "make things work" and have all of the business logic in the myButton_Click handler. And then there are many in-betweens.

You have to decide, based on the project needs, whether the additional up-front investment of "heavy OO" is worth it in the long run. On a sufficiently large project, it might be the only viable option. But smaller projects can definitely "get away" with the quick-and-dirty method and be successful.

Also, as an aside, you seem to equate "get/set" with OO. This is a weak association at best, and certainly not the most core concept with OO. Separation of concerns, polymorphism, encapsulation, etc. are all much more important to OO than get/set.

| improve this answer | |
  • +1 for the heavy OO comment. Rigid OO is it's own expense most times – Bill Feb 16 '11 at 15:59

If you think that using get/set is "pure OO", then you've seriously misunderstood the principles of OO design. You might find http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html helpful to start thinking about OO differently.

Please don't be put off by the fact that that example is in Java. Good OO design is reasonably language agnostic.

| improve this answer | |
  • Sorry my questions wasn't best put. I was just mentioning about what I read today in an ASP.NET book that gave an example of get/set for beginning OO. I just wondered how many ppl actually program that way all the time, especially those who use ASP.NET – TeaDrinkingGeek Feb 16 '11 at 16:49

Today is pretty much the same. Many web developers just make things work. Sad, but true. They are using ready components, and the development is mostly based on "click here, then click there, and F5". Of course the code quality sucks, but somehow it works, so why bother (they think).

| improve this answer | |
  • 5
    I disagree - code is just an artifact of the product. Getting it working is more important than spending three times as long to make your code look beautiful. – Nobody Feb 16 '11 at 15:10
  • 5
    Those "ready components" where made to be used, and SHOULD be used. Using those components make your code better NOT worse. – Morons Feb 16 '11 at 15:16

Having seen many projects over many years, I'd say things are improving. If you think about it, the first ASP.NET developers transferred from classic ASP. Classic ASP had little support for OO programming (though it was big on nested includes), so the classic ASP procedural style transferred to ASP.NET, even though VB and C# were better equipped to handle OO concepts.

Today, many new professionals are trained using OO design and there are a host of open source projects to learn from. More interestingly, I see more functional influences in the last 2 years. Linq is a real game changer.

And yes, more structured design - either OO or functional - is worth it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.