Tuesday, January 10, 2006

Learning Ruby

The Cincinnati Extreme Programmer’s Group January meeting was treated to a presentation by Jim Weirich, a consultant for Compuware, about Ruby On Rails. I could not make the meeting but watched a recorded video of the presentation and reviewed Jim’s blog concerning the meeting. As I was perusing Jim's blog I came across his link on a talk that he will be giving at the upcoming Dayton-Cincinnati Code Camp entitled, "10 Things Every Java Programmer Should Know About Ruby."

I must say that Ruby looks intriguing. In fact, I have registered for the Dayton-Cincinnati Code Camp and am looking forward to Jim's talk. Moreover, I ordered the Agile Web Development with Rails: A Pragmatic Guide book. I can not wait to dig in!!

Thursday, January 05, 2006

Output Parameters from C# Method

I know that this is “old hat” to many but I am working on an application where I needed a method to return two separate values. I turned to good ole output parameters. I know I could have created two separate methods but the values within the problem domain are always associated. Therefore, it made sense to me to use output parameters with one method.

Here is an example using a NUnit test and the method returning two values via output parameters.

[Test]
public void TestParseAndReturnTwoSeperateStrings()
{
string toParse = "00050000999";
string strOne;
string strTwo;

ParseAndReturnTwoSeperateStrings (toParse, out strOne, out strTwo);

Console.WriteLine("String 1: {0}", strOne);
Console.WriteLine("String 2: {0}", strTwo);

Assert.AreEqual("000", strOne);
Assert.AreEqual("50000999", strTwo);
}

private void ParseAndReturnTwoSeperateStrings (string input,
out string strOne, out string strTwo)
{
strOne = input.Substring(0, 3);
strTwo = input.Substring(3, input.Length - 3);
}

Saturday, December 17, 2005

NUnit 2.2.4 Released!!

Just got an e-mail within the Test Driven Development Yahoo Group from Charlie Poole concerning the release of NUnit 2.2.4:
If you haven't followed the development releases, here are a few highlights of what's new, as compared to NUnit 2.2:

* NUnit 2.2.4 runs under .Net 2.0 and works with VS2005. If you work exclusively with .Net 2.0, you can download a version that is actually built with that framework version, which eliminates dealing with the config file.

* You can run tests built against older versions - 2.0 or later - of NUnit without recompiling. As a bonus, you can run tests built against CSUnit without recompiling.

* A number of new Asserts and Attributes have been added. It is now much easier to create your own custom Asserts while still taking advantage of NUnit's built-in error message formatting.

