Monday, November 10, 2008

Stack Overflow (Awesome)

I was listening to Hanselminutes the other day on the way home from work and Scott was talking to the guys behind Stack Overflow. I had never heard of Stack Overflow at that point but found the discussion really interesting. Essentially, Stack Overflow is a collaborative question and answer site for programmers. I headed over there and browsed around and found it fascinating. So I signed up (It's free, just create use your OpenID to sign in).

Well today, I really got to put it to the test. I worked up something in C# that I plan on using at the office. I created the UI form, got the easy stuff working in about an hour and then decided to move on to the real meat of the applciation. The first thing a need to do is read a list of names from text file. I haven't really done this before so I went to MSDN and found the StreamReader was what I needed to call on. So I did that and got a big fat error...

So, I checked my syntax and just started at the screen for a while feeling defeated by my lack of skillz.

Then the lightbulb went off and I posted my problem to Stack Overflow and in 2 minutes had my answer...2 MINUTES PEOPLE!!

Turns out it was pretty silly mistake on my part, buy hey, I'm new to this.

Awesome eh?

Thanks Kent!

Wednesday, October 22, 2008

Project: Mercury - 1

Project Mercury (first planet, first project...works for me)

Simply put, it's a podcast client.

Something small, fast and unobtrusive.

I've tried a lot of podcast clients and they all felt strange or not quite right for one reason or another.

Just to get it out in the open, no I'm not using iTunes. I use Windows Media Player to manage my audio files. Primary reason being it can watch folders for changes and I don't have to add music to my collection via the WMP interface...why iTunes can't do this is beyond me.

I have no idea on how I'm going to accomplish this with C#, but I'm going to try.

I'll post my thoughts on what I think this app should be like soon, but until them maybe you can tell me what you think would be good to have in a podcast client.

I got a lot of great feedback on my post about learning C# or Java. I really appreciate everyone taking the time to post comments. It's helpful.

Monday, October 20, 2008

C# or Java?

In reply to my earlier post asking others how they learned C#, I received a message from a reader who thought that it would be wise for me to learn Java first.

I have to admit, I never really thought about learning Java. Most if my Java experiences have been as an end user and quite frankly been pretty awful. My current employer uses alot of Java based apps and we've had performance issues, issues with one version of JRE working with certain apps and another not working with others, bizarre cross platform incompatibilities and oddities etc...

From what I understand, syntactically C# and Java are very similar and skills and methods learned in one may easily translate to another.

I'm not sure I'm willing to change paths now. What would be that advantages or disadvantages of doing so?

Saturday, October 4, 2008

Namespaces are cities

I was paging through Ron Penton's "Beginning C# Game Programming" tonight and in chapter 4 he covers into the topic of namespaces.

He uses an interesting metaphor to describe namespaces that never crossed my mind: Cities

I'll paraphrase a bit...

If you tell someone merely that you live on Main Street that's not really telling them very much information. You need to tell them the name of the city too. Think of the namespace as the name of the city and the class as the street. He goes on to explain that Direct3D and DirectSound both contain classes called Device. It's really the namespace that differentiates them.


Direct3D.Device
DirectSound.Device

While I think this works, it doesn't really resonate with me.

I'd like to hear what you think.

Wednesday, October 1, 2008

Namespaces are tool boxes

So, I was trying to think of things that I really just didn’t “get” when I recently started learning C# and namespaces, classes and methods came to mind.

I’ve been using computers all of my life but my programming days ended after my Commodore 64 power supply bit the dust. I have very fond memories of reading this book late into the evening when I was a kid. Peek or poke anyone?

Now, I’ve done a lot of scripting over the years both on *NIX and Windows but this C# stuff felt really new to me and kinda alien at first.

One of the first things that I got hung up on is the concept of namespaces. namespaces are something every application you write will use. Most will use more than one namespace. I like to think of them as tool boxes. Perhaps you can come up with a better metaphor, but I can’t. So, they are tool boxes for now.

Now an empty tool box isn’t much of a toolbox, so you need to fill it.

Microsoft gives you a lot of full tool boxes to get started with in the .NET Framework. In fact, you can see them all in this cool poster.

Now, tool boxes need tools. The tools that namespaces contain are called classes. Classes, like actual tools, are manipulated by methods.

Like this:

toolbox.screwdriver.turn screw;

namespace name.class name.method name;

and the real code would look like this:

System.Console.WriteLine ("Hello World");

System is the tool box, Console is the screwdriver (you know, that DOS prompt thing) and WriteLine is the method or action

So this bit of code opens the System tool box, pulls out the Console tool and Writes a Line (Hello World!)

This may seem over simplified to some of you, but it really helped me understand namespaces, classes and methods.

You can also create your own namespaces and fill them with your own classes and methods.

We'll save that for another post.

Am I way off the mark here?

How would you describe namespaces, classes and methods?

-------

I found this article helpful.

You can find a high res version on the .NET Framework poster here.




How did you learn C#?

I thought it would be appropriate for my second post to ask my readers “How did you learn C#?”

I’m taking a few approaches. I bought a subscription to learnvisualstudio.net as I saw some of the videos they produced on MSDN and thought they were really helpful.

I’m also one of those people that really doesn't learn how to do something until I really need to do it. In other words, I need a problem to solve first and foremost.

I have a problem and I’m working on a C# solution. I plan to talk about that more in an upcoming post.

I’ve looked at few books, but I’m not sure a book is the right way to go for me.

MSDN seems chock full of great stuff albeit sometimes hard to find.

In the meantime, how did you learn C#? I’m really curious to know.

Hopefully, the conversation I’m starting (this blog) will be another avenue for learning C#.

Thanks for reading!

Hello C#

Hello C#!

What is Hello C#?

Hello C# is a blog that I'm starting to help detail my journey into learning C#।
I'm hoping to post my findings and thoughts along with the many questions I'm sure to have.

Hopefully, this will develop into a friendly meeting place for folks who want to learn C# and for those C# experts who want to help others.

Thank you very much for stopping by. Hopefully it's been worth your time.

Warm regards,

Jim