- We design and build extraordinary applications for companies looking to make the next great idea a reality.
- learn more
.NET 3.5 Linq to Sql and IBatis.NET
I've been looking at some of the new features in the .NET 3.5 framework and have found Object Relation Mapping (ORM) very similar to IBatis.NET and NHibernate. In .NET 3.5, they use attribute based mapping between the underlying data table and entity class (Domain Object). For instance
using System.Data.Linq;
using System.Data.Linq.Mapping;
[Table="Books"]
public class Book {
[Column="Name"]
public string _Name;
[Column="ISBNNo"]
public string _isbn;
...
}
What you notice is the the class Book is mapped to a table called Books using the Table attribute and particular table columns are mapped using the column attribute on the Book class instance fields. Compared with IBatis.NET XML files; you would have to:
- Reference the Book class using the <typedalias type="Namespace.Book, Namespace"/>
- Create a ResultMap that exposes the Book class internal fields using <property name="ISBN" Column="ISBN">
- Create the sql statement that references the resultmap for the Book class so IBatis.NET and hydrate the results. Below is sample sqlmap.xml file for Ibastis.net
<sqlMap namespace="Surveys" xmlns="http://ibatis.apache.org/mapping">
<alias>
<typeAlias alias="Book" type="Namespace.Books, AssemblyName"/>
</alias>
<resultMaps>
<resultMap id="BookMap" class="Book">
<result property="Name" column="Name"/>
<result property="ISBN" column="ISBN"/>
</resultMap>
</resultMaps>
<statements>
<select id="GetBooks" parameterClass="map" resultMap="BookMap">
select name, isbn from books
</select>
</statements>
</sqlMap>
Furthermore, much of the guesswork required to create the parameterizes queries used to pull information from the database and load a collection of Book objects has been added. Simply creating a new Linq DataContext object, passing the connection string to the database and calling the generic GetTable<T> (where T is class name. in this case Book) is all you need to get the results, versus creating the individual sql in the xml file and calling one of the QueryForObject or QueryForList methods found for IBatis.NET.
Last but not least, Linq provides the programmer with built-in sql like keywords used to build expressions that sort, aggregate and limit the original result set to some more specific or limited result result set without going back to the underlying database.
Although, this is a very simplicity view of mapping a database table to .NET class. This does give you a good picture to the additional overhead required to using IBatis.NET xml file mapping versus Microsoft's Linq to Sql attribute base mapping, and demonstrates how ORM is now built right into the .NET Framework. And, you be happy to know that your .NET 3.5 Linq to Sql applications will still run on .NET 2.0 because the new features are specific to the specific 3.5 .NET compiler.
Topics: Web/Tech
BDD: Book Driven Development
Jay Fields, who has been posting a very nice sequence of nuts-and-bolts Ruby and Rails guidelines, pauses to talk about creating examples. It's a topic I've wanted to write about here for a while, and this is as good a lead-in as any. Plus, I'm generally interested in how principles of software development apply or don't apply in odd cases, and software being developed specifically for example purposes certainly qualifies as an odd case.
For Professional Ruby On Rails, I knew that I wanted to run a single example application through the book. I had some grand visions of it being a "real" application or at least a real example of coding best practices. For best practices, I think it's pretty good on a method-by-method bases, but has some weaknesses as an entire app, for reasons that I think will become clear.
Topics: Agile Development, Ruby on Rails
Breaking Prototype habits in a jQuery world

When you get used to doing things one way, it's hard to retrain yourself. It took me months to "get" the Prototype way of doing things after a decade of writing all of my own Plain Old JavaScript, sans framework. Now that I'm more likely to use jQuery, I've still got some residual Prototype habits to break.
In Prototype's Enumerable class, you call the each method to iterate over a collection. In jQuery, you can do the same - but you often don't have to. Many of the standard jQuery methods automatically iterate over the member nodes of a jQuery object. There's usually no need to do so manually using jQuery's version of each. My friend and former colleague Zack Frazier reminded me of this fact the other day, in response to this original post. His input helped me fine-tune my JavaScript on the new Pathfinder website.
Compare my original version of this code, which transforms target="_blank" windows into more finely controlled JavaScript popups:
Topics: Ajax Frameworks, jQuery
QWT: Qooxdoo Web Toolkit

