Head First C# 243
Michael J. Ross writes "For computer programmers who do not have a solid understanding of object-oriented programming (OOP), learning the C# programming language can be rather challenging, even if they have experience with C or C++, which at least would give them a head start over non-C programmers. Any developer in this situation may well want to begin the learning process with a book that aims to teach both OOP and C# in as gentle a manner as possible, with plenty of patient explanations and illustrative diagrams — such as those found in the book Head First C# by Andrew Stellman and Jennifer Greene." Read below for the rest of Michael's review.
Published by O'Reilly Media on 26 November 2007, under the ISBNs 0596514824 and 978-0596514822, Head First C# is one in a series of "Brain-Friendly Guides." The introduction to this particular book discusses how the series attempts to present the concepts and technical material in a way that is far more intellectually compelling and memorable than the approach currently taken by most books. Some of their guiding principles include: making things visual, oftentimes using novel and even outlandish diagrams; using a casual and conversational style; engaging the reader through exercises and questions; and spicing up the discussions with humor.
Head First C# | |
author | Andrew Stellman and Jennifer Greene |
pages | 778 |
publisher | O'Reilly Media |
rating | 7/10 |
reviewer | Michael J. Ross with Greg Hanson |
ISBN | 0596514824 |
summary | A heavily illustrated intro to object-oriented programming and C# |
On the book's Web page, readers will find links to download the book's sample code, participate in a forum dedicated to the book, register their copy of the book, read and submit any errata (of which there are many), and submit a reader review and read those of other readers.
The book's material is organized into 15 chapters, covering the topics in a progressive order that would probably be most helpful for the inexperienced developer: the advantages to programming visual applications in C# and the Microsoft Visual Studio integrated development environment (IDE); building a simple application to get started; the C# code produced by Visual Studio; basic C# language constructs; an introduction to objects and their components; data types, including arrays and references, and how C# allows you to work with them; protecting an object's data from unintended access, through encapsulation; extending classes through inheritance and subclasses; finding and using class interfaces, and the advantages of doing so; storing data in arrays, lists, and dictionaries; saving data in files and directories, as well as working with file streams and serialization; exceptions and debugging techniques; event handling; how to build complex applications; creating user interfaces with controls and graphics; object destruction and garbage collection; and connecting your C# programs to databases using LINQ. Interspersed throughout the book are three C# labs, which encourage the reader to put into practice their new programming skills, and thus better internalize the ideas of OOP and C# covered in the chapters preceding each lab. The lab applications comprise a racetrack simulator, a simple adventure game, and a re-creation of Space Invaders.
When they see this book for the first time, some prospective readers may be overwhelmed by its size, clocking in at 778 pages. Yet a sizable portion of those pages will read faster than those of the typical programming book, largely due to all of the diagrams and whitespace, which really help to break up the material and make it more digestible. However, what many might perceive to be a strength of the book, could be seen as a weakness by others. In fact, if the unnecessary diagrams and redundant material were to be removed from the book, it might end up only half its current size. But this may only be a deterrent for people who are carrying this book around, or who tend to be impatient and wish to get right to the point of any book they are reading, or who may be upset by the extra trees chopped down to double the number of pages (the book does not appear to have been printed on recycled paper).
Despite Head First C# being clearly intended as an introductory book to object-oriented programming in general, and C# in particular, the target audience especially may be frustrated by all of the errata and other sources of confusion that they will encounter. This is especially true when readers are doing their best to implement all of the sample applications, and struggling when, for instance, the code does not match the figure provided, or even the code on another page. For example, on page 50, the authors instruct the reader to drag a new PictureBox onto a new form, but readers will probably struggle to figure out where to drag it from. On page 105, the authors instruct the reader to flip back and look through the code, to fill in some class diagrams, but they don't clarify what code should be considered. Readers' comments on the online bookseller sites, list far more similar problems. In fact, that there are so many technical errors in this book is quite remarkable given that the technical review team comprised no fewer than 14 individuals! How could so many eyeballs miss so much?
The authors make a real point of reviewing material explained earlier, which generally is an effective approach for this type of book. But the repetition sometimes becomes excessive — enough to annoy even the greenest novice. For example, on page 445, we find the question: "Okay, I still don't get it. Sorry. Why are there so many different kinds of exceptions, again?"
On the other hand, the book has some real strengths, including those mentioned above for making the material more approachable. In particular, when the reader becomes accustomed to the visual style of presenting concepts, he or she will probably find it a faster approach to learning the ideas. Admittedly, veteran developers may still prefer the more narrative style of conventional programming books — especially when they encounter rather convoluted diagrams, such as that on page 292. Yet the illustrations are particularly potent for explaining interfaces, as done in Chapter 7.
Although the book will be of most value to newer programmers, experienced C# programmers will find topics of interest and perhaps even some language details and analysis that they have never previously encountered. For instance, some of the questions posed in the sections titled "there are no Dumb Questions," could be valuable — such as the comparison of File versus FileInfo, and when to use one over the other. Also, some of the utilities could help the reader for future development, such as the hex dumper program on page 432.
Sadly, Head First C# is weighed down by excessive redundancy and an errata-to-number-of-technical-reviewers ratio possibly unequaled by any other programming book. Yet, for any programmer new to object orientation and C#, this introductory book should prove an extremely comprehensible and reader-friendly resource.
Michael J. Ross is a Web developer, writer, and freelance editor. Contributor Greg Hanson is a C# programmer in Fort Collins, Colorado.
You can purchase Head First C# from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Head first, see sharp (Score:5, Funny)
Re: (Score:2, Funny)
> Ouch, my eyeball!
Do not look into C# with remaining eye.
C# is fine, (Score:5, Funny)
Re:C# is fine, (Score:5, Funny)
Re: (Score:3, Funny)
I like Cb better.
Re: (Score:3, Funny)
Re: (Score:3, Funny)
No, that would be Sneaky Pete's Key.
Poor Sneaky Pete. <sniff>
Comment removed (Score:5, Informative)
Re: (Score:2, Interesting)
I never really understood the Head First series
I definitely agree. My first encounter with this series was while looking for a nice C# primer at a local B&N's. I browsed through some of the Head First series and found it difficult to read/follow. I am sure these types of books are for someone, but they definitely did not give me as straightforward approach as I would have wanted.
Re: (Score:2)
Re: (Score:3, Interesting)
How did I not notice that?
Re:Head First seems too limited (Score:4, Insightful)
it just doesn't make sense to invest in a primer that, after you finish with it, is a paperweight.
Except for K&RC2, which you can read for pure entertainment :)
Re: (Score:2)
It would just make more sense to use free Internet resources to take your first steps in C#, and then get O'Reilly's e.g. C# 3.0 in a Nutshell as a good desk reference. Tech books are expensive, so it just doesn't make sense to invest in a primer that, after you finish with it, is a paperweight.
For raw learning, I still find paper easier on the eyes. Plus, its easier to put notes in the margins and read it while waiting for a doctor appt. or the like. E-books and web-pages are better for references, thou
Re: (Score:3, Insightful)
One argument people have against the Head first series is how many pictures and other supposedly pointless material is in the books but it's all about repetition and makes it a bit more fun to read which is what most newbies will want ra
Re: (Score:2, Insightful)
Granted, in this case I don't know the language C#, but in general I never really understood the Head First series, unless you really like printed introductions to languages. It would just make more sense to use free Internet resources to take your first steps in C#, and then get O'Reilly's e.g. C# 3.0 in a Nutshell [amazon.com] as a good desk reference. Tech books are expensive, so it just doesn't make sense to invest in a primer that, after you finish with it, is a paperweight.
You're reading it from the perspective of someone who already has a good knowledge of programming in general, though. While I haven't read the Head First C# book I do have their Ajax book, and while I do not find it to be a good general reference it is great for my high school students to read. They have far less experience programming than I do and they pick up on these easier from the Head First book than they do from most.
Redundent -- read selectively. (Score:3, Interesting)
Re:Redundent -- read selectively. (Score:5, Informative)
Did you read the intro? I have a couple Head First books (preps for Sun's EJB and Servlet exams) and I believe in the intro it states that the book uses repetition of important concepts to make them "sink in".
Re:Redundent -- read selectively. (Score:4, Insightful)
They also state "If you are looking for a reference manual, this isn't for you". So criticizing the series for not being good reference manuals is a bit rich.
That without even touching the fact that, as you mention, they explicitly say they'll be redundant to teach the subjects better.
Re:Redundent -- read selectively. (Score:5, Funny)
I've always found repetition to be a great way to learn and study. Repeating things over and over again often burns it into my mind. If Head First wants to use repetition then more power to them, as I've always found repetition to be a great way to learn and study.
Re: (Score:2)
Re:Redundent -- read selectively. (Score:5, Interesting)
I agree, but at the same time, you have to be careful. Different languages have different takes at things someone may think as "obvious". A while ago I went to an interview for a .NET dev job, and the people interviewing me were very obviously all former C++ programmers recycled in C#. One of the questions they asked me was: "How do you do multiple inheritance in C#".
My answer was the obvious: "There isn't any, you can only inherit from one class". They started arguing with me about how it WAS possible, and actually common, to do multiple inheritance in C#. After a bit of discussion, I realised that they were still thinking in C++ term, where an interface is nothing more than a fully abstract class, so even if you only use "interfaces", you ARE doing multiple inheritance (while in C#, there are -core- differences between a fully abstract class and an interface). They had skipped that part of the book thinking they didn't need it :)
Re: (Score:2)
stuff like this is whats keeping me for fully wrapping my head around programming...
Re: (Score:2)
I'm not sure what you think they are missing. Seems to me they just have another definition of inheritance then you do.
In C++ they were using (mostly) abstract classes to do interface inheritance. In C# they are using, depending on the situation, either abstract classes or interfaces to do interface inheritance en when they next programming language du jour comes along they'll no doubt adapt again.
The fact that there are core differences between classes and interfaces in C# doesn't mean they can't be used t
Re: (Score:2)
The problem was in the context. If they're asking if there is multiple inheritance in C#, it is because they understand that it is an area where there can be confusion in the concepts of the language. Basically, it is a semantic question. And semantically, while a class, in the OOP and/or UML models, can be both "inherited" and "realized", an interface can only ever be "realized", and cannot be "inherited". Thus, saying that you can have multiple inheritance in C# is wrong.
Of course, in practice, as you did
Re: (Score:2)
Interesting, these two lingo's. I have to say I prefer the C++ way since the difference between a realized interface and an inherited class can be purely cosmetic. The tools seem to have taken over the concepts here.
Re: (Score:2)
No the confusion arises because in C# the OO concept of interface inheritance can be implemented either with a class or with an interface and therefore people think they always must mean very different things even when they don't.
Great Series (Score:3, Interesting)
easy way to fill a book (Score:4, Insightful)
Yet, for any programmer new to object orientation...
How many can there be left these days?!? It's too easy to accumulate enough material for a good-sized book by starting from scratch and assuming the reader only knows how to read. Anyone could write a beginner's book on a computer language, without knowing the language too in depth, by just padding it with lots of remedial review material, that 99% of the readers don't need and don't want (to wade thru or pay for).
Re:easy way to fill a book (Score:5, Insightful)
I'm sure more roll off the old assembly line everyday. Just because you and your peers are seasoned vets...
Also, this book came out at a real great time. With MS finally opening up to the hobbyist/novice programmer with their Express edition of their tools there is going to be a lot of n00bs out there.
Sadly, it seems that too many here can't recall when they were still struggling with the concepts of OOP to see that there is a real audience for this level of writing.
Re: (Score:2)
Re: (Score:3)
What do you mean by "every language they have ever used"? These are n00bs. You know, they guys who want to give something beyond VBA in Access a go? I mean real n00bs, not people who started coding in 1993. It's a bit late in the day to automatically put guys who started by learning Java in the n00b category anymore.
Either way, I would rather have people learn object
Re: (Score:2)
Re: (Score:3, Insightful)
Wouldn't the n00bs already be familiar with object oriented techniques since every language they have ever used had OO as a major feature.
Well, not necessarily. As a consultant who's done a fair bit of maintenance coding on projects that I didn't do any of the original development or design for, I can tell you that a surprising number of people use a perfectly good object oriented language to write programs that have only one object or method. (Or similarly technically use an OO language to write code tha
Re:easy way to fill a book (Score:4, Informative)
Yet, for any programmer new to object orientation...
How many can there be left these days?!? It's too easy to accumulate enough material for a good-sized book by starting from scratch and assuming the reader only knows how to read. Anyone could write a beginner's book on a computer language, without knowing the language too in depth, by just padding it with lots of remedial review material, that 99% of the readers don't need and don't want (to wade thru or pay for).
From what I have seen, there are many programmers who do not use OO languages. But what is disturbing is the number of programmers who do use OOP to some extent, but don't use it without even understanding its basic concepts.
Dijkstra used to say that BASIC mutilated programmers' minds. But today, I think that C++ and VB have taken that role.
Re: (Score:3, Interesting)
I would agree with this but only with a bit of qualification. I think that old BASIC programmers still teaching novice programmers OOPLs have done a great deal of damage by bringing their old design concepts into a very different arena of coding. Once you have more and more of the 20+ year OOP coders out there teaching the masses and give those students time to mature will we know if thin
Re: (Score:3, Interesting)
I work with people who don't even proceduralize their code. I've got a report with a 500-line SQL statement in it.
Re: (Score:3, Insightful)
Yet, for any programmer new to object orientation...
How many can there be left these days?
Almost all of them...
Re: (Score:2)
Does anyone have a good book for learning (windows) gui programming in c++?
Re:easy way to fill a book (Score:4, Informative)
Please don't start with C++. It is terribly hard to actually get any good understanding of OO concepts in C++. I'd recommend Java, C# if you must.
I'm not saying to make your career in that language or anything, but to figure out OO--get a language that gets out of your way and lets you see what you are doing. It should have almost no "Syntax" to worry about in itself.
C++ is the opposite. And I've yet to see actual OO C++ code.
Also, GUI programming in C++ (even if you ignore OO) is horrific. It's error prone and completely unnecessary. If you are really really stuck on being as close to the Windows GUI as possible, use C#, otherwise maybe Java.
Sorry, but C++ was the last language created with a legacy where creating the compiler was so hard that you had to adapt the language towards compiler creation/optimization. Many of the features in C++ are simply there so that compilers are easy to write (or are there for legacy to be compatible with compilers made for that reason). A modern compiler/runtime is able to do all the stuff C++ could, and more--and in many cases faster.
On the other hand, if you really want to understand computers and how a programming language works--if you want at the nuts and bolts--go to C, forgo C++ altogether.
Re: (Score:2)
For C++ GUI programming you have to learn the libraries that your OS uses. You have essentially two choices: If you want to learn to do "graphics" grab a book on DirectX or OpenGL. If you just want to learn how to stick a basic GUI onto your CLI programs (text boxes, simple 2-d images, etc) get a book on Visual Studios (Win), X-Code (Mac), or one of the Linux IDEs to learn how to use their various interface builders. You can do a surprising amount in what basically works out to a "WYSWYG" interface desig
Challenging? (Score:5, Insightful)
Why must a well designed language be challenging?
I came at Java with some C plus some experience with a (proprietary) object oriented AI system. Java was trivially easy to pick up.
Re: (Score:2)
Re: (Score:3, Insightful)
C# 1 was quite a simple language. C# 2 added significant complexity (and power, don't get me wrong) and C# 3 has done the same again.
I wouldn't be without the benefits of C# 3, but it does take it away from the "pick it up easily in a week or so" category in my view.
Re: (Score:2)
Why must a well designed language be challenging?
I don't think it is, I think it's far easier to learn than C++ thanks to all the backwards compatibility cruft being out of the way. I'm not sure that's what the author meant either, but that it can be challenging if you don't understand OOP basics. Like C can be challenging to learn if you don't have a good grasp of function oriented programming.
Re: (Score:2)
C# was trivia to pick up with a C/C++/Java/Lisp background.
Re: (Score:2)
I can name 3 good IDEs off the top of my head for java. Eclipse, NetBeans, and IntellJ. Two of which are open source.
With C# you get Visual Studio and the vendor lock in that goes with that.
I could code in C# using Notepad, and wouldn't really have a problem with it if that's all that was available.
Ugh. If you're gonna be on windows and have to use just a text editor and command line tools for coding, at least use something like notepad++ for syntax hilighting on your csharp files
Re: (Score:2)
I imagine it's just the lack of desire to compete with Microsoft.
Technically and probably legally there isn't anything stopping some company from writing another IDE. Developers not toolmakers are the ones that get locked in by choosing C# at this point.
If you go with Java or Python or Rails or PHP or C++ you have a broad choice of vendors for operating systems, platform implementations, and IDEs.
Re: (Score:2)
I don't know that I'd call Monodevelop a good IDE. It's a fork of an early version of Sharpdevelop, not a port.
By contrast, everything that I can do in Eclipse I for Windows I can do in Eclipse for Linux. The different ports have the same features and are released on the same day.
Re: (Score:2)
...and only runs on Windows... So why bother when you have VS.Net for a reasonable price, and VS.Net Express for free?
On Linux, we have MonoDevelop, which was an early fork of SharpDevelop, and IMHO, a complete joke of an attempt at an IDE.
At least with Java you have several first-class IDEs to choose from.
This one of the reasons why, when asked, I'll say the following: .NET
C# is a better language than Java
Java is a far more versatile platform than
(and yes, I regularly use both.)
I like this series as a whole (Score:2)
but this particular book doesn't do anyone any favors unless they are an absolute beginner. I picked it up when I started my current position (.NET shop, lots of C# and *shudder* classic ASP using VBScript) mainly because their books on Design Patterns and Servlets and JSPs were decent. I quickly discovered that if you know just about any other C-style variant that C# is a snap to pick up. This book does a great job of hand-holding and providing lots of examples of classic OO concepts, but I would never
Re: (Score:2)
This book does a great job of hand-holding and providing lots of examples of classic OO concepts
At least one of their Head-First books spouts misleading info related to OOP. It is a coffee-shop example and tries to build a hierarchical class tree of the different coffee "types". There are at least 2 problems with this.
The first is that customers generally prefer a mix-and-match choice rather than be forced to group by hierarchies. Trees are not very flexible in a buffet-like environment or under constant
How come nobody uses anonymous delegates? (Score:3, Informative)
Anonymous delegates came out in C# 2.0 (I think), and now we have lambda expressions. Umpteen ways to do delegates, and hardly anybody I know uses them and gets confused as heck when they see code I write that uses them. It's because F10 through the debugger "looks wierd" when you use them and people aren't used to seeing functions inside functions :-)
There's lots of stuff in C# that people never use.
Re: (Score:2)
I guess Pascal is truly dead then.
Re: (Score:2)
I think that what really sells C# is Visual Studio... I mean with each incarnation of
Yeah, head first. (Score:5, Funny)
Getting head first is the only way I'll program in C#!
C++ != OOP???? (Score:2, Insightful)
"For computer programmers who do not have a solid understanding of object-oriented programming (OOP), learning the C# programming language can be rather challenging, even if they have experience with C or C++..."
If you are an experienced C++ developer who doesn't know enough about OOP to get by in C#, then I'd say you need more help than any mere book is going to provide.
C++ without solid understanding of OOP? (Score:5, Insightful)
For computer programmers who do not have a solid understanding of object-oriented programming (OOP), learning the C# programming language can be rather challenging, even if they have experience with C or C++
Well if you have "experience with C++" but no "solid understanding of OOP", there might already be a problem with your programming skills.
Re: (Score:2)
I disagree. C++ is perfectly capable of being used in a non-object-oriented manner, as are Java and C#. In fact, many people think they are doing OOP just because they use C++, and many people think a project can't be object-oriented if it is written in C. They are both often wrong.
I think I may be the only programmer in the world who first learned OOP from the perl camel book. The way Larry Wall explained it just clicked with me in a way nothing else had. He basically said here are all these concepts
Another recipe book (Score:4, Interesting)
These 700+ page books on programming languages have too much bloat. Usually because they're full of recipes, plus a rehash of introductory programming material.
A really well written 50 page book on C# would be more useful. Especially if it came with a little summary card with the syntax. Code examples should be on an associated web site.
Of course, it's a Microsoft product, so it has "strategic complexity", not minimalism.
Re: (Score:2)
For clarity, because I was confused after reading your comment: C# is a Microsoft product. This book is buy O'Reilly
Re: (Score:2)
Re: (Score:2)
Oh dear:
"Reference types, like objects and arrays, are passed by reference." (P67)
Any book propagating that myth instead of explaining reality (the references are passed by value, which is a different thing) gets little respect from me, I'm afraid. There's a *bit* of explanation on P75, but not enough - and when talking about "ref" it explicitly talks about using it for value types, as if it can't be used for reference types :(
(Yes, I went looking for that specifically. I've found that checking how a book d
Alternate resource (Score:5, Funny)
Re: (Score:2)
You move fast, I prefer the knuckle deep approach when just starting out.
Found this via a story last week (Score:2)
Last week we had that story about Textbook Torrents. This was one of the ones I found there!
Please explain exactly what is wrong with C# (Score:5, Insightful)
Can someone please explain what is wrong with C#? Something other than the fact it was created by Microsoft or simply that it is 'rubbish'.
What features of the language do you have a problem with? Ok, so there's no multiple inheritance. What else?
I've been doing ASP.NET via C# for a living for about 18 months now, and I've found it to be a perfectly servicable language. What's the problem with it?
I hate Microsoft's business ethics just as much as the next /.er. I'm still going to judge their products based on their own merits.
Nothing really (Score:4, Informative)
It's very windows orientated, but that's about all I find wrong with it. Not a problem if you're never leaving Windows land - I find it an excellent language. If you are going outside of Windows, pick a more suitable tool for the job or use mono.
Re: (Score:2)
It's very windows orientated
In what way? Bear in mind that the question was about the language rather than the .NET framework. Certainly some parts of the framework are Windows-biased - but the language itself isn't.
but that's about all I find wrong with it.
Oh there are things wrong with C#, undoubtedly. Or at least things I'd change. For starters:
Re: (Score:2)
I use 2.0, so the extension method thing doesn't effect me (or at least doesn't yet).
I rarely, if ever, use enums, and I've never had a problem with immutable types
I do understand what you mean with the switch/case thing. Who the hell decided that requiring a break for each case was a good idea? What's wrong with designing some cases to fall through into the next case?
Re: (Score:2)
I use 2.0, so the extension method thing doesn't effect me (or at least doesn't yet).
Fair enough.
I rarely, if ever, use enums
Perhaps that's because they're so weak in C#? Being able to specify behaviour (and state - though usually immutable) makes them so much more appealing in Java.
and I've never had a problem with immutable types
The problem is that the compiler doesn't help you with them. It doesn't help you to write them (and prove you've done it correctly); it doesn't help you to implement simple equality/hashing except for anonymous types; there's no way in .NET of declaratively marking a type as immutable to make it clear at a glance to both developers and too
Re: (Score:2)
If you're going to require a break for each case, why require breaks at all? Why not just automatically escape the switch statement when the next case starts?
Re: (Score:2)
Hence my comments of "and no need for an explicit break".
(Not that you always have to have a break, of course - you just have to make sure that the end of the case isn't reachable.)
Jon
Problem at the root (Score:2)
My problem with C# is not in the language itself. It's in the fact that untold manhours have been utterly wasted in cloning Java.
Yes C# has some nice things Java does not have. And if Microsoft has worked with the Java community to add them, imagine what amazing things we could do with the language by now, the very advanced tools that would have arisen with a unifies choice of an essentially VM based language.
But because Microsoft suffers eternally from NIH, we all must suffer an industry a shadow of what
Re: (Score:2)
You know what ASP.NET is, right?
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Well, for a start that's clearly not true in this case - HFC# came out in November 2007. 8 months isn't a year.
However, if you want a review of a more recent book, Jim Holmes has submitted one for my own C# book (C# in Depth) which came out just a few months ago. It's in Firehose right now. Whether it makes it to the front page is a different matter, of course.
Re:If you don't know OOP by now... (Score:5, Insightful)
In that post Linus seems to rail more against C++ and not OOP in general. Good design is good design regardless of a language. You can do OO like design in C or even ASM if you follow some rules.
OO is not a panacea, and just because some is OO doesn't make it a better design than non-OO. Each problem is unique.
Re: (Score:2)
Torvalds was trashing C++ not OOP (though he has trashed OOP before too.) I'm an OOP programmer and I agree with everything he says. C++ is a shit language, but that's not an indictment of OO. C++'s OO is horrible.
Re: (Score:3, Insightful)
Please, elaborate as to how C# is "goo". What exactly do you mean? In the sense that you don't think the language is designed correctly? The runtime doesn't do it for you? The compiler? The type system? The platform itself?
Because "teh M$ goo" is not exactly enlightening, other than in the "I hate Microsoft" sense, which is your prerogative of course, but has nothing to do with the technical merits of their products. Especially when you
base your opinions on incorrect premises, since J
Re: (Score:3, Insightful)
It's M$ goo. It's a "we lost our J++ lawsuit so we gonna rewrap our crap" thingy..
Except it came out better this time.
Flamebait? One could argue not. Admittedly my experience with C# is very limited, but the first time I used it about five years ago, it struck me as as blatant a copy of Java someone could make without getting sued... but without the baggage and with a few nice improvements.
MS don't deserve *too* much credit for this, since (unlike Sun) they were able to benefit from five or six years of someone else's experience when creating their language, but with the ability to start with a clean slate and no backwa
Re:C# isn't a language... (Score:4, Insightful)
So? Linux is a blatant copy of some other *nix.
Open Source software factories are constantly churning out copies of commercial software.
What's your point?
Re: (Score:2)
So? Linux is a blatant copy of some other *nix.
Open Source software factories
(Side point, but what are these "Open Source software factories" that you speak of? I'd have said that- whatever you think of open source- its development model is generally far less factory-like than that of commercial software firms).
are constantly churning out copies of commercial software.
What's your point?
My point was that it wasn't unreasonable to argue that C# could be considered an improvement upon Java.
I then went on to explain why indeed this probably *would* be the case given the circumstances of C#'s birth. Credit to MS for the improvements, but it shouldn't be read t
Re: (Score:2)
Exactly. What he said. I also respect no language that does away with pointers. Heck, I don't really like C++ too much either. Polymorphism, Encapsulation, inheritance and abstraction scare me. Give me a Struct or a Union any day. Of course don't take my ramblings as gospel as I also cut my grass at home w/ a chainsaw.
Re: (Score:2)
I also respect no language that does away with pointers.
Don't Java and C# still feature pointers implicitly via their referential handling of objects?
Re: (Score:2)
Yes. But C# handles pointers in "unsafe" coding areas which then need special permissions =(
I really did make my initial comment well before I had my first cup of coffee (Again, I'll drink Java but won't code in it.) So I hope everyone doesn't get to bent over my ramblings (frick'n MS fanboys! All of ya! Not you dogtanian of course.)
Re: (Score:3, Informative)
Well, if you're afraid of object orientation, there isn't much we can do for you, nor are you the target audience, but you really should try to modern-up your skillset if you code for a living. Once I "got it" i found I didn't want to go back to procedural coding at all.
Secondly, while there are times when points might be nice, the tradeoff (basically, you lose all the safety that a VM gives you) is unacceptable. In C#, you can do method pointers using delegates or reflection (another scary OO concept), and
Re: (Score:3, Insightful)
> but you really should try to modern-up your skillset if you code for a living
Modern? Simula67 introduced an implementation of OO with objects, classes and inheritance in... guess what year?
OO should only be one paradigm in the programmer's toolkit; applying it to all problems is unwise. Procedural, OO, AO, DO, functional, logic; they're all equally valid across an unbounded problem space.
Re: (Score:3, Insightful)
I agree. I don't even let our programmers use pointers in C, except for specific cases where the language is limited (returning multiple values, and char * for strings). If you dump pointers to structures and use more abstract coding, just accessing properties of objects through object references/handles, everything gets better.
In fact, you can also get waaay faster [sourceforge.net].
Re:C# isn't a language... (Score:4, Interesting)
MS don't deserve *too* much credit for this, since (unlike Sun) they were able to benefit from five or six years of someone else's experience when creating their language, but with the ability to start with a clean slate and no backwards-compatibility baggage.
... were able to, but didn't. The difference between C# vs Java was like C++ vs C. C++ and C# basically just add a lot of syntactix mumbo-jumbo onto a plain, reliable, usable language.
Mandatory generics, iterator yield, implicitly typed variables, 'object initializers', extension methods, embedding C++ and SQL directly into the code, operator overloading, implicit conversions, conditional compilation, etc -- none of those C# features actually helps you write better programs, and a lot of the so-called improvements in C# just make it a complicated mess.
The main problem in C++ and C# is that just looking at a statement you can never be sure what it does without poking around a lot of places (in Java a statement always says exactly what it does). A simple statement like "x.y = a[b]" can involve at least 6 different method calls. In Java is always means assign array element to a field.
Like C++, there are some people who will claim more features are better no matter how much more complicated (and generally the 'never enough features' crowd lives in Redmond). But at the rate C# is gaining kitchen sinks I think it will only be a few years until people switch back to Java because it doesn't have all that baggage.
Re: (Score:3, Insightful)
Mandatory generics, iterator yield, implicitly typed variables, 'object initializers', extension methods, embedding C++ and SQL directly into the code, operator overloading, implicit conversions, conditional compilation, etc -- none of those C# features actually helps you write better programs, and a lot of the so-called improvements in C# just make it a complicated mess.
I couldn't disagree more. Leaving aside your mischaracterisation of LINQ as "embedding SQL directly into the code" all of these features can *hugely* improve the readability of code.
Having used both Java and C# extensively, I know which language I prefer by a long chalk. Happily Java 7 will (eventually) gain at least some of the nice features of C#, but unfortunately not all - and it won't get rid of checked exceptions...
I now use Java professionally, but I'm constantly missing the features of C# which cons
Re: (Score:3, Informative)
Um, the features listed by my post's parent.
I don't have time to describe them all in detail here (or, more importantly, how they can improve readability of code) but here are a couple of URLs which give a bit more information:
http://csharpindepth.com/Articles/General/BluffersGuide2.aspx [csharpindepth.com]
http://csharpindepth.com/Articles/General/BluffersGuide3.aspx [csharpindepth.com]
Shameless plug: for a lot more detail, read C# in Depth... (there are sample chapters available at http://manning.com/skeet [manning.com])
Re: (Score:2)
I don't know who this guy is but i like him already.
I'm with Westley... (Score:2)
But what strikes me as ignorant in your post is the OTHER HALF of your analogy.
Following your logic, you're saying:
"[Compared to C] none of those C++ features actually helps you write better programs, and a lot of the so-called improvements in C++ just make it a complicated mess."
I'm not a huge C++ fan. I'd rather have my teeth drilled than take apart a C++ template.
But to suggest that C++ was not substantive is, IMO, ignorant.
I think in both cases -- C++ and C# -- you'd benefit from looking at them as stan
Re:C# isn't a language... (Score:4, Insightful)
We all stand on the shoulders of giants.
Java was not revolutionary, it was evolutionary. Sun certainly had a lot of 'prior art' to guide them when they developed Java.
I'm sitting here wondering what you think made Java so special that it was, by your logic, in a class unto itself? It wasn't the first OO language, it wasn't the first platform-agnostic language, it didn't expose a new and wild syntax, etc.
Java was successful not because it was groundbreaking: It was successful because it took all the best innovations from the existing languages of the mid-90s and coupled them with a familiar syntax and a large and cruft-free library.
The framework ecosystem gave a further boost by giving C and C++ programmers a route to web development that didn't involve terrible pain (CGI) or the loss of self respect (VB Script).
I imagine Anders had similar goals for C#.
Re: (Score:2)
I'd reply to the both of yous, but I'd go over 140 chars.
Re: (Score:2)
Unfortunately it's somewhat out of date. While it does cover C# 2, it was published a year before C# 2.0 (and .NET 2.0) were released - which means it won't be accurate when it comes to things like boxing nullable types.
It also (for obvious reasons) doesn't cover C# 3 at all. But yes, it does look like an interesting book...
Re: (Score:2)
Given that Peter Sestoft was Beta tester on C# 2.0 you can take it for granted that the book covers C# 2.0 as it was at the time of release. If you find anything that is inaccurate in the book I am sure the author would appriciate the feedback :-)
Re: (Score:2)
Given that Peter Sestoft was Beta tester on C# 2.0 you can take it for granted that the book covers C# 2.0 as it was at the time of release.
No it doesn't. The behaviour for boxing changed after the book was published. It was changed in the the August 2005 CTP, I believe.
C# 2.0 was finally released as part of .NET 2.0 in November 2005, over a year after the book was published - which means it's more likely to be about 15 months since the final copy was written.
If you find anything that is inaccurate in the book I am sure the author would appriciate the feedback :-)
I suspect the authors aren't that bothered at this point, given that the book is coming up to being 4 years old.
Mind you, judging by the table of contents, there's very little about nullab
Re: (Score:2)