help with basic OOP and asp.net

T

tony collier

i am learning c# and trying to use it to do a asp.net project at the same
time. one of the biggest problems i have had was getting to understand all
this OOP stuff since i last programmed in assembler, basic and pascal. i
understand most of the theory but have had difficulties in breaking down
projects into creating appropriate classes, and I am really struggling to
see where classes fit in with codebehind asp.net routines that do simple
things like process form entries.

Am i right in understanding that OOP practice of seperating classes into
seperate .cs files don't apply to asp.net and that every aspx page can only
have one codebehind file associated with it, and that in general OOP
programming isn't really applicable to codebehind pages.

Do you guys who do a lot of asp.net find yourselves mostly writing small
functions and loop and routines that simply modify response html rather
than creating large OOP environments with your codebehind files?

Any advice/links to articles would be greatly appreciated.
 
N

Nicholas Paldino [.NET/C# MVP]

Tony,

You hit upon a good point, the fact that page processing starts off as a
procedural operation. However, that doesn't mean that you can't use OOP
^within^ the procedure to perform your work. It is still a good idea to
separate out functionality into logical groups/entities (classes). This
promotes their reuse, and not only could you theoretically use these classes
in just your ASP.NET code, but any other application code as well.

Personally, I prefer creating reusable object libraries, but that's just
me, I'm a stickler for good design.

Hope this helps.
 
M

Martin Dew

Similar to Nicolas, I tend to break as much as possible into reusable code
so that if at any time I want to make a windows gui or asp.net portal then I
have got one set of classes for data access, business objects etc. then I
can simply apply the front end to it.

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top