(I am sorry if this isn't the right forum for this sort of question, but there doesn't seem to be a "General Programming questions" forum here... feel free to move it or delete as necessary)
Anyways, I have a lot of programming and C# concepts down, but I'm having a devil of a time coming to grasps with object-oriented programming (I've watched the C# Express videos that deal with it, and the VB.NET ones, and the other ones from LearnVisualStudio.net, but still no luck). I understand the concept of objects, and why it's a good idea to encapsulate methods and such in the object (code reuse ). I also understand about properties and methods and fields, and a little about inheritance (haven't really played with that yet). However, where I'm stuck is that I don't understand *why* OOP is beneficial.
For example, if I'm writing an application to keep track of books for a bookstore, I don't understand why it's better to develop a class definition containing what makes up a book (e.g. ISBN, Author, Title, etc.) and then use properties. What I mean is why is it better to put:
class Book
{
private string m_ISBN;
// other fields, etc....
public string ISBN
{
get { return m_ISBN; }
set { m_ISBN = value; }
}
// Etc... rest of Book class
}
Say the application connects to a SQL Server database, using OOP would you assign the ISBN value from, say, a Dataset to m_ISBN, and then in your actual application, set a textbox to the property For example:
txtISBN.Text = myBook.ISBN; // ISBN is set in the Book class
If this *is* correct, then I'm afraid I don't understand *why* you would want to do that instead of setting the DataSource of txtISBN to whatever dataset you use in the program (assume you have a method that creates and returns the filled dataset), say like this:
txtISBN.DataSource = book.BookInfo(); // BookInfo returns a dataset used to populate my textbox
(I realize I didn't put the full code needed to do this; I hope you understand what I'm trying to ask!)
It just seems like an extra step of work (creating/setting the property in the class) and I must not be getting something, because aside from this concept I *do* understand why OOP is better than structured programming.
Since this is a forum for "real" developers and not wannabe dabblers like myself, does anyone know of any good books that explain in-depth the benefits of OOP and why you would want to use it A lot of the examples I see online explain it, but never show any useful examples that demonstrate WHY it's good to use in a commercial application. Any references or resources would be greatly appreciated.
Thank you!

Confused about some OOP concepts... good resources to learn?
Blicos
Blaine Anderson
Domain Driven Design, Eric Evans discusses at great length why this is better.
Another book geared towards C# for this type of development is coming out from Jimmy Nilsson http://www.amazon.com/gp/product/0321268202/ref=pd_kar_gw_1/102-3319163-1611303 %5Fencoding=UTF8&v=glance&n=283155
Both discuss the domain layer heavily (business objects). But ... it is not always better, often times for a small application hitting datasets directly actually becomes a better solution because its alot easier to develop. A main reason people use domain objects is centralization of functionality and to help remove code duplication (a small app is not necesarily too concerned with such things as if a code is only in 3 places it is nowhere near as unmanagable as if it is in 100 distributed through 22 applications).
Cheers,
Greg
zhargoli
hi,
first of all, properties is not substitution for databinding and every one of them have its own use
like what you said in your example you need a database and nothing more than that , but in other cases the database will not work
textbox that you add to your form is a class how can you use database for that when you design a textbox you need properties to adjust every single instance of it you add independently. like hight width backcolor .... etc and you can't build a textbox's database in your forms so its better to use the oops concepts
also if you found a class do something you need , you don't have to build every thing from scratch you can use that class and if you want to extend it you can with oop
at the beginning you will not use OOP much and may be you will not need it , but later on it will save lots of time to you
hope this helps