Qooxdoo is an Ajax framework that I haven't spent much time with, but after meeting the guys of Qooxdoo at AjaxWorld East and finding out that it's pronounced "guckst du," as in the German slang "Was guckst du?" (Rough translation: "What are you looking at?"), my interest has been piqued.
One interesting recent addition to qooxdoo is QWT, the Qooxdoo Web Toolkit, a Java to JavaScript "compiler" that works with the qooxdoo framework. I put "compiler" in quotations because, after looking at the code, it looks more like a Java to JavaScript translator. Also, where GWT has a hosted mode where you can debug in Java, QWT doesn't appear to have that feature, so debugging wonky QWT code promises to be a bit of an adventure.
Still, an community effort of this kind indicates that qooxdoo is a vibrant framework. I intend to give qooxdoo a closer look over the next few months.
Technorati Tags: ajax, qooxdoo, qwt, gwt, java
Topics: Ajax Frameworks, Java, qooxdoo
Two Years of Agile Ajax: Web Killed Off GUI Techniques Just in Time for Ajax to Need them Again

I launched this blog just a little over two years ago, on March 21st, 2006. Appropriately enough, my first post was about User Experience (UXD) and Ajax. The blog has come a long way since then -- we've added another full-time blogger (Brain Dillard), published nearly 700 articles of original Ajax and Agile related content, and covered the major new innovations in Ajax and Web 2.0 -- but in many ways Ajax technology is still struggling with the same issues that I wrote about back then:
As it stands, Ajax is still in its infancy (or in its wild west phase -- pick your metaphor), and Bill's simple three part "patterns" are emblematic of this.
Topics: Ajax Development, Design Patterns, Desktop RIA, Web 2.0, Web Development
Delighting the user with the tiniest of details

Building software people love involves learning to read minds - or at least learning to think like your users. In the world of free, web-based software, there will always be 10 versions of every application: 10 different to-do lists, 10 different dictionaries, 10 different bookmark organizers. It's not enough to meet users' expectations about features; you've also got to delight them if you want to win market share. If you don't think through every interaction and use case, you're probably annoying the hell out of people without even knowing it.
That's why it's important to actually watch users in action with your application. It's a maxim in user experience design circles that you, the programmer, are not the user. Sure, you should eat your own dog food, but remember that the experience of using software that you wrote - and whose every shortcoming and compromise you understand from the inside - isn't the same as chancing upon that software in the wild and giving it a shot. Look at your software through the fresh eyes of users who didn't write a single line of the code. That's when you'll actually learn what you've created and how to improve it.
... all of which proselytizing serves only to introduce one rant and one rave about free software I use every day. Neither of these are web applications, but both of them are tied directly to the 'net.
Topics: User Experience, User Interface Standards
jQuery Form and jQuery UI Tabs: Two great tastes that taste great together
I spent last week holed up writing part 4 of Ajax Overhaul, my series of articles for IBM developerWorks. Aimed squarely at Ajax beginners, the series shows how to progressively enhance Web 1.0 sites with jQuery and Ajax. Each installment starts with the pre-Ajax version of an example e-commerce application and takes readers through the steps of retrofitting it to improve and modernize the user experience. The tagline for this installment is "Streamline multi-step processes with tabs and Ajax forms," a topic that allowed me to employ two of my favorite plug-ins for the jQuery open-source Ajax toolkit:
- jQuery Form, which gives jQuery several methods for serializing form data and submitting the results via Ajax.
- jQuery UI Tabs, which turns a series of divs and unordered lists into a tabbed interface.
I feel like I've run on and on about my enthusiasm for jQuery on this site, but I can't help it. One of the cool thing about its plugin ecosystem is the ease with which you can cross-pollinate a couple of plugins to create novel effects. In this case, I wanted to take a series of web forms - the checkout process for my example shopping site - and turn them into a single-page, tabbed interface in which each tab represented one step of the process. The biggest additional requirement was progressive enhancement; with JavaScript absent or disabled, the checkout process has to work like it did before I retrofitted it. All it took to accomplish these goals was a judicious mix of my two plugins.
Pathfinder website relaunch: Simple tools for simple problems

