Effective C#
If you're interested in, or currently working with, .NET and are tempted to skip past this book as Just Another C# Reference Book, think again. Wagner's book is a great resource because it covers concepts which run across the entire .NET Framework regardless of which language you're working with. While this book focuses on C#, VB.NET developers can benefit from some of the text within as well.
I also think this book speaks to a wide range of readers. Seasoned developers will blow through this content, fine-tuning their coding methods or starting new ones. Wagner specifically points out how practices experienced C++ developers may use aren't good practices in C#, such as avoiding function call overhead by writing longer C# methods with more convoluted loops. More on that later.
New developers also can greatly benefit from this book by using it to properly form development habits early in their careers. Examples of this might include following Wagner's recommendations for safe casting, strong use of interfaces, and knowledgeable resource management.
Wagner's writing style is clear and concise. He occasionally comes across as brusque, or as writing only to experienced developers ("I wouldn't write code like this and neither would you."), but those instances are few and far between. The rest of the book's voice is terrific. More important is the weight of Wagner's knowledge and experience.
One real drawback is a large number of typographical errors, sometimes several per chapter. Some sentences are missing content, and there are a large number of run-together words. These errors don't take away from the material, but it's an annoyance all the same. I would have expected better proofreaders at AW.
The book is well organized into six chapters, each hitting a specific area in C#. Within each chapter, Wagner covers six to ten items, each item focusing on one specific "minitopic," as Wagner calls them. Each item includes code snippets to demonstrate recommended approaches. Few of Wagner's snippets will function as standalone programs, but this is an advantage, as I see it. The book focuses on tight, specific examples, rather than weighing itself down with pages of extraneous fluff.
Often Wagner's recommended approach is contrasted against bad practices, or practices which might be optimal in other languages but work poorly in C#. An example of this would be Chapter 4's Item 31: "Prefer Small, Simple Functions," where Wagner shows how smaller functions are generally more efficient than larger functions with complex loops. This probably confounds experienced C++ developers, but it's a prime example of how valuable this book is. Wagner shows that .NET's Just-In-Time compiler pays less cost when calling functions than it does trying to wade through convoluted loop logic. His recommendation? Write "the clearest code you can create. Let the JIT compiler do the rest."
Chapter 1, "C# Language Elements", hits hard the topics "you must remember every day when you write C# code." This chapter discusses issues central to C#'s syntax, implementation and optimization. Wagner talks about basic Object Oriented concepts such as hiding class data members behind Properties (.NET's common access methods/fields via gets and sets), and why it's important to implement a ToString() method. Basic software engineering topics are also covered, like why it's important to differentiate between value and reference data types -- and the pitfalls of failing to do so. This chapter also thrashes out coverage on deep C# concepts like why developers should use foreach loops and why the GetHashCode() method will "practically always get you in trouble."
Chapter 2, ".NET Resource Management", has a lot of text on general patterns for constructing optimal code. Wagner's in-depth knowledge of the .NET Framework's underpinnings really shows through here. There's a very clear discussion of the performance ramifications of boxing (wrapping value type data into an object for method parameters) and unboxing. Minimizing extra garbage (unnecessary objects) and easing resource clean up via standard dispose patterns are also covered. This chapter's critical to ensuring you understand what's going on with resources in your .NET application.
Chapter 3, "Expressing Designs with C#", looks at object-oriented design in C#. While the discussion's specific to C#, there's a lot of great, practical information which applies to any object oriented development. Wagner gives some great examples with backup discussion regarding preferring the use of interfaces over inheritance and why it's a cleaner solution. (Java programmers who've read Alan Holub's "Why extends is Evil" in JavaWorld would enjoy this section.) There's also great treatment of using delegates for callbacks, and events for outgoing interfaces. Wagner also points out more pitfalls in a reference data type language: returning references to internal class objects via a read-only property (getter for Java folks).
Chapter 4, "Creating Binary Components", shows what critical topics you have to consider when creating even a moderately complex system for deployment. Wagner exposes some terrific details on how smaller is better when developing .NET assemblies for deployment. He also discusses why it's best to limit a class's exposure through public scope since this ends up advertising too much of your class's internals to potential users of that class. Wagner ties this back to interface discussions in earlier portions of the book, and makes a good case in this section for bad scope's impact on deployment.
Chapter 5, "Working with the Framework", delves into the .NET Framework Class Library. The FCL is a huge library and Wagner's insistent that too many developers are writing custom code for functionality which already exists in the FCL. This section helps to avoid having "developers reinvent the wheel." There are very useful discussions on using .NET runtime diagnostics, .NET's validation capabilities, and standard configuration mechanisms. Wagner also shows why .NET's reflection capability (one component dynamically discovering another component's capabilities at runtime) can be overused - but he also shows how to best use it in the appropriate cases.
Chapter 6, "Miscellaneous", is the catch-all section. Security and exceptions are covered here, as is the pain of working with COM interoperability - and why you should avoid it if at all possible. Just as importantly, Wagner points to several tools which should be in any C# developer's belt. He also identifies terrific resources available online.
What makes this book so useful is that Wagner constantly talks about the reasons behind why specific choices in C# should be made. For example, in Item 3, "Prefer the as and is Operator to Casts" Wagner moves through the rationale of why a developer should (when possible) avoid casting in C# and use the as and is operators instead. Casting can lead to headaches with data loss when casting a long data type to an integer one, or more headaches with the extra lines of code to ensure the cast was to a proper type. Sure, casts are sometimes necessary, and it's another value point for this book that Wagner gives clear examples of when his techniques don't apply -- and he also shows recommended alternatives for those cases.
It's just this kind of discussion from an experienced developer that makes this book so valuable. Good developers need to understand the ramifications of choices they make designing and implementing a system. Wagner's book is outstanding for exactly this kind of detailed, clear exposition.
An additional bonus: Wagner has a blog dedicated to discussion of items from his book. Erata are also listed there. See Bill Wagner's Effective C# blog.
The bottom line: this book really is a critical addition to a serious C# or .NET developer's bookshelf. It deserves a place right alongside books from McConnell, Macguire, Kernighan and Pike.
You can purchase Effective C#: 50 Specific Ways to Improve Your C# from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
"..in the same class as Code Complete"
But do we really need a "programming good C#" book? Isn't good programming all about, well, good programming? If I remember Code Complete correctly, it used pascal and C, I think. It definitely was one of the best books I've read, but how many times can you say the same thing over and over again?
Languages come and go. But good coding techniques don't dependent on a certain vendor or technology.
Maybe this is a good book if you don't know much of any programming language and want to pick up C#. Speaking as a C# developer who does Java, C, C++, and VB, I just read some of the rags and jumped in. Then when I wanted to do something else, like create a custom web control, I got a book in C#. Presto/Bingo, I'm coding in C#. OOP as a concept is going to have similar constructs, no matter what the language, right?
Sorry for the rant. It's probably a great book. I just don't understand how good coding practice is dependent on the flavor-of-the-week. Perhaps in his comparisons the reviewer does a disservice to the intent of the work.
Click on this link for the blog.
Synchronize your calendar and mobile phone via text messaging.
Thats what I've found. Another .net language syntax is book is hardly useful. You find yourself wondering what the fuck you would do with all these new wonders and you can think of a 100 better ways you might design code compared to your procedural past but your head is left spinning with options. That is where the design patterns come. OOP ways to do different things which can have a huge impact in the future of your coding. Also MS Press has been doing a bang-up job in documenting the net framework APIs. I would start with a design patterns book and a book on the net framework.
The review is missing something important. Effective C# is of the same mold as the Scott Meyers' Effective C++ franchise - known by many C++ programmers as a great resource of best practices. Bill has Meyer's approval to publish an "Effective" book, and even announced its publication on his mailing list.
Effective Java!
[mod me +5 funny like the parent. What's that? You don't like underhanded my-langauge-is-better-than-yours jokes, meant to enflame rage between already volatile communities? Oh, sorry, mod me down then.]
Tech, life, family, faith: Give me a visit
Yes and Yes
Great ideas often receive violent opposition from mediocre minds. - Albert Einstein
tbh, I'm not sure that that is a recommendation. We have been going over cc in a reading group at work for the better part of a year now (chapter a week takes a while!), and overall, while he does have a lot of worthwhile stuff to say, the book is mostly dross, coupled with misleading stats, poor editing (and occasionally worse writing) lack of direction and bad analogies. .net knowledge will pretty much provide that anyway)
On the other hand, it has proved useful as a talking point in our reading group (a mix of professional programmers ranging from fresh grads to seasoned vets). As for the C# book, well we could do with a good reference for the language (although a decent c++ book and a little java and
"Success is based on knowing how far to go in going too far"
I rarely use Microsoft's suites, but the fact that I knew what the first reply (and probably the second, third, and fourth) to this article would be annoys me.
.NET and C#? Fine, don't use it. I use Dev-Cpp for all my C/C++ work on Windows. But that doesn't mean I have to be an ass (or reply in such a partisan manner that I look like one)to people who do.
You don't like
But does it work on Linux?
Joke aside, that's the question I was asking myself. Why learn a platform specific language when you can use a platform independent language like C++, Java or Ruby?
Windows is wonderful (well, not really), but there are other platforms out there as well.
Take the cheese to sickbay, the doctor should see it as soon as possible - B'Elanna Torres, "Learning Curve"
But that doesn't mean I have to be an ass (or reply in such a partisan manner that I look like one)to people who do.
.NET framework is really a productivity godsend for the business app developer. Can't say its all that for every type of application, but Microsoft got it right for its core constituency.
What? Didn't you read the EULA when you registered with Slashdot?
In all seriousness, the
See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
Often Wagner's recommended approach is contrasted against bad practices, or practices which might be optimal in other languages but work poorly in C#. An example of this would be Chapter 4's Item 31: "Prefer Small, Simple Functions," where Wagner shows how smaller functions are generally more efficient than larger functions with complex loops. This probably confounds experienced C++ developers, but it's a prime example of how valuable this book is. Wagner shows that
I don't know how he got the impression that experienced C++ developers would be confounded by short functions. By using short inlined functions, C++ developers don't pay any cost by breaking up large routines.
That will only go as far as Microsoft will let it. Meaning that if MS wants to, they can close it down with their patents on C#/.NET. I would hate to code under that condition.
Take the cheese to sickbay, the doctor should see it as soon as possible - B'Elanna Torres, "Learning Curve"
Except for the vast majority who aren't even considering it. I don't know anyone who has even been asked to look at C#, I know plenty of people doing C++ and Java. But keep reading the MS press releases and believing that, its amusing to people who actually follow industry.
I still have more fans than freaks. WTF is wrong with you people?
Can you list those C#/.NET patents which worry you? I wasn't aware of this.
"reality has a well-known liberal bias" - Steven Colbert
Paul Graham said it best:
He goes on to reference Norvig's paper Design Patterns in Dynamic Programming that points out that in more productive environments, many if not most of the classic "design patterns" are totally invisible in better platforms today.If you are spending a lot of code writing stuff that fits nicely into design patterns, you'd be far better off switching to a platform (any lisp platform; any python platform; ruby/rails) that frees you from this redundancy automatically.
Did you know you can't see patents pending? There is no databse for them, its secret until its rejected/accepted. In addition, they can send in a correction or addition to one, and it remains hidden longer, but still becomes effective as of the original submission date. So if they exist, we won't know for another 3 years if MS doesn't want us to.
And before you say its an ECMA standard- ECMA does not require standards to be unencumbered, or even to be licensed on a RAND basis.
I still have more fans than freaks. WTF is wrong with you people?
I know you were trying to be funny, but from a C# programmer's perspective, you're just being ignorant.
.NET platform, it's easy, flexible, and powerful. Academia was pretty quick to gobble up Java but I've seen more and more schools replacing VB/Java courses with C# lately.
;)
C# is an advanced, well thought-out OOP language. When coupled with the
It's an open standard, despite what people may think, and as Windows.Forms becomes implemented on other operating systems, adoption will spread. Microsoft even released the source code to a FreeBSD CLR implementation called "Rotor".
Remember, just because it's from Microsoft doesn't automatically negate it
If you say "here goes my karma" I will bite you!!!
"Effective C#? How about don't use it."
/. scene look bad without adding anything useful.
How did this get modded to "Funny"?
Granted, I work for Microsoft and take some personal offense to the comment, but I'd still think it were stupid had it been about Python, Java, C++, or [insert language here].
If you're going to be anti-MS, you could go the extra mile and at least be a tad bit witty. Comments like the one in question just make the whole
- Rory [Microsoft Employee] | Free dirt: neopoleon.com
So, under your rules, you'd better not code in Java either since anyone, anywhere could have a pending patent.
.NET framework and C# language.
Give me a break... at least with C#, it's an ISO and ECMA standard. Further, Microsoft has explicitly permitted 3rd party implementations of the
But I'm not going to get into a petty langauge war. Use the right tool for the job, if it's C# or Java, frankly it matters little. Only zealots think otherwise.
Tech, life, family, faith: Give me a visit
Why learn a platform specific language
.NET framework (i.e. the common code library shared by all .NET languages including C#) is partially platform specific (in particular, System.Windows.Forms namespace).
.NET language (be that C#, VB.NET, JScript.NET, J#, C++, and about 30 others) that runs on everything from Solaris to Mac to BSD to RedHat. I suggest you check it out for more info.
C# is not platform specific. However, the
That said, the Mono Project allows you to write code in any
Tech, life, family, faith: Give me a visit
Hmmmm, I barely knew the name of the FreeBSD specific CLR implamentation. I don't think anyone seriously uses Rotor or has developed it in the past 2.5 years.
;)
(This brought to you by one of FreeBSD's Mono port maintainers.
When performance is not critical important and you make decision to target a VM, you may as well use a dynamic typed language. Enjoy Ironpython.
You want funny? Microsoft should have called it !C or J#
You must be new here =D
I am Spartacus
C# is revolutionary !!
Windows r0X !
Keep creating high quality software Bill !!
Gooooo Longhorn !
*ducks*
But seriously... choose a platform independent language... and anything that isn't bound to Winblows.
That's funny because the Rails people go on and on about how it does MVC and all which is... you guessed it... a design pattern.
(Please browse at -1 to read this comment.)
It's a shame if more and more schools are picking up C# to learn students how to program. Java is the cleaner one of the languages - take for instance the virtual keyword in C# - not very OO.
.NET documentation is not that great. It consists of examples in several languages and things can be pretty difficult to find.
But the thing that worries me most is the IDE. For C# I know two moderately usefull IDE's: Microsoft and Borlands. Both are commercial (ok, maybe not for students, but you know about indoctrination). So we either have to pay these companies for their environments, or we should use the rather outdated text editors for these purposes.
And then there is the matter of documentation. Excuse me for being blunt, but the
All this said, C# is a pretty good language, with many more (usefull) options over Java. But for teaching I would still go for the latter. To get an idea of the difference in overal complexity simply count the keywords of both languages.
Not that I'm a fan of Java, but Java has no angle in blocking other OSes from using it. In fact, that was its big selling point. Microsoft does have a big angle in doing so, and an even bigger one in hurting open source. Mass adoption of C# by OSS followed by a patent attack could put OSS back by years. Java is an acceptable gamble, C# isn't.
I still have more fans than freaks. WTF is wrong with you people?
Microsoft even released the source code to a FreeBSD CLR implementation called "Rotor".
Under what terms?
C# is a GREAT language, this is coming from a long history in Oracle/Unix/Linux. I don't understand where people got the idea that it won't work on Linux either. We're coding 3-monitor full screen 3d MRI analysis applications in it, and I can assure you that it has accelerated our developement time over the last iteration created with Borland C++ Builder. Ironically, it took 8 years to write the last version of our software in Builder, and 6 months to completely rewrite it with enhancements in c#. That, consequently, was with both the lead developers having no experience with the language (I was a C++ folk, and he'd been using Delphi, so we settled on C# since it was essentially the next evolution of Delphi).
It's no joke, and I'll be buying this book just to have it. I've also picked up most of the Deitel series of books on c#, and of course the O'reilly books. The c# cookbook is another GREAT reference. Anyone interested in starting with C# should check www.codeproject.com for examples. Also, along with a rude admonishment to the MS haters for not having researched the topic (MS dependant indeed), check www.omnicore.com for a native crossplatform compiler for c#. It's cheap too, but doesn't do forms support just yet (when it does, I'll probably move from VS just to get free cross-platform compatability).
-chitlenz
Imagination is the silver lining of Intelligence.
I've heard .NET is a great platform too, and as a Java programmer I am frankly jealous that .NET has properties and I don't get to use them.
But its not an open platform if you've got a submarine patents laying around. I feel a bit superstitious about saying this - but I just don't trust Microsoft enough to be in control of the tools I use for my livelihood (programming for cash).
My attitude may change, but in the past my experience has shown me its not worth it.
Given that, I'd rather learn Ruby on Rails if I'm going to do sometehing new, really.
I got paid to write a socket server app in C# recently.
.exe under Linux-Mono (without recompiling), and it easily handled 1000 active connections. I am definatly going to work more with Mono in the future.
Being from a Java backround, I didn't really want learn yet another language. Got to say - I love c#. I got to grips with it in no time at all. One major stubaling block I found, was that my app refused to allow more than 64 socket connections. Out of curiocity, I ran the same
Take a look at this:
Sapir-Whorf and programming languages
I personally use Herbert Schildts: "C# a complete reference" for reference.
It teaches u how to program in the first half and in the second half it has references to all the libraries.
I find C# pretty straight forward if u know Java.
I love programming in languages that have their own memory management. Worrying about pointers and what not takes away so much time from productivity. For ppl who wanna get hardcore and want control. Yes u can embed Assembly in ur C# code.
Now if only someone makes microcontrollers/dsp's that do their own memory management. That's make my life so much more easier.
It's almost like you've never seen a Slashdot "discussion" before... Mention .NET and you'll get scathing remarks; mention BASIC and you'll get laughed at; mention Java and put up with taunts about how slow it is; mention C and watch as another buffer-overflow thread instantly materialises; mention perl and there's an immediate response about clarity of code; mention Python and someone suggests you try Ruby; mention PHP and someone wants you to switch to Ruby on Rails.
;)
You just gotta go with it. It's not gonna change --- and why should it? They all do the same, but there's always another one somewhere else which does it *slightly easier*...
It would appear the only languages worth knowing around here are the ones so obscure or esoteric that no-one says anything about them. I do all my application development in brainfuck!
the layman's guide to computer science
I am not a .Net hater, I am just an MS hater. Why? Because of the intentional things MS does to stop other products from working. For example, ASP.Net (in C# or whatever) should put out standards compliant HTML, regardless of browser. However, that is not the case. A fellow programming friend of mine who, sadly, grew up in the "MS only camp" made this page. Go to this URL in IE, then under the "Quick. Cheap. Easy." flash, click on Info. Notice that everything looks fine? Now do the _same_ steps, but do them in Firefox/Mozilla. Once you click the "Info" link the page looks like crap. After talking to my friend, it turns out that he used _nothing_ but MS supplied .Net controls. Now, I want you to do a few more experiments (I have already done them and know the outcome). Download and install the User Agent Switcher extension for Firefox. Make Firefox "pretend" to be IE 6 and go back to the link above.!!!!! Wow, the MS ASP.Net framework sends down different HTML depending on whether you are using IE or not! Making Firefox "pretend" to be IE, causes the MS ASP.Net framework to send down IE-Only Code that actually happens to make the site look correct in Firefox.
Now, there is one other experiment for us. Go back to the link as Firefox. Then go under File -> Save Page As and pick Web Page Complete. This option will save all the images, scripts and HTML of the page that was sent to Firefox. Now, open up IE and drag-n-drop the complete HTML or HTM page that you saved from Firefox to IE. Do you notice ANYTHING STRANGE? IE renders the Firefox delivered page just as poorly as Firefox does!
So to sum up my thoughts on MS .Net. I love C#. It is a very nice language. I think the MS .Net framework is very nice. However, I also hate the MS .Net framework because it is designed for crap MS only. For all of the ASP.Net/C# Web apps I have made, I have had to actually _fight_ against the MS Visual Studio IDE to force it to make standard compliant web apps. It seems that the latest versions of MS Visual Studio IDE just want to produce IE/MS only web apps. To me that is not acceptable. I personally would rather stick to Java/Servlets/JSP or PHP and have total control myself, than put up with MS intentionally trying to break non-IE browser.
For all the MS-apologist, please save your excuses. MS could have made there ASP.Net framework deliver the _same_ HTML across all browsers. All MS had to do was make ASP.Net standards compliant, which it is _not_!
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
Actually the Mono team encourages you to stay away from Rotor as if it was the plague, because it's the infamous shared source license. It's all MS code, not open source at all. So if you have looked at the source for Rotor, you shouldn't (or can't? I don't really know) contribute to the Mono framework (or Portable.NET or any other one if there are more implementations) because in the future it might bring patent or copyright issues from MS against those projects. It also supposedly runs on Mac OS X. But you need 1GB free disk space to build the thing. Why? I don't know. Mono doesn't use as much space, and it includes the CLR and the class libraries.
Go hug some trees.
You could use Monodevelop, it's free (speech and beer wise). It's still very rough as far as aspx and winforms are concerned, but for a programming class where you're going to write a hello world or other basic CLI stuff, it's more than enough.
Go hug some trees.
There are also tons of other problems I have run into with the .Net framework over the last few years. Here is a _major_ problem for me that I just posted about.
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
Lets set aside that C# is nothing but a rip off of Java.
So far, other than low-end schools or schools with millions being thrown at them from MS, few in academia are adapting it. ACM and the major 4 universites backs Java as the primary language for CS.
Likewise, set aside the fact that nothing inovative has come from C#. I will grant that one day something might, but after 5 years nothing yet.
the real problem is the Gnome world was foolish enough to adapt it. Now, MS is finally throwing the patent stuff at them on a number of issues. My guess is that C# AND the api will be dead on all but MS. Even on the BSD platform.
I prefer the "u" in honour as it seems to be missing these days.
by little longer you mean exponentially longer?
Secondly, OO programming is inherently parallel, as you access everything by implied reference, all data is stored on the objects, and all communication is by very controlled, specific paths. But multi-threaded OO code tends to be horrible to write, whether in C#, Java or any other OO language. Most OO languages assume a serial flow, even though the architecture implies a parallel flow.
Third, C# is a hybrid - it is more an object-based language than a pure OO one. (The difference is that a pure OO language has no atomic types visible to the programmer, as atomic types mean procedural code. There should be no procedural code in an OO program.) Unfortunately, the only language that is even close to pure OO is Smalltalk, and I dare you to name any serious applications written in that.
Fourth, Microsoft has explicitly said that the new C# extensions supported in Longhorn must be licensed under a non-free license, so there's no chance that Mono will support the newer stuff.
Lastly, I would agree that Java and VB are a mess - Java is inefficient and slow (not to mention horribly designed), VB is way too proprietary and non-portable, but that doesn't make C# good, it merely makes it better than most of the competition. D is a better language than Java! The biggest difference between C# and D is that D isn't as well known and doesn't have a trillionaire backing it.
Academia's judgement on languages has yet to impress me. Whilst I am from an academic background, I do not regard languages such as Cobol or Ada to be noteworthy uses of software engineering, and both Modula-2 and Modula-3 are useless for anything beyond classwork, and Pascal is perfectly good for that. (IMHO, it is also better.) Occam, perhaps, but only a handful of Universities - and all in Europe - still teach it.
Just because it's from Microsoft does NOT negate it, you are quite right. Microsoft is quite capable of producing good ideas and good software. Sometimes, it even does. However, C# does not seem to me to be worthy as a contender for "ideal language of the year".
Ok, so what WOULD be an ideal language? Something with the inherent parallelization of SISAL, with transparent networking (if the resource is specified, and the resource is reachable by IPv4, X.25 and Appletalk, why should I need to know which is used, if the communication still takes place within the desired constraints?), with a consistant architecture (no hybrids, please, the compiler should take care of optimization and consistancy is readable).
There should also be a rigid distinction between UI (and UI constrants) and the backend (with all the constraints there). One thing I hate about programming for X is that there is a blurring between quite distinct components. (I also don't like the container management, the parameter lists, and the layout management, but it is the violation of an essential SE design principle of keeping interface details completely independent of engine details that really bugs me.)
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
Excuse my ignorance... not trying to start any fights... if I wanted to play with a purely java implementation of a web page as opposed to ASP/ASP.NET how could I quickly get started? And good IDE's that I could play around with to get my feet wet?
See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
Because C# is quite popular on the job market?
I started working on a hardcore C# project around the end of last fall. Effective C# has been my guide and while there are a few recommendations that I'm still experimenting with, I must say I have been very pleased with the results of following its recommendations. While I do concur that the number of typos was surprising, most are simply a missing space between two words and thus little is lost other than the finish of the book. In general, the entire "Effective" series of books has been equally useful, though this one misses the fine sense of humor Scott Meyers has contributed to his own books.
SharpDevelop is a pretty nice (free) IDE for C#.
I'm actually very fond of the documentation. It's rather complete, well laid out... and the APIs aren't as buggy as Java's
Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
Java is an acceptable gamble, C# isn't.
Frankly, most companies (including the one I work for) choose to support the most widely used OS; supporting multiple OSes means more testing, more development costs. And for Windows, C# blows away Java.
But again, I won't get sucked into a langauge debate. If I were to write cross-platform software, I might choose Java over C#. It's all about getting the right tool for the job.
Tech, life, family, faith: Give me a visit
I agree! SharpDevelop is one of the best free IDEs I've seen and it has many of the same features as Visual Studio .NET 2003.
Although the latest build has a really nasty crash bug that has to do with the new integrated help. Aside from that, it's a great program.
find . -name "noobs" -print | xargs rm -rf && echo "pwnd."
Simply put, notice the ethics of the post. Good ethics are not often seen.
It's a shame if more and more schools are picking up C# to learn students how to program. Java is the cleaner one of the languages - take for instance the virtual keyword in C# - not very OO.
.NET documentation is not that great. It consists of examples in several languages and things can be pretty difficult to find.
Actually, I've heard far more people knowledgable in both languages say the exact opposite as this. Considering C# was developed supposedly to "fix" specific deficiencies in Java and I've seen good rebuttal on both sides with Java coming up on the short end of the stick almost all the time (exception cases are where someone seems to have some devotion to some fringe case that is considered by many to be "bad") and the final recourse of the Java side is to say that it's "open", to which the rebuttal is that it isn't as open as C#.
But the thing that worries me most is the IDE. For C# I know two moderately usefull IDE's: Microsoft and Borlands. Both are commercial (ok, maybe not for students, but you know about indoctrination). So we either have to pay these companies for their environments, or we should use the rather outdated text editors for these purposes.
Others have already replied with free (beer) ones listed.
And then there is the matter of documentation. Excuse me for being blunt, but the
There must be two kinds of people in the world. Those that can use Microsoft documentation very effectively and those who can't. I see a few people claiming that Microsoft documentation isn't that good, but I've been using Unix/Linux since 1986 (computers in general since 1980)and Microsoft products since 1993 and I've always been more than adequately served by Microsoft documentation.
"But its not an open platform if you've got a submarine patents laying around."
Well, if you're a Java programmer, shouldn't you be accustomed to that by now? =P
Beacuse C++, Java or Ruby may not be the best language for the job. Currently C# is a great language for developing Windows applications.
There are plenty of reasons to learn and use a wide variety of languages and platforms. The right tool for the right job.
C# is an advanced, well thought-out OOP language.
So is C++. Why eliminate the standard programming language in favor of another? You know Microsoft didn't just develop it out of the goodness of their hearts. It was a business decision that will be good for Microsoft and bad for programmers. That is, unless you like learning yet another redundant programming language.
You do have a point - I obviously can't prove that Sun hasn't patented anything in Java.
However, if they have (and I'm not aware of it?) isn't it a bit late for them to be doing anything with it?
Further, Sun has no monopoly to leverage, so it can't be without suffering quickly - that seems to keep them in check quite well behaviorally.
One other thing I think is interesting is that Fedora actually ships natively compiled Java apps. Little things like...Eclipse. That's amazing, and all libre.
Where are the mono apps? Am I missing them?
Java runs only on OS and architecture combinations where Sun wants it to. Due to the hard work of some people, I can at least get java on BSDs for i386, but not amd64. And even for i386, Sun's license says I can only use it for testing, because I haven't paid them to certify the port as java compliant.
I'd have to agree Sun thought it out pretty well.
XML UI Browser/Platform
There are plenty. A good Free/Open one is called Eclipse. It is plug-in based and supports Java/Servlet/JSP/C++ and others. You can just download Eclipse and Tomcat and have a complete JSP/Servelt web application framework that works on MS Windows or Linux. Now just buy a JSP/Servlet book or search Google for a JSP/Servlet tutorial and your all set ; )
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
With regards to the HTML problem, have you considered that it might be because of an outdated segment in your web or machine.config files?
.NET framework will generate two different kinds of html one for "uplevel" browsers (by default i think this is only MSIE 5+ and posibly netscape 6 but don't quote me on that last part).
I myself am a C# developer (win forms and web forms), and I initiall had a huge problem trying to test and use any sort of aspx web application in firefox. After poking around for a bit, it turns out that the
Anyway, there is a section that you can place in you web.config or machine.config files (i assume you know the difference between the two) that details the browser capabilities of various browsers hence the name browsercaps. By default this section of the file is pretty useless, it will detect IE, some netscape and that more or less it. Maybe some mobile browsers for PocketPC as well. This can be updated, and i find that the information at This Link is extremley helpful. I have used the browsercap information from this site on a few production servers to get rid of some ugly issues with AbleCommerce and Firefox, and i have it on my development machine as well; the difference in rendering will suprise you. In short, I highly reccomend that every ASP.NET developer check this information out, and keep your browsercaps section up to date. It may not be a 100% effective solution but it does do an excellent job of getting rid of most of the problems you will have when using a non MS browser.
Look out honey cause I'm usin' technology
Ain't got time to make no apologies
Heard of Mono?
Yeah. That's the kissing disease.
then there is the matter of documentation. Excuse me for being blunt, but the .NET documentation is not that great. It consists of examples in several languages and things can be pretty difficult to find.
.NET documentation is that it doesn't always come up first thing on a google search, unlike javadoc when you're looking up java classes. Other than that, it's great. It provides examples for each class in VB, C#, and C++, clearly marking which one is which. Javadoc generally doesn't provide examples. On difficult-to-use classes, .NET docs have often been my last stop before continuing programming. That has not often been the case w/ javadocs.
The only difficult thing I've found with the
Also, a lot of basic descriptions for classes and methods are built right in to the IDE with intellisense, not to mention that the intellisense in VS is simply more "intelligent" than Eclipse's.
Insightful: 76, Off-Topic: 379, Flamebait: 24, Funny: 152, Interesting: 201, Underrated: 55, Troll: 9, Total: 896
Correct me if I'm wrong, but have they really actually *tried* to limit it? Not helping and actually trying to limit .NET to windows are two different things.
Basically, because MS's windowing system is not in other OSes, everything behind the interfaces needs to be reimplemented. Only if MS changes the interface do they break compatibility, and, by doing that, they'd break compatibility for all Windows programmers, too.
Insightful: 76, Off-Topic: 379, Flamebait: 24, Funny: 152, Interesting: 201, Underrated: 55, Troll: 9, Total: 896
I will try to play around with the browsercap stuff some more. As I pointed out in my post, if you set Firefox to pretend to be IE, the HTML usually displays _much_ better, however the Javascript gets all crappy and non-standards compliant and breaks things. If you have Firefox just be Firefox, then none of the validation controls work. They will require a round-trip to the server. However, in IE they will do basic Javascript and _not_ require a server round trip just to make sure a text control is not empty. I seriously do not see why MS could not use _standards_ compliant Javascript to check a text input. I mean it is as simple as something like:
I hope .Net 2.x really comes through and "just works" (tm) in a standards compliant mode. Though with MS I will not count on it.
Thanks for the link ; )
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
http://msdn.microsoft.com/vjsharp/
Deja Vu
n. 1. The sensation that you've read this very article before.
Yes, IE is more at fault than FF/whatever, but lots of people use it and if you are writing web apps you should know to test with different browsers. As other posters have mentioned, you can specify to a great extent how to render pages in differenct browsers in ASP.NET - uplevel and downlevel, and you can customize beyond that for each browser specifically.
VS.NET is great as a WYSIWYG dynamic content web page designer. Your friend just needs to clean up his page for Firefox. It is not hard.
So for the rest of us that still have a 1ghz machine with 256 mb of ram, that would chew up about 10 to 20% of the cpu just for a few downloads. That sucks (cpu)!
One of the problems I have with C++ is the calling of functions with reference arguments. If you're unfamiliar with the function being called, you can't tell, without looking at a header file, whether or not the argument is being passed by value or by reference. This can make it difficult when tracing through unfamiliar source code to figure out what's happening. C# addresses this problem by making you put the ref modifier in the arguments to the function
I very much disagree with your statement that it is bad for programmers. It very well may become the next de-facto programming language. This is coming from someone with largely a UNIX background so don't dismiss this as just another Microsoft Fanboy comment.
I am in the same situation, and I feel exactly the same way. Often people fail to understand why I dislike Microsoft so much. It is because of Microsofts Policy of Proprietary Design (you can quote me on that:). Every piece of software they have written seems to be tweaked (from orders from high up, no doubt) to work best only with MS. The resemblance that Bill Gates's behavior in the marketplace bears to the Robber Barons of the 19th century is disgusting. I have all the respect in the world for the (honest) MS developers, they need to make a living like everyone. The problems clearly stem from those who are becoming filthy, filthy rich from forcefully beating out competition in the software market.
Well I for one have been coding professionally in C# for a solid year now and let me tell you I've enjoyed every day of it. I've also taken on the monumental task of re-creating our company namespace with some of the items from this book (which is great by the way if you overlook some english semantics). I would recommend this book, as it has helped me fine-tune my game if I can call it like that.
Disclaimer for .NET haters: Mono --open source dev tool for .NET. It's nice i've got it on my gentoo partition :-)
/. is pretty much a open-source favoring crowd, but MS Visual Studio 2005 is a nice improvement upon the previous edition. The gripes most had about the old version have been fixed, and there are quite a few great improvements, including my favorite improved intellisense! :-)
end-disclaimer.
The MS bashing is quite disturbing. Well i know that
While i may have made myself flamebait, i think that if you are honestly interested in VS, you wont be disappointed by the new improvements they've made to Visual Studio.
I've programmed in both C# and C++.
.NET implementation on Windows. Mono seems to work relatively well (in my limited experience with it) to improve upon any performance hitches on alternative OSes (Linux, Mac).
/shrug.
While I like C#, it does have some flagrant problems. Primarily, it is not nearly as lean in computations as a C++ program... thanks to the
C++ on the other hand, as you point out, is THE standard programming language (in some places, but not all). However, programming a GUI in C++ usually takes substantial more time than in C#. C++ has disadvantages, of course (i.e. you're limited to System.Windows.Forms look and feel (although, you can customize many properties).
In all honesty, when C# first came around, I was reluctant to leave my favorite language, C++. But I grew to accept C# as an extension of C, rather than a new language entirely. They behave quite similarly (probably gonna get modded down for that comment, but I'm speaking syntactically), and they both have a common lineage.
You'll make your own opinion, but at least we can agree on one thing: C++ is better than Java (-1, Flamebait), and C# still isn't Java (-5, Flamebait).
Heh.
Deja Vu
n. 1. The sensation that you've read this very article before.
Microsoft can change anything they want in C#, and bet they will.
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
Except that what these interfaces are doing is not documented. .NET developers know how to code against System.Windows.Forms, but no one knows (well, reliabliy) how System.Windows.Forms codes against an OS.
Your friend should try removing the third party control from his page, and see if it was caused by them and not ASP.NET Look at the source of the page and you see all sorts of references to a 'componentart' set of controls, which happens to be a third party set of controls.
Mod parent +1 informative. It's seems a lot of people confuses C# with .Net.
"I think this line is mostly filler"
What?!? Brainfuck? Dude, that language sucks! You should try MentalMidget sometime! It does it so much [easier|faster|better]!
OK, you must *know* you had that one coming...
In Soviet Russia, Chuck Norris will still kick your ass.
Any valid links to download? All three U.S. Mirrors informed me that the file couldn't be located...
See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
OOP as a concept is going to have similar constructs, no matter what the language, right?
The basic concepts, yes. How the platform or language treats things, not necessarily. Here's a specific OOP example between the latest so called "fad" languages. In Java methods are implicitly virtual. In C# you have to explicitly declare a method as virtual. Prescriptive guidance as to how one should go about determining which methods to mark as virtual is only relevant to one of these languages. So while you are correct that general coding practices are independent of the flavor-of-the-decade language, there are topics which warrant books targeted at specific languages or platforms.
There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
You mean against a window manager, right? I don't see why not knowing the internals matters. Even if it is a black box, the documentation still tells what the code behind the interfaces is supposed to be doing, and, by-and-large, .NET developers can attest that they are at least doing just that. If there's a bug and it doesn't work as advertised it, in the port, fix it. If there's some sort of hidden side effect, in the port, eliminate it. With that, we would have an even better .NET on another platform than we do on Windows.
Insightful: 76, Off-Topic: 379, Flamebait: 24, Funny: 152, Interesting: 201, Underrated: 55, Troll: 9, Total: 896
.Net Components by juval lowy
"well, you have benen a MS flag waver for years, so your opinion on this matter is really biased and should really even be considered"
/. is concerned.
Before I was an "MS flag waver," I spent a lot of time with *nix/Java/et al. I was rather anti-Microsoft, actually.
One of the things that got me into Microsoft was C#. That's part of the reason I defend it.
My opinion *is* biased, though. I'll give you that. After years of watching people mindlessly trash MS, I've lost a lot of the love I had for open source - at least where
- Rory [Microsoft Employee] | Free dirt: neopoleon.com
"People who take jobs with Microsoft are mostly unscrupulous slimeballs"
Most, eh?
Then I suppose you can name a majority of the 55,000 who are "unscrupulous slimeballs."
I await the list.
"however taking personal offense at comments about your employer moves you to a far higher level of detestability"
Aside from the fact that this is obviously flamebait, I'm curious: Why should that "move [me] to a far higher level of detestability?"
I chose to work for Microsoft because I love the company and the tech. Why shouldn't I defend it?
Are you wasting away your life doing something you don't believe in?
- Rory [Microsoft Employee] | Free dirt: neopoleon.com
"This is "Slashdot"... Get used to it."
:)"
...as soon as she figures out how to compile her email app.
That's a great attitude. Some moderators of one of the world's most influential tech sites mod an idiotic comment as "Funny," and you're content to sit and watch.
I'd be embarrassed if it were my place, but it isn't.
However, I *can* say something about it.
"Oh yeah, and... quit your job and stop f#@$%ing up peoples computers... you and others will feel better about yourself
Of course. That way my grandmother can boot up to Linux and get started sending those emails...
Brilliant.
- Rory [Microsoft Employee] | Free dirt: neopoleon.com
C# is actually another clever way of saying C++: it comes from music notation. C# is the same black key on a piano keyboard as Db. It mean C one half-tone higher...
i liked the name, at least.
But for a real modern OO language, you should try no other than OCaml.
C# is, just like Java, a simplified C++ with half the performance and flexibility. C++ for the brainless, easily replaceable masses if you will...
I don't feel like it...
If MS came through with a standards compliant mode you will see a true nightmare. Since neither IE, opera, netscape or firefox come anywhere near to being standards compliant. So basically your solution is to break it for everyone instead of just a few.
Are you wasting away your life doing something you don't believe in?
No, but I'm afraid you are wasting your time feeding the trolls. What you fail to understand is that these idiots have no interest in listening to your point of view or any other argument that is not part of the officially approved Microsoft Bashing Curriculum ®.
These are the same people who find it horribly offensive that a company should *dare* seek to profit from its work. Of course, they can't make a logical argument as to why, but hey, why bother going to all that trouble when they can get a cheap laugh out of ad hominem attacks?
It's like dealing with a roomful of third graders who just love to listen to themselves call you a "doo-doo head" over and over again, and the more you protest, the louder the catcalls and giggling gets.
You obviously have better things to do with your life than argue with these people.
In Soviet Russia, Chuck Norris will still kick your ass.
but I've seen more and more schools replacing VB/Java courses with C# lately
Well, at least at my school (state school in Colorado) the reason the Java courses are starting to be replaced is because M$ is "suggesting" that the business school teach C# instead of Java. And Microsoft is giving the school money as well as "free" software for the students.
Your Windows PC is my other computer.
I work on consumer applications and would love for our team to be able to develop on .Net, but I have no idea from anyone how widespread it is? I don't think we can get people to download a 20mb framework for a 500k app? .Net has faster dev than C++ or C# due to the available tools, but that's no good if the users won't use it.
Any ideas?
But there are dangers in going dotnet way and it is certainly not _the_solution_ (or even not _a_solution_) to many programming problems, enterprise programming or not. And certainly that's not the most effective way to get the job done. But there is a very high ad pressure from Microsoft pushing its stuff into every hole and someone should counteract it to maintain some little sense left in current IT "scene". Who else but us? So - just "don't use" is the wrong answer.
I got my 'Senior Programmer' title out of a box of cracker jacks.
Nothing personal, but I don't believe you.
.NET is better.
I was not able to find evidence of any patented work in the Java core libraries.
Do you have any evidence of this? I would honestly love to see it, as this is one of the things I consider a feature of Java.
I discount your ECMA standard point because Java doesn't have a standardization problem. It has problems, but that's not one of them.
The licensing point is granted though. In practice, something like kaffe or gcj has as much clout and respect as mono though - they both require convincing to deploy I'm sure. So its not ideal, but I'm not sure
So if you want to have a measuring contest, I think it really comes down to patents. Can either vendor stop you from simply reimplimenting the environment even if you aren't attempting to get it certified? If Sun can do that, I'd be surprised, and I'd require proof.
The .Net Framework documentation sucks to use, about like Oracle documentation.
.Net Framework is so ambitious, it really has gone past the ability of the tech writers (or developers) to really get the whole thing, and provide code examples in a meaningful fashion.
The information is there, but because the
MS' documentation has arguably gone downhill over the last 10 years or so. They have focused more on the tool (new help engine vs Winhelp4) and the file format, and not the quality of what is in the CHM files.
Look into using AJAX.Net for providing changes without a full page refresh, ie when I change the dropdown selection for car mfg, it does a postback.. considering the first page is pretty big, this isn't a good thing..
Michael J. Ryan - tracker1.info
On a secondary thought, Portable.Net would probably be more likely to work on your given platform.. probably no porting even necessary.. ;)
Michael J. Ryan - tracker1.info
That's why Novell is putting a lot of time and money into the mono port of C# to *nix?
Michael J. Ryan - tracker1.info
Just to point out, there are other gui interfaces that are cross platform... (gtk#, and wx.Net)
Michael J. Ryan - tracker1.info
Yeah, app/net server apps and services in C# is really nice to work with, especially if you have to do any database or xml work with it...
Michael J. Ryan - tracker1.info
To use the old cliche it isn't a bug it is a feature :)
ASP.NET is supposed to detect the browser, figure out what it supports and then send HTML/CSS/Javascript it can handle. Its all very well saying it should just send standard compliant code, but no browser is completely standard compliant. So your ASP.NET page may not work properly on anything. I think most developers are pragmatic, and want code that works.
If you can't stand the web controls having a layer of abstraction then you can still hand craft every single bit of HTML that comes out like you could with ASP (and PHP and other dynamic web pages). Like any abstraction layer you trade some control for productivity.
Now the validation JavaScript in 1.1 is pretty poor. No reason not to send something standards compliant in that case. If you look around on the net there are updated validation controls you can download (some free some not) that will send out better code. Change your machine.config file to treat FireFox as uplevel and away you go.
It isn't a .net problem, just the implimentation of the standard validation controls. The 2.0 controls are indeed supposed to fix the problem.
Maybe it's a Windows limitation?
:)
Perhaps try running with Mono on windows and see how you go? Just a thought, worth what you paid for it
Sometimes I doubt your commitment to Sparkle Motion
Thank you for pointing that out. NOT A SINGLE DAMN BROWSER WORKS THE SAME! So MS is not the only one to blame here.
You're welcome. I actually totally agree with you. The Web Controls SHOULD render 100% compliant html and java script, but unfortuantley they don't hence the browsercaps stuff.
;) Maybe someone more knowledgeable in the state of the mono web controls could chip in with some more information.
I have actually toyed with the idea of either writing a new web controls library, that provides the same functionality, but with standards compliant html and css and all that kind of stuff. You could either sublcass each individual contorl (really ugly) or do your own from scratch using the System.Web base classes. In fact, you could probably even look into mono for the source, or at least hack on it there to know you got all the code right.
It seems like a lot of work, though, and like everyone else I always seem to be short of free time
Look out honey cause I'm usin' technology
Ain't got time to make no apologies
If you read the other slashdot articles lately, A new greatly improved (from an already great IDE) has been released.
So it may take a while for Eclipse to be available to download since you, the entire slashdot java crowd, and half the java developement world, are downloading it right now (..trying to..).
Good for you fan-boy.
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
I believe he is/was using their menu control. However, the poor page layout is due to .Net. If you spoof Firefox as IE, the page layout works fine. The page layout is not controlled by the menu control. However, the control is not that great itself. As Firefox, the menu control works but it does not change the cursor to a hand properly as it does for IE. If you change Firefix to spoof IE, the menu looks the same but you get a bunch of JavaScript errors.
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
Fascinating! Thanks for the link.
.NET classes may run afoul of patents, whereas an implementation of the JDK core classes would not.
These appear as though they may affect any implementation of a JVM as well, so they actually affect a CLR implementation as well, or would if you implemented the techniques.
Now I'm definitely splitting hairs, but it was my impression that the actual implementation of the
I have nothing to substantiate that though, and I figured while I've got someone who has info on this stuff hanging around, I'd ask if this impression is correct, or whether its just more FUD in a language holy war.
Finally managed to download. Looks like they added two US mirrors. Wish they gave you the size of the download before you started though...
Also, wonder with their 1 million download challenge... I probably show up as seven of them due to failures mid way through.
Any idea how many developers are using Eclipse?
See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
Good one. We've been writing standards-compliant HTML, JS and CSS for years and we manage to make it work in IE5+, Mozilla, Safari, etc. And sometimes we even manage it with C#. I appreciate that no browser perfectly supports specs, but most of the divergence is in fairly obscure stuff, which is why it hasn't been fixed (because almost no one is using it, so there aren't a lot of test cases). Saying "No browser supports standards" is FUD.
It only sends down different HTML if you configure your application to do so. Try using updated settings in your web.config file...
http://slingfive.com/pages/code/browserCaps/