Showing posts with label podcasts. Show all posts
Showing posts with label podcasts. Show all posts

Thursday, November 15, 2007

Andy Hunt: ”How Hard Can it Be?” at Valtech

Today I was at a seminar by Andy Hunt called "How Hard Can It Be?" at Valtech (Stockholm, Sweden).

It was a great and very funny seminar and I recommend anyone that has a chance to go to the next one.

One thing that got to me was the discussion about complexity... that is accidental complexity and essential complexity. One example he used was the way a language like Java could isn't very intuitive for people new to development compared to a language like Ruby due to accidental complexity.

In Java you would need "public static void Main(.... System.out.println(..." for the basic Hello, World example, whereas in Ruby you would type 'puts "Hello, World!"'.

IDE's do us a great disservice in hiding accidental complexity by using macros to autogenerate code that is required by the language, but probably isn't of any value for the task at hand.

The point of it all is that when the domain is complex, we have essential complexity, but we should avoid accidental complexity, extra code that creates noice, making the code less readable without adding any value.

He also hinted on the irony of the waterfall method that it wasn't supposed to be used the way it has and in fact the document describing the method was a example of a flawed, non-working model of development.

Some time ago I found a really nice book that uses this way of avoiding accidental complexity that Ruby does for introducing newcomers to programming, Learn to program (pragmatic bookshelf).

On the way home I listened to a podcast about RoR, the Ruby on Rails Podcast episode featuring Stuart Halloway. I've only listened to one episode so far but it was great :), got me thinking of contributing a bit more to Open Source.

Tuesday, May 15, 2007

Neat session state trick

Just thought I'd share a neat little bit of code for handling session state in ASP.NET.

The trick is to create a class that keeps it's own sessionstate, like this:

public class CustomerSession
{
private string mName = "";
private string mTelephone = "";

// To enshure unique session key
private static string mGuid = "PlaceGUIDHere";

public string Name
{
get { return mName; }
set { mName = value; }
}

public string Telephone
{
get { return mTelephone; }
set { mTelephone = value; }
}

private CustomerSession() { }

public static CustomerSession GetInstance(HttpSessionState session)
{
CustomerSession o = (CustomerSession)session[mGuid];
if(o == null) {
o = new CustomerSession();
session[mGuid] = o;
}

return o;
}
}

Then you can save data in session like this:

protected void btnSave_Click(object sender, EventArgs e)
{
CustomerSession data = CustomerSession.GetInstance(Session);
data.Name = txtName.Text;
data.Telephone = txtTelephone.Text;
}


I heard about this in .NET Rocks! episode 82 where Richard Hale Shaw where speaking of his way of storing session state in a safe way. It's at about 54 minutes into the podcast episode if you want to check it out for yourself =)

Thursday, April 5, 2007

Weeks of .NET

This last month have been spent coding in .NET (mostly VB.NET) at my full time practice at Avancit AB. I thought I would share a few things I've come across in the projects I've been working on during that time.

T-SQL
I had a problem where I needed to get all mail addresses of all groups in a company except those in the current group. This was solved by the SP shown below:

ALTER PROCEDURE [dbo].[sp_GetMailAddressesByCompany]
(
@intCompID INT,
@excludeGroupID INT
)
AS
BEGIN
— Get all addresses in company that are NOT in the excluded group
SELECT addr.* FROM tblMailAddresses addr
INNER JOIN tblMailGroupsToAddresses con
ON con.intMailAddressID = addr.intMailAddressID
WHERE addr.intCompID = @intCompID
AND addr.intMailAddressID NOT IN
(
— Get all addresses in the excluded group
SELECT addr.intMailAddressID FROM tblMailAddresses addr
JOIN tblMailGroupsToAddresses con
ON con.intMailAddressID = addr.intMailAddressID
WHERE con.intMailGroupID = @excludeGroupID
)
END


BCP versus SqlBulkCopy
Another problem was where we had an application that needed to push tables from a client to a server effectively. The current version at the time used BCP which was run from a batch process and sometimes (but very rarely) failed.

I started to look around and I found that people where replacing BCP with SQLBulkLoad. I suggested we'd try it and we successfully implemented the transfer using it. As the whole process now took place inside the .NET application it was simple to setup a better error handling than was possible with BCP.

Macros
As for productivity, I've started to look into using macros in VS2005. The first macro I installed was one that reversed assignments. I know there are tools that do this, I think ReSharper has this ability, but I don't have it yet so a macro works just as good. You can find this macro at: http://www.codeproject.com/useritems/macroswapassignments.asp

DNR
Anyone still not listening to DotNetRocks are missing some great stuff. As I'm on a train or a bus for 3 hours a day I've listened to quite a few episodes in the last few weeks (1 to 40). Even the early episodes are great, they give a good insight into why things are the way they are and what is new in .NET 2.0 (as I started with 2.0, I don't have much of a reference as to the differences compared to 1.1).

TDD
Next week we're starting a project that will use TDD (Test Driven Development) for the first time within Avancit. It will be lots of fun and I'll probably write how that goes here later.

Friday, December 1, 2006

.NET podcasts and more

.NET Rocks has a huge collection of hour long episodes (currently 204) which seems to be mostly interviews. Then there are Polymorphic Podcast that is smaller but has a lot of value to it (not just the show but the show notes with links and source code). Each, in it's own way is a good resource to keep track of the .NET world.

Another one is the Software As Shes Developed podcast which I haven't gotten into listening to yet. It's described to be about "Web/Ajax, Usability, Programming (Rails/Java/OO), Patterns, Agile" which are certainly interesting topics.