At long last, Pathfinder's new website launched on Friday. To see the results of all my fiddling with Radiant CMS, point your browser at www.pathf.com.
There's actually no Ajax and very little DOM scripting involved in our first iteration. Just a little jQuery to progressively enhance some links. Our strategy in redeveloping the website quickly and iteratively was to use simple tools for simple problems. jQuery fits the bill perfectly. Eventually we hope to show off our Ajax chops on the Showcase section of the site. In the meantime, we got a new site up and running in two months with part-time commitments from a team of five - and that includes our client, the CEO. Result!
An in-depth look at our use of jQuery and why we dig it after the jump.
Site Maps — Still Needed for Web Apps?
In a previous post, I talked about creating a Use Case Diagram as a means to moving the 60,000’ concept to a level of detail that’ll allow us to begin development. Since that diagram identifies the overall functionality, the team can use that to start designing the data model, writing user stories and generally working towards a more detail view of what we’ll eventually need to develop.
The site map is another diagram I’ve found helpful to bring further definition to the concept.
On some projects, usually those that were understaffed, the site map was typically drawn up after the project was in the end stages of development and only because someone in marketing asked for it. Oh, everyone on the team knew what was being built and the relationship between the areas, but it was all verbal -- no one had taken the time to set it down on paper.

At Pathfinder, we sketch out a site map early in the process to give a physical representation to the verbal concepts floating around the team. The ‘we should separate this’, and ‘let the user skip from here to there’ and ‘oh yeah, both these areas relate to each other’ kind of ideas that float around before requirements are actually written.
The very act of documenting work to further define the concepts and gives the team a visual artifact for future decisions. The site map, no matter how rudimentary, begins to identify and categorize the user activities into a relational hierarchy and provide a framework for the application. It helps in project scoping and planning because it begins to further identify the details of a project, which can then open a conversation as to what is needed now and what can be postponed to later. It is a concrete drawing that you can show the client and ask, do you agree? Is this what you want?
As with Use Case Diagrams, a Site Map gives you an overall view of a project -- not necessarily all the details but a high level view of the end goal. Both documents are relevant because both give you a checkpoint to refer back to once you’re in the details of a project to make sure that you’re still on track to meet the project objectives.
Checking in from AjaxWorld East
Just a quick update from the conference (which is now over). I gave my talk at the AjaxWorld East 2008 and got some interesting reactions. The talk really had three parts.
- What is GWT and how do you use it?
- How do I resurface an existing J2EE app?
- Where are all of the alligators?
There is always a risk that someone or other feels that too little or too much time is spent in one part or the other. In fact, while converting a JSP to produce JSON so it could be consumed by the GWT client app, I had one person raise their hand and as "what does this have to do with GWT."
So, in the end, I had half the people nodding their heads, yes, and the other half shaking their heads, no. I was peddling a very pragmatic approach, rather than a product or service, and that might have thrown some folks off.
Met a lot of cool folks, put some faces to names, got to sit on a panel with Douglas Crockford. Cool beans. More next week.
Topics: Ajax Development, GWT, JSON
My Favorite Monkeys