* An extensibility mechanism allows you to define your own attributes for test fixtures and cases that behave in non-standard ways. [This feature is Still a bit experimental, and will appear in final form in the 2.4 release.

* Documentation is substantially improved and is provided as a set of html files. The packaged documentation includes only version-specific details, with info that may change over time, such as contacts, kept on the web site.

You can read the full release notes at http://nunit.com/testweb/index.php?p=releaseNotes&r=2.2.4. Note that the nunit.org site has not yet been updated to reflect this release.

You can download NUnit 2.2.4 at http://sourceforge.net/project/showfiles.php?group_id=10749

Friday, November 25, 2005

A thought experiment, just for fun

I typically, for a brief dose of humor, will go to the Dilbert site some point in my day. As I browsed to the daily comic strip I noted a link to Scott Adam’s free e-book entitled God’s Debris. Here is a part of the introduction:

The central character in God’s Debris knows everything. Literally everything. This presented a challenge to me as a writer. When you consider all of the things that can be known, I don’t know much. My solution was to create smart-sounding answers using the skeptic’s creed:

The simplest explanation is usually right.

My experience tells me that in this complicated world the simplest explanation is usually dead wrong. But I’ve noticed that the simplest explanation usually sounds right and is far more convincing than any complicated explanation could hope to be. That’s good enough for my purposes here.

The simplest-explanation approach turned out to be more provocative than I expected. The simplest explanations for the Big Questions ended up connecting paths that don’t normally get connected. The description of reality in God’s Debris isn’t true, as far as I know, but it’s oddly compelling. Therein lies the thought experiment:

Try to figure out what’s wrong with the simplest explanations.

What I found interesting is that, at least, sounds very much like the "simple design principle" that is advocated, correctly in my view, by the Agile Extreme Programming methodology.

In addition to this, I also found of interest related to software development was a discussion of pattern recognition and usage. In the chapter, Science, the central character states:
Computers and rocket ships are examples of inventions, not of understanding," he said. "All that is needed to build machines is the knowledge that when one thing happens, another thing happens as a result. It’s an accumulation of simple patterns. A dog can learn patterns. There is no 'why' in those examples. We don’t understand why electricity travels. We don’t know why light travels at a constant speed forever. All we can do is observe and record patterns." (P. 22)
In any event, instead of getting my daily fix of humor I got much more, a jolt to my thinking about fundamental questions. That, in my possibly warped view of entertainment, is for more enjoyable. Moreover, perhaps the joke is on me since I do not know nearly as much as I foolishly thought.

Thursday, November 17, 2005

Agile Amigo?

Ivar Jacobson, one of the founders of UML, pledged to support Microsoft Visual Studio 2005 Team System with the goal of a more agile approach to design and modeling.

Check this potential Agile Amigo out here. This will be interesting to follow.

Tuesday, November 15, 2005

Microsoft released guidelines for converting ASP.Net 2002/2003 projects to Visual Studio.Net 2005

Microsoft released guidelines for converting ASP.Net2002/2003 projects to Visual Studio.Net 2005 at Step-By-Step Guide to Converting Web Projects fromVisual Studio .NET 2002/2003 to Visual Studio 2005.

The article states:

The primary benefit of converting a Web application project to Visual Studio 2005 is the ability to use many new features in ASP.NET 2.0 (e.g., master pages,etc.) in your existing application. If you are looking to enhance an existing Web application built using Visual Studio .NET 2003, then upgrading to Visual Studio 2005 is most likely the right decision.
As expected, simple projects will be easier to convert:
For relatively simple Web projects where a Webproject is the only project in your Visual Studio .NET 2003 solution, conversion should be a relatively automatic process requiring little time or problem resolution.

However, not all ASP.Net 2002/2003 project conversions will be easy:
If the application you are converting is of reasonable size and has several Web projects and additional projects, such as class libraries, in a single Visual Studio solution, it is possible to encounter issues during migration. Be prepared to spend the better part of a day completing the entire process. The steps and guidance provided in this article can help an informed user to migrate most applications of medium complexity.

Thank you Web Platform and Tools Team for your honest assessment. I must admit that I am very skeptical when someone says, "it’s really pretty straight forward." Yea....right. In any event, I am looking forward to moving some of my small-sized projects to VS 2005.

Monday, November 14, 2005

Webservice Account Permissions "Gotcha"

For a project, an internal customer wanted to utilize web services for file reading and writing. Both the file write and read services were utilizing a System.IO.FileStream object, invoking the object's Read and Write methods. Since the location that the web services would be reading and writing from is a network share, two domain accounts were setup and given read, and you guessed it, write permissions each respectively to the share.

The “gotcha” that we encountered was that the accounts that the web services were utilizing needed modify permissions on the server <WindowsFolder>/temp folder in order to generate serialization proxies.

Click here to see what was done to remedy the issue.

Monday, November 07, 2005

It's in the wild!!

SQL Server 2005, Visual Studio 2005 with .Net 2.0 and BizTalk Server 2006 had their official launch today.

Also, DotNetNuke, an Open Source Web Application Framework, is releasing its 3.2 framework, built on the 1.1 .Net, and its 4.0 framework, built on .Net 2.0.

I can see that I am not going to get much sleep.

Friday, November 04, 2005

New from Yahoo! and still in beta - Instant Search

New from Yahoo! and still in beta - Instant Search where results instantly appear for Yahoo! Shortcuts and common searches.

Thursday, November 03, 2005

Covariance and Delegates in .Net 2

Click here to view this little nugget in .Net 2 dealing with covariance, an object-oriented principle, and delegates.

Very nice code re-use construct!

Friday, October 14, 2005

Essential ASP.Net 2 Webcasts and Lab Exercises

Fritz Onion has been doing some great webcasts concerning ASP.Net 2.

There are also labs and demo code provided with the slides! There is nothing like actually building something with the code to learn newprogramming constructs and techniques.


Saturday, October 01, 2005

Continuous Partial Attention, please?

I typically download podcasts, audio program files in MP3 or WMA format, to listen to as I jog or mow the yard. One podcast feed that I subscribe to is IT Conversations.

A recent podcast dealt with a discussion panel of information overload and how that affects our attention to any one thing at a time.
In a world where information overload is common, attention is a very scarce resource and there is an increasing need to manage it efficiently. In this panel discussion, Steve Gillmor, Glenn Reid, Doreé Duncan Seligmann, David Sifry and Linda Stone talk about the problem of coping with more information than one can handle and the possible solutions.

In a connected world it is becoming very difficult to filter out the information that really needs our attention from that which is irrelevant to us. The panel discusses the work that they are currently involved in and tries to come up with answers to the problem of overwhelming information, only some of which deserves our attention. They talk about the tools, practices and new technology being developed to effectively use data which matters to the end user.

Part of the discussion dealt with what Linda Stone has termed continuous partial attention:

For almost two decades, continuous partial attention has been a way of life to cope and keep up with responsibilities and relationships. We've stretched our attention bandwidth to upper limits. We think that if tech has a lot of bandwidth then we do, too.

With continuous partial attention we keep the top level item in focus and scan the periphery in case something more important emerges. Continuous partial attention is motivated by a desire not to miss opportunities. We want to ensure our place as a live node on the network, we feel alive when we're connected. To be busy and to be connected is to be alive.

She then states how through the last twenty years we have come to realize that the belief that connectedness is synonymous with living is not necessarily true.

Now we long for a quality of life that comes in meaningful connections to friends, colleagues, family that we experience with full-focus attention on relationships, etc.

I for one will begin to strive to give full attention when talking and relating to not only my loved ones, but friends, neighbors, and co-workers. What higher compliment can we pay to others but attention?

It is all about people

The longer I am in the Information Technology world the more I am convinced that it is all about people. What is more important to a company than human capital? We all know that technology provides both assistance and in some forms, electronic enslavement. The latest gadgets come and go. However, when the dust settles, we the people are still here.

We are all still striving to become. Let the newest software languages and methodologies, the latest portable toys, and the most recent killer apps assist us in being, not just being wired.

Wednesday, September 21, 2005

ASP.Net 2 Cross-Page Posting - More than Server.Transfer

Cross-Page Posting provides what we had in classic ASP form posting and more. Instead of the form posting back to itself, as we currently have in ASP.Net 1.x, or using the Server.Tranfer method, also in ASP.Net 1.x, we can now post directly to other ASP.NET forms.

For those controls that implement the new (in ASP.Net 2) IButtonControl interface, such as the Button control, the PostBackUrl property (that must be implemented by the control), "Gets or sets the URL of the Web page to post to from the current page when the button control is clicked."

Too cool!!

For more on this go here.

Wednesday, September 14, 2005

The LINQ Project - Check this out!

Here is a cool announcement that came out of the PDC. According to Microsoft:
The The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.
See a demo from Anders Hejlsberg on Channel 9.

Friday, September 02, 2005

Factory Method or Abstract Factory

Since I provided the code examples in C# for the Head First Design Patterns book, I recently got an e-mail from a reader, James Micheals, of the Head First Design Patterns book that sent me this question.
I'm trying to understand the difference between simple factory and factory method. They are the same thing! It's just one is composed while the other is inherited. I could even argue that since we prefer composition over inheritance, simple factory is better than factory method. I don't understand why factory method is better, and I've been tearing my hair out for hours to figure out why.
While I myself am a mere student of patterns here was my reply and thoughts on his question:
James,

You have asked a good question.

The factory method is good to implement alone if you have variations of a particular object that you need to create.

The Head First book uses a pizza store as the example here. The pizza store has a limited variation of pizzas it sells. Therefore, an abstract class is implemented (extended in java) in your subclasses and you are good to go for specific pizza object creation.

The abstract factory is utilized for creating a "family of objects" and therefore often utilizes factory methods within it.

In short, which pattern is used is dependent upon your need. If a simple set of related objects is what you want, then the factory method is your pattern. If you need a more varied set of objects created, the abstract factory pattern provides this via the ability to use a set of interfaces for each desired set of objects.

You stated that composition is favored over inheritance. That is correct, but which pattern is used is dependent upon your need.

Hope this helps,

Mark


Monday, August 22, 2005

Playing with Partial Classes in C#

I was reading a Partial Class Definition on MSDN and thought it looked simple enough and decided to take Partial Classes for a C# run.

Here it is.

Tuesday, August 16, 2005

Web UI Developers, for now, use the Firefox Browser

I am primarily a Microsoft platform developer. Microsoft makes a great IDE in the form of Visual Studio.Net and has a great language in C#, which is getting better with C# 2.0.

However, I must say, at least until IE 7 becomes more visible and out of beta, that Mozilla’s Firefox browser provides better tools for web developers through Firefox’s extensions for developers.

I especially like the Web Developer extension. Sure beats the Alt+Tab dance between the browser you are viewing your changes with and your CSS editor!

Sunday, August 07, 2005

How can we be sure we are singing from the same page of music? – Fit in the key of C#

To build on an earlier posting on the use of Fit with C#, here are examples of Fit fixtures implemented in C#. The fixtures I demonstrate are the ActionFixture, ColumnFixture and RowFixture.

I also briefly discuss the desire to test properties in addition to fields and methods with Fit. I have "tweaked" the source code to provide this. My initial tests work but I would like to further test the code and submit it to other Fit developers as I am sure this has already been considered. My guess is that I may not be implementing the RowFixture subclass correctly. I will provide my source code on this later following more tests and discussion.

UPDATE 7-10-2006: After posting the above info, I submitted a proposed patch to source forge, artifact 1255429, which deals with using properties instead of member variables. The patch was submitted to source forge in August of 2005. Nothing as of this update has been done, that I am aware of, so I thought I would put it out for public consumption and comment.

In more detail, fixtures deriving from RowFixture have instantiated classes with public variables, instead of exposing the instantiated object’s members via public properties. With these modifications you can write fixtures directly against objects under test, which are typically the actual application classes, exposing properties instead of variables to the RowFixtures. This enables the .Net developer to avoid writing additional code beyond the fixture and the actual application objects under test.

The new post: Testing .Net Properties with FIT

Friday, August 05, 2005

Resharper: Sharper indeed

ReSharper provides some needed editing features for Visual Studio.Net.

For example, if you have private local variables and you want to expose those guys via public properties just Alt+Insert (ReSharper > Code > Generate... via the ReSharper menu) in Visual Studio and you get:

Resharper Generate code menu

As you can see you can also easily generate a constructor, implement interface members, or override members from base classes.

There are many more “niceties” from ReSharper such as automatic indentation within bracket blocks {}. I got real tired of typing the brackets, separating them via hard return, and then tabbing to indent the first line in the block of code.

public void SomeMethod()
{
     //indented code here
}


Instead, when you enter a set of brackets for a block of code, ReSharper will insert your cursor between the brackets. Then, when you hit the Enter key the new line is indented for you! These are just a few of the great features of ReSharper.

I did not mention the Refactoring it provides. ReSharper rocks!!