Archive for the ‘.Net’ Category

Null Coalescing Operator

Wednesday, August 22nd, 2007

Recently, Adam showed us an interesting bit of syntax for C#:

a = b ?? c;

which is equivalent to:

if(b != null){
a = b;
}else{
a = c;
}

I was reminded of it again today when I learned it is called the “Null Coalescing Operator”. Javascript has something similar with:

a = b || c;

I’ve used the hell out of it in javascript so it was cool to see it available elsewhere. Will it come to java?

The Importance of Tinkering

Monday, June 25th, 2007

About 3 months ago, I got onto a .Net project. I’ve been doing java and java web application development for over 7 years now and this was my first .net project…first microsoft code really. I remember dabbling with the clr and getting the .net framework and compiling a simple hello world or something from text pad back when it first came out, but that was it. It has been harder than I expected to get really rolling. Here are some thoughts…from a Java developer just trying adjust.

If you know java, then you can do .Net
“…its just syntactic differences”. Just about everyone says that. I did manage to get pretty far with just refactoring and pairing and such, but there comes a point when you just need to know whats going on under the hood. How are transactions managed, how does the app server work, what is the lifecycle, are there any hooks into it. You need to know these things when you start to venture outside the lines of written code and pair programming. I’d love to tell you I’ve learned the differences and the key points…but I haven’t. Why? Because I can’t tinker with .Net.

One must Tinker
Thinking in code is such a vital part of being a developer. As a java developer, code was constantly taking up residence in my head. Whatever I was working on at the time was being combed over, refined, spun around on its head, crunched down, reworked and just generally evolving as I slept, drove, ate, whatever. So it was inevitable that I’d have something bubble up to my conscious thought and I would HAVE to go code. I’d pull up my laptop and fire up my trusty java IDE and code. Now, I didn’t bill for that time, I don’t even necessarily see it as time spent ON the project. But, it was almost invariably related to something for work, and the project always benefits from the tinkering process. When I moved to .net, I naturally wanted to tinker, all I had to do was fire up the IDE.

Just Launch Visual Studio
Well, ya see, I have 2 problems here: I don’t have Windows (we’ve become Mac people at home) and even if I did, I’m not wanting to fork over the money for Visual Studio. Sure, there are free versions of Visual Studio available (Express editions) but the first thing EVERYBODY says is “But it doesn’t support plugins”. Well, I can get by with that I guess, but the thing is I’d prefer to have the same setup as I have at work…at least as a .net newb. If I’m on a java project I could seriously care less…I’ll fire up text pad and drop to the command line to compile if I was in a real pinch (ie stuck with no network and no ide). But being new to the .net world makes that a bit more of a curve for tinkering especially since just about every walk-through tutorial or example on the web starts by saying “just fire up visual studio”. And since Express doesnt support plugins, that means I can’t do any TDD tinkering either.

So I did bite the bullet and got windows and installed it on my intel mac. Then promptly installed SharpDevelop (a free C# IDE) and began to tinker. Yeah its not the same as work, and its going to be a curve, but its free (well…300 for the OS). It just really sucks that if I really wanted to do this the “Microsoft” way I’d be out about $800 (300 for windows, 300 for VS Basic, and 200 for ReSharper…which is pretty much required for agile development). I’m suddenly reminded why I never got into .net development. Going that route is just a non-start for a dabbling developer.

Where are all the Application Containers?
Now that I can code some stuff up, where the hell are all the app containers? You know, the Tomcats and JBosses and Jettys of the .net space? It’d be nice to code up some web apps too. Oh…yeah…there are none. Its IIS and that’s pretty much it. Ok. I’m pretty sure thats free. What is the file structure for a web application? Can I just drop it in. Oh…well if you google it you get like 4 ways to deploy a web application. Most of them requiring/assuming you have Visual Studio to do it. I KNOW this is possible, and I KNOW it ain’t rocket science…it IS possible to deploy web applications that were NOT written with Visual Studio and do it WITHOUT Visual Studio. But you wouldn’t get that from the folks that write the web ;)

Please, No Hand Holding
I guess my problem with this whole thing (aside from all the cost of course) is that I don’t want my hand held. I NEED to know what is going on under the covers. I NEED to know the environment, how the applications are related and where they live and what their role is. If I were to believe the top hits from my googling, Visual Studio is a required part of .net development…if you don’t have it, you cant really even talk to an app server to deploy your application. You NEED and IDE to deploy your applications? Again, I know this isn’t true, but please someone write about the reality…or kindly point a newb in the right direction.

UPDATE:
Ah let the web tinkering begin: http://msdn2.microsoft.com/en-us/library/ywdtth2f(VS.80).aspx And not a single mention of VS…man I REALLY should rethink my “go to the google” knee-jerk. Anyway within like 15 minutes of this post I went out and had another look at Cassini web server, downloaded the ultidev one and had a hello world web app up complete with an HttpHandler (servlet). Also saw that Cassini is open source…so I’m not sure why there aren’t many more (then again my google kung-fu has really sucked of late).