Slashdot Mirror


C# for Java Developers

joefrench writes: "It might seem strange to review a C# book on Slashdot, especially one published by Microsoft, but I felt that there must be a lot of readers like me -- programmers who know Java, but want/need to learn something about C# and .NET. C# for Java Developers aims to teach experienced Java programmers how to write in C#." Joe outlines what he considers the book's good points (many) and weak points (few) in the rest of his review, below. 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

  1. Introducing .NET
    1. Introduction to Microsoft .NET
    2. Comparing Java and .NET Technologies
  2. The C# Language
    1. Creating Assemblies
    2. Language and Syntax Features
    3. Data Types
    4. Advanced Language Features
  3. Programming .NET with C#
    1. Strings and Regular Expressions
    2. Numbers and Dates
    3. Collections
    4. Streams, Files, and I/O
    5. XML Processing
  4. Advanced Topics
    1. Reflection
    2. Threading and Synchronization
    3. Networking
    4. Remoting
    5. Database Connectivity
    6. Security and Cryptography
    7. Graphics and UI
    8. Introduction to XML Web Services
  5. Appendices
    1. Platform Integration
    2. Shared Assemblies
    3. Configuring Applications
    4. Garbage Collection
    5. Cross-Language Code Interoperability
    6. 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.

10 of 382 comments (clear)

  1. C# may not stand for long... by FortKnox · · Score: 4, Insightful

    Now, C# is a pretty language. MS looked at Java and started on their list... "This is good in Java, lets include it. This isn't, lets either not include it or make a nicer alternative." They made quite a nice, competitive language.

    But I think C# will be used to convert the C, C++, and Java crowd into the .NET framework. Now, once you are in the framework, you'll see that VB.NET is easier to use, has the OO that Java/C++ people desire, and can make the deadlines easier to make.

    Yeah, I think C# is MS's way to convert everyone to VB.NET.

    Luckily, .NET isn't as platform independent as Java atm, so I'll stick with my cup-of-joe.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    1. Re:C# may not stand for long... by El+Neepo · · Score: 2, Insightful

      "Now, C# is a pretty language. MS looked at Java and started on their list... "This is good in Java, lets include it. This isn't, lets either not include it or make a nicer alternative." They made quite a nice, competitive language."

      You're right, I think it is a much nicer alternative to Java for client side apps.

      "But I think C# will be used to convert the C, C++, and Java crowd into the .NET framework. Now, once you are in the framework, you'll see that VB.NET is easier to use, has the OO that Java/C++ people desire, and can make the deadlines easier to make."

      C# is far from just a tool to convert people to the .NET framework. C/C++ people will probably still use C++ .NET if they want .NET development. C# directly targets Java developers, but it can easily be decoupled from the .NET framework (look at Mono). Personally I'd rather not use the .NET Framework for C#, but until Mono becomes more mature I'm stuck using the .NET Class Library unless I want to rewrite all that stuff myself. VB.NET is simply C# with the VB words. VB.NET is nothing like VB6 and earlier. I can't say that 100% but from the VB.NET examples in the class library that sit along side the C# ones, they're so similar.

      "Yeah, I think C# is MS's way to convert everyone to VB.NET."

      I think its other way around.

      "Luckily, .NET isn't as platform independent as Java atm, so I'll stick with my cup-of-joe."

      True. I refuse to use ASP.NET on IIS since IIS is such a crock. I hope Mono keeps going strong for client side however.

    2. Re:C# may not stand for long... by Anonymous Coward · · Score: 1, Insightful

      But I think C# will be used to convert the C, C++, and Java crowd into the .NET framework.

      You can have my C compiler when you pry it from my cold, dead, fingers.

      As for all these Frameworks; can any single one of you actually describe, in under 200 words, exactly what the .NET Framework is, what its comprised of, and why I should find it so exciting? It seems to me that even Microsoft arn't clear on this; certainly if they are, they're not doing a very good job of communicating this exciting new technology to me (I don't think I'm the only one, either).

      Will anyone take the challenge, I wonder?

  2. Wow- C# review on Slashdot? by glh · · Score: 3, Insightful

    I'm really suprised by this (especially with the book being from MS) but I think it is a nice to see on Slashdot.

    C# really is a nice language. It is more powerful than other .NET languages (such as VB.NET) because it allows you to write unsafe code (ie, code that doesn't have to go through the garbage collector). Not that most MS programmers will need this capability, but its nice to have if you need the extra performance over maintainability/safety.

    C# also gives you the ability to write XML comments in your code that can be parsed by the compiler to generate documentation. There is also an open source project called "NDOC" (hosted on Source Forge) that lets you generate really cool and helpful docs.

    However, the majority of Slashdot readers probably don't care how C# is better than other .NET languages. The real question is- how does it compare with Java. Honestly, I believe there are some differences in syntax and power, but I don't know the details (as I am not that experienced with Java) but it would seem this book could help answer that question. I plan on taking a look at this book. Thanks for the review, and again- nice to see this kind of thing on Slashdot!

  3. C# not so bad folks by Anonymous Coward · · Score: 1, Insightful

    C#/.NET is actually a good thing and Visual Studio.NET is a wonderful product if a bit buggy. .NET to me is the development enviornment including the IL, class libraries, and framework. Since M$ can't define it, I will. =) That said Java is also an excellent technology and I use both in my work. Usually the client already has a preference for one inane reason or the other so I simply work with what they like. The problem with both of these is the learning curve for the library classes.

    I would urge slashdot readers not to reject out of hand (even though we're really good at it) the possible benefits of this technology. BTW, I abso-freaking-lutely hate the manner in which Microsoft has conducted itself over the last 5 years or so and think that they should be punished by the courts for anti-competative practices against small companies, in the event you believe me a Bill-zombie.

  4. Why should it seem strange to mention C#? by Tattva · · Score: 5, Insightful
    It might seem strange to review a C# book on Slashdot

    There is absolutely nothing strange with not keeping your head buried in the sand. Just because some folks seem to have a knee-jerk reaction to all things Microsoft doesn't mean Slashdot should be expected to ignore relevant and widespread programming practices.

    --
    personal attacks hurt, especially when deserved
  5. Review of this review by gabbarsingh · · Score: 3, Insightful

    While I am a Java developer and I am interested in C# from a knowledge-about-languages perspective, this review is far from getting me there. At exactly one point the reviewer mentions threads and Swing. But then what about it? At more than four places Microsoft press is mentioned and it is advised to give them a fair chance. Well, after reading this review I still don't have a clue what the book is about. The ToC is interesting but not helpful. I bet that a 'Python for Perl Programmers' book would get an objective review with less focus on publishers and book contents/excerpts that would do the topic some justice. What I am trying to say is that there is no 'java angle'

    I propose slashdot community lay down some guidelines about reviewing a technical book. I applaud the reviewer's efforts and for keeping an open mind towards the source ;-)

  6. Re:Good starting point online by Kynde · · Score: 4, Insightful

    This is a great site.

    After a first glance I saw :

    This is typical code you might write in Java or C++:

    foo.setSize (getSize () + 1);
    label.getFont().setBold (true);

    The same code you would write like this in C#:

    foo.size++;
    label.font.bold = true;


    Now, if that isn't biased crap then I must be the guy bending over at goatse.cx. The rest of the article goes on in much the same way.

    I just knew it. For C/C++ coders C# is what Windows is to a proper OS users. It may be easier if you're a numwit, but I'm quite sure that the design is rigid and quite quickly you'll wind face to face with some illogicality or utter impracticality. And there you are... not happy as a clam, but happy as a lion with a hedgehog rammed up in it's butt.

    If you're now thinking "well, C++ is flawed, too" the you've missed the point or you only think you know C/C++. There's a big difference in knowing and mastering and my guess is that that in particular will be the problem with C#, as with all other Mickeyware.

    --
    1 Earth is warming, 2 It's us, 3 it's royally bad, 4 we need to take action NOW
  7. Re:Wow.. review sounds pretty good! by tshak · · Score: 3, Insightful

    Of course, when the next Java review comes out no one will by crying conspiracy.

    --

    There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
  8. Funny, I saw the opposite by GCP · · Score: 3, Insightful

    What I noticed was just how uncomfortable the author seemed, to be seen saying anything positive about something from MS to this crowd.

    Pretty sad when the political orthodoxy is so overwhelming that every sentence has to start with the equivalent of "please don't hate me for saying it, but this wasn't as bad as I naturally assumed..." when discussing a book on programming.

    C# is what you get if you take several years of Java real-world experience and ask "if we could do it over again from scratch, with no backward compatibility requirements with existing Java, what would we do?"

    C# is what you get if, instead of taking Sun's attitude of "please, you're a programmer, not a language designer -- if what you're asking for were a good idea, we would have done it", you take MS's "mercenary" attitude of "what changes would you make to Java if you could?".

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."