|Beginning Object-Oriented Programming with C#|
Author: Jack Purdum
C# is a great language to learn object-oriented programming because it has so many sophisticated features that it can be used to illustrate most of the ideas that are essential to OOP.
This book aims to teach the complete beginner the C# language and cover the ideas of object oriented programming. With a language like C# it is difficult to see how you can avoid a discussion of objects. It is almost impossible to write a purely procedural or functional program in C#.
Ideally it should be possible to introduce the key ideas of programming and then delve into objects and the more theoretical ideas that are behind the dominant programming paradigm. In this book we tackle both at the same time.
Jack Purdum starts off with a look at the history of Object Oriented Programming (OOP). He then shows how to download the trial version of Visual Studio 2012, which isn't ideal. The reader would be better with the appropriate version of Visual Studio Express depending on which OS they are using.
Chapter 2 is called Understanding Objects and it takes the approach of explaining what objects are in the real world and then relating them to objects that you can create from classes. This is unnecessarily abstract. The C# environment has a designer that lets you instantiate classes from the Toolbox and this is a much simpler way to introduce objects. You can then move on later to classes that don't have a visual representation. Also the discussion of class and its relation to object seems too detailed and too concerned with the underlying hardware. For example, it uses the idea of allocating objects at addresses - does the beginner really need to be confused in this way when first learning an abstract idea?
The whole account reflects how the author thinks about objects and not the best way to introduce a complete beginner to the ideas. After creating an object the chapter goes on to consider assignment to properties and the general property notation. The chapter closes with a simple example of using an object. In this example we meet a lot of ideas that haven't been explained yet.
Part II of the book opens with a look at data types and this is a classical approach to variables - integers, floats, money etc. For a beginner this is unnecessary at this early stage. Chapter 4 is about C# statements - expression, operators, variables and so on. The topic of debugging is also introduced and the chapter closes with a look at defensive coding. Again, if the book really is intended for the complete beginner, this is unnecessary at this early stage.
Chapter 5 dives into reference types. A look at strings and everything you can do with then serves as an example of a reference type. DateTime is also discussed.
Chapters 6 and 7 finally get to flow of control with a look at the if statement and loops. This is quite a good introduction to the key ideas of programming. It is a shame that you have to wait until halfway through the book to meet them.
Part II of the book draws to a close with a look at arrays and collections. Again a difficult subject for a beginner to cope with in all its glory. Much better to introduce strings and arrays briefly and then later expand the ideas when the basics have been grasped.
Part III of the book is more about classes and objects than basic programming. Chapter 9 introduces the idea of scope and some general ideas of class. It ends with a brief look at UML - again not something that the complete beginner necessarily needs to meet at this early stage.
Chapter 10 explains constructors, getter and setters and ends with an example of a UML-based design of a card deck. Chapter 11 moves on to exception handling and debugging and Chapter 12 introduces generics - again an advanced idea for an introductory book.
Part IV is about storing data and here we meet basic file handling and, amazingly, SQL. SQL is an important tool and you can't really do without it, but a real beginner would be finding it hard enough learning C# without having to learn SQL as well. The next chapter even introduces LINQ, which has to be considered an add-on skill and not really core C# programming - but this is a matter of taste and some beginners may be advanced enough to cope by this point in the book.
The final part of the book is called "Advanced Topics". Chapter 16 explains inheritance and polymorphism. If the book is really about object-oriented methods this can't really be considered advanced. One of the big motivations for OOP is code reuse via inheritance and while inheritance can become complex, you really do need to know about it - if only to understand the documentation of the framework.
Chapter 17 introduces printing and threading - and I'm not at all sure why. A mention of the idea of threading is worthwhile in a beginner's book, but not necessarily with as much coverage as it gets here. The final chapter on web programming is even more mystifying. A single chapter on ASP.NET isn't enough to really get anywhere and, given that Microsoft doesn't even seem to be sure that this is the way to create websites anymore, it seems even less appropriate.
Overall the book isn't suitable for the complete non-programming beginner. It simply tackles ideas in the wrong order and introduces far too many ideas that could be avoided until the basics are better understood. Its approach to introducing classes and object right at the very start to then deal mostly with non-object matters of C# isn't helpful.
If you do know a little programming then you might find the introduction to OOP works for you but again the "scatter gun" approach to topics just doesn't hang together. This is a shame because when you get down to reading a section on a single topic the explanation is often very good, even if it does have a tendency to deal in low-level implementation rather than the best way to think about what is happening.
There are better books on introductory C# and better books on introductory OOP. If you want a book that does both, but doesn't quite do either well, then this might be the book for you.
|Last Updated ( Wednesday, 10 September 2014 )|