C# for Java Developers 382
C# for Java Developers | |
author | Allen Jones, Adam Freeman |
pages | 548 |
publisher | Microsoft Press |
rating | 9 |
reviewer | Joe French |
ISBN | 0735617791 |
summary | A comprehensive C# from Java tutorial |
First things first
First of all, let's deal with the Microsoft issue. I was surprised to find that this book even existed given the problems MS has had in the courts recently. I was even more surprised to find that C# for Java Developers is very balanced and does not hype up C# at the expense of Java -- throughout the book there are places where the authors say that "Java is better at this" or "We have no idea what the C# designers were thinking." A refreshing attitude from a company that is not known to be an admirer of Java.I was reluctant to pay for a Microsoft book, but I have to admit that I am impressed. This is the first MS book I have ever purchased, and it is clearly written, well thought-out and very, very comprehensive. One of the best features for me is that all of the instructions for compiling and managing code assume that you are using the command-line tools, rather than Visual Studio. For someone on a tight budget, this was a real bonus.
The Scoop
The first part of the book is an overview of .NET, and contains the boiler-plate description that you get from the .NET web site. Not that useful, but pretty short. There is a chapter that compares .NET to Java (J2SE and J2EE), but again, there is nothing new or important there.
The second part of the book covers the C# language, using Java as a starting point. The coverage seems comprehensive, and explains where the two languages are the same (quite often), where they are different (now and then) and when they appear to be the same, but you are likely to spend a couple of hours tracking down something weird (more often than I would like). I had started playing around with C# before buying this book, and all of the problems that I had in the early days were detailed here with clear explanations.
Part three delves into the .NET class library, covering basic topics such as collections, IO and handling XML. Once again, I was impressed with the depth of coverage and the way in which the authors use Java classes to explain the workings of .NET. It was while I was reading through this section that I realized just how different C#/.NET and Java can be.
The last part of the book covers "advanced" topics. There seems to be little reason for the division between basic and advanced topics, but chapters cover areas such as threading, security and networking. The one thing that is consistent in this part of the book is that there is less of a parallel between Java and C#. For example, "Windows Forms" is used to build client UI applications, but is very different toolkit from Swing/AWT.
The appendix list is a little dull, covering topics like GC and configuration files. There are some interesting snippets, but I got the impression that these were topics that the authors thought were important, but didn't know where else they should go. The exception is the "Java to .NET API Reference" which, for me at least, sets this book apart from the competition. Every class from the J2SE class library is mapped to an equivalent .NET class and a reference to where the topic is covered in the book -- having something like this has saved me hours of searching.
What's to Consider?
This book uses a lot of C# fragments to demonstrate how classes are used, but contains very few full "working" examples. I found this to be great once I knew the basics of C# (because I could focus on the topic), but difficult at first (because I could not play with complete code).
C# for Java Developers covers much more of the .NET Framework than the other books in my local bookstore, but because of this the text can be dense at times, as the authors try and pack in a bit too much detail.
I can't find major fault with this book, and a (small) part of me admires Microsoft for publishing such an unbiased book.
Summary
If you are a Java programmer who wants or needs to learn about C# and .NET, then this is a great book. Don't be put off by the Microsoft logo, and bear in mind that you don't need a copy of Visual Studio to follow the examples.
The book effectively uses Java as a tool to teach C# and explain the workings of .NET. If you are like me, then you will find this book invaluable and will likely keep it close at hand for quick reference.
Table of Contents
- Introducing .NET
- Introduction to Microsoft .NET
- Comparing Java and .NET Technologies
- The C# Language
- Creating Assemblies
- Language and Syntax Features
- Data Types
- Advanced Language Features
- Programming .NET with C#
- Strings and Regular Expressions
- Numbers and Dates
- Collections
- Streams, Files, and I/O
- XML Processing
- Advanced Topics
- Reflection
- Threading and Synchronization
- Networking
- Remoting
- Database Connectivity
- Security and Cryptography
- Graphics and UI
- Introduction to XML Web Services
- Appendices
- Platform Integration
- Shared Assemblies
- Configuring Applications
- Garbage Collection
- Cross-Language Code Interoperability
- Java to .NET API Reference
You can purchase C# for Java Developers from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Terrarium (Score:3, Interesting)
The thing that finally got me to play with C# was Terrarium [gotdotnet.com]. Players create 'creatures' which then compete in a peer-to-peer set of virtual terrariums. You can create plants, herbivores, or carnivores. It was quite fun (in a super geek way) and VERY challenging.
Refreshing indeed (Score:2, Interesting)
Try finding that balance in a Java book, most of which devote all of Chapter 1 to a buzzword parade and list of Java perks (prevents bugs, write once run anywhere, cures baldness, etc).
Java developers should use J#, no? (Score:1, Interesting)
Use that.
Re:C# may not stand for long... (Score:1, Interesting)
Good starting point online (Score:3, Interesting)
This is a great site. If anyone wants to learn C# coming from a C/C++ or Java background I send them here. Shows source in all three languages (where applicable). Good place to start.
I must say I was a hard-core Java fan until I found C#. I must qualify that statement since I develop exclusively for Windows.
If you write code that will only live in the Windows world, you owe it to yourself to check out C#/.NET.
Re:Good Stuff! (Score:2, Interesting)
http://www.ximian.com/devzone/projects/mono
Small SUmmary from page, "The Mono Project is a community initiative to develop an open source, Linux-based version of the Microsoft.NET development platform. Incorporating key
Maligned? (Score:2, Interesting)
It really is just scared developers concerned that anything redmond can cough up is too mainstream and below them...
Take a look at the ecma standards, download mono, and crawl out of your shell.
Re:C# may not stand for long... (Score:2, Interesting)
The
There you go. Pipe that to wc -w and I think you'll find I win.
graspee
Re:Maligned? (Score:1, Interesting)
It's more complex than java, but also more powerful
with managed code. I love delegates, indexers, and properties. Sure, that's all syntactic sugar, but isn't every language up from assembly?
The one thing I would really like is Eclipse support with code completion and nice docs that can be brought up with F1 or whatever For c/c++ stuff I just use vim and just tag all of the system headers, but with lanagues like java and c#
with huge class libraries, code completion and doc help is pretty nice and makes learning a new language fun.
Re:Java developers should use J#, no? (Score:3, Interesting)
However, syntax is often the easiest thing to relearn when switching language. Often much easier than to relearn an entire API. And since J# use the
Re:Good starting point online (Score:3, Interesting)
Couldn't agree more, but the same won't hold for C/C++ which they referred to.
I bet you thought those were direct property accesses, right? I wouldn't expect such a staunch defender of The One True Faith to actually look up the mechanisms of property declarations...
Doh, it being methodized was obvious enough. It just kinda bugged the hell out of me seing
foo.setSize (getSize () + 1);
label.getFont().setBold (true);
Labeled as "typical code" in C++.
And the part which you were obviously referring to as it cannot be done in C++ (because one can't overload
label.font.bold = true
Well, I for one am quite doubtfull wether that is better than what C++ has now
label.font().bold = true
The article goes on and argues that the
Well, I sure don't see the "extra" parentheses harmfull, moreover I'm worried about the complexities of the scoping rules for similarily named fields.
Having read the cursive (italic) parts of the article, I have to say that I don't agree with most of it. And just as my comments here are biased, so is the article. Rants like these don't make good articles. That's why I post my crap here, which would've been a fair idea for that author aswell.
Re:Wow- C# review on Slashdot? (Score:3, Interesting)
No, C# doesn't allow you to write unsafe code, you have to use C++ for that. What's new about C++ in the
You can write UNSAFE CODE [dotnetextreme.com] with C#. Yes, it is mixed in, but it is still unsafe code. See this article for reference.
I never said it runs outside the CLR, just the GC.
Re:Good Stuff! (Score:3, Interesting)
Not quite, since Java is widely implemented. Sun doesn't expend time and money trying to make these implementations incompatible; instead, Sun wants them to be compatible and has test suites available for that purpose. Conversely, Microsoft has a history of prefering their implementation over any others and works hard to drive other implementations into obscurity. Only time will tell if history will repeat itself with respect to efforts such as Mono.
No, but I do consider the amount of risk associated with a technology.
Re:C# may not stand for long... (Score:3, Interesting)
So you can run it on FreeDSD or Linux using Rotor or Mono.
Re:Maligned? (Score:3, Interesting)
I'm pretty sure most of us developers are just a frightful bunch. Ada is an infamously derided language ("oh the government made it, so it's basically a beauracracy of a language") - yet it has more built in support for requirements validation and maintainability. If you look carefully at Ada, it is a pain to work with, but the result can be readily and meticulously examined by people other than the original developers.
If you were a sailor and an exocet was screaming towards your vessel 500 yards out and skimming the waves and the only thing between walking the deck and treading the waves is your Phalanx close-in weapon system, you're probably hoping the software which controls the Phalanx was developed with Ada. Now would not be the time to file a support request because your C++ caused a general protection fault.
So whether it's C# or anything else... I think way too many are afraid of having to re-stock their toolset from scratch. There's comfort in working with what you've always worked with. Insert cliche dinosaur analogy here.
EvanED has it wrong I think. (Score:2, Interesting)
For someone who has done a good deal of research on languages, I find it odd that you should point to four of THE most superficial differences.
Had you pointed to differences between the CLR and the JVM, you might have had an audience.
Instead, you rehashed the oulde argument between C++ and Java. Who won that debate? The people who realized that it was a waste of time to argue THESE points.
EvanED, I wish you well in your research. I would like to point out to you that there is not a junior college on Earth that will give you any extra credit for your penetrating analysis.
Sincerely,
sweet jonnie