In whatever language I use, I wind up building up a collection of utility methods that I take from project to project. I think everybody does this in one way or another.
In Ruby, of course, you can monkey patch those methods right into the existing core classes... here are a few monkey patches that I can't do without.
One way to get yourself in trouble in Rails is to have some methods that expect ActiveRecord ids, and others that expect the actual ActiveRecord objects. It's easy to get into this if you start passing the id's directly from params sometimes and other times convert the param in your controller. So, I add this conversion to Integer and ActiveRecord::Base. The usage is as follows:
def do_something(ar_or_id) ar_or_id.to_active_record(User).full_name end
The implementation lets the object system handle type management. The only weird wart is that you have to pass the actual ActiveRecord class to the conversion method, I think that looks a little strange.
Topics: Ruby on Rails
IE8, HTML5 and Ajax Navigation: The future of Really Simple History
Speaking of Really Simple History....
While perusing John Resig's widely discussed analysis of IE8, I was surprised by his lack of fanfare when discussing its support of HTML 5's Ajax navigation module. This is a major development in the arena of Ajax history and bookmark management.
John's comments:
HTML 5: window.location.hash
Already supported fairly well by most browsers. Modifying window.location.hash changes the page URL and adds the page to the history (allowing for back-button simulation in Ajax applications). IE went a step further and broadcasts the hashchanged event (the first browser to do so, as far as I know).
Topics: Ajax Bookmarking, IE8, Javascript, Really Simple History
Use Case Diagrams
Projects start off at the 60,000 foot level -- the client wants a widget that allows their users to do X, Y & Z -- and need to be brought down to a level of detail where coding can begin. Something I use to start this process is a version of the UML Use Case Diagram.
For those of you not familiar with it, a Use Case Diagram describes the needed functionality in a system. Unlike flow diagrams, however, the use case diagram doesn’t represent the order or number of times the functionality needs to be executed and it doesn’t display any subroutines. Instead, it’s a high level diagram that identifies the primary tasks an actor/persona needs to be able to do.
The beauty of this diagram is that you’ve now captured the overall view of what the system needs to be able to do in order to allow the user to complete all their tasks. With the high level activities clearly identified, the diagram easily lets you communicate with your client and get their sign off that the needed functionality has been accurately captured. From here, the team can move onto further defining what’s needed to support this functionality: data modeling, user stories, task flows, etc.
Topics: Best Practices, Design, Information Architecture
The imminent return of Really Simple History
Anybody perusing the issue tracker or Google Group for Really Simple History would think I've abandoned my duties as code steward. For the past several months, that's been the unfortunate truth. My involvement in other freelance and Pathfinder projects has kept me away from my favorite pastime: Hacking away at the next iteration of RSH. Fear not, fans of Ajax history and bookmarking. I have carved out a large block of time starting next week to get back to work.
Over the next week or so, I'll be responding to threads in the Google Group and making my way through the issue tracker. Then, I'll dive into bug-fixes, enhancements and support for the new and emerging browsers, from Safari 3.1 to IE8 to Firefox 3.
Thanks, everyone, for your patience, your bug reports and your feature requests!
Topics: Really Simple History
Programming Books, Mostly Not By Me

Thanks, Ivan for starting this conversation, and giving me a reason to talk about the book market. I pour over the O'Reilly posts on the state of the computer book market like they were baseball cards of my favorite Cubbies. Naturally, I couldn't resist unleashing my inner Bill James on the numbers.
First off, though, while it's tempting to read a lot into these numbers, they are only a very rough proxy for actual usage of the various languages. Sometimes the book numbers precede actual usage as a new language builds up mindshare, then gets used in projects. Sometimes the book numbers trail actual usage, because publishing has a pretty long lead time before books can actually enter the market.
That said, if you're looking for a language that's going to be way up in 2008, my money is on Objective-C. Two words: Cocoa. Touch. Although it's not clear to me how quickly an iPhone specific book could even get published.
With respect to the specifics of the Java market, I'd guess that the reasons for the sales drop have to do with a relatively quiet year in new stories about Java the language combined with a general push to explore more dynamic languages.
Topics: Ruby on Rails
About Pathfinder
Recent
- Roles Testing For Security
- Blackbird takes the pain out of JavaScript logging
- Making GWT JSON not Quite so Painful
- IDEA - preconference workshop 06 Oct 08
- HTML5, Ajax history management, and The Ajax Experience 2008 Boston
- A Look Back At Past Posts
- Flash Player on iPhone gossip
- Microsoft to Jump on Board EC2
- TAE Boston 2008: The Unsexy Presentations
- The Ajax Experience 2008: Hope to see you in Beantown
Archives
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006



