|
LATEST POSTS
Saturday, December 08, 2007
Two months on and the alt.net movement (that's right folks, by the only definition that matters, it's a movement) is showing no signs of slowing down. Over at the discussion group, there is muy talk on a myriad of topics, including some threads on how to talk in the discussion group itself which seems kinda metaphysical until you actually read the posts. For my own part, my perception has altered ever so slightly. I'm still very much excited at the direction but I had a little mini-crisis of conscience about how much time I was spending on some of the more useless threads. And not wanting to add to the problem by replying to them, I voted instead with my mail reader. That is, I went through the alt.net-labelled mail and start pruning. Ruthlessly. Anything that had no direct impact on my work or added nothing to my sense of professional development - deleted for good. If there was any doubt, I trashed it. If I wanted to be melodramatic, I'd say it was an uplifting, cathartic, and spiritual experience. But let's keep things grounded here. It's just deleting e-mail. If I were to be totally honest, all it really did was knock a few megs out of my inbox. But when I was done, I had gone from about 380 conversations to just under 250. So with all the talk of whether the discussion group was going to pot and with all the head-shaking I'm doing about whether I'm wasting my time, there are still 250 genuinely interesting conversations that I would like to keep track of in some form. Seems pretty relevant to me. The other thing I gave some thought to was how all of this would impact me in the near future. There is a lot of talk about what alt.net is and what it should be and what the logo is and what direction it's going. All of it valid and necessary to be sure (although all posts in these topics didn't make the cut), but I wanted some real tangible calls to action. Something I could write on a sticky note and put on my personal scrum wall. And I'll tell you who I think is doing things the right way in this regard. Not someone who posts regularly on the discussion group (if at all). Rather, he's been spending his time touring Canada speaking at no less than six user groups in the last two months. It's the Igloo Coder, Donald Belcham, who apparently believes there's no better way to spend a brisk Canadian December evening than talking brownfield development techniques in Winnipeg. Donald is braving prairie snows, 6:00am flights, and some dangerously friendly airline staff to get the word out. And you should talk to him about the reaction he's getting which, from what I've heard, is nothing less than stellar. Techniques that many of us take for granted are killing in eastern Canada. He's had to shift presentations midstream because people were so into his talk on TDD that they wanted more on that rather than whatever it was he had planned. So when I think about what I want to accomplish in the next six months to a year, yes, it will probably include the likes of DevTeach and Canada's alt.net conference. But let's not forget that there are a lot of people out there outside alt.net that just want to learn how to do their jobs better. And they probably aren't that far away from you. Kyle the Planned
Monday, December 03, 2007
Yeah, so the daily updates can be added to my list of good ideas at the time. As it is, I'm posting this one only because I feel some strange sort of internal obligation to at least document the fact that I attended. God bless the internet for being the backup drive for my memory. I'm really glad I attended this conference which is slightly different than saying it was a good conference to attend (which it was). I personally would have liked to see more intermediate to advanced presentations on the subjects I'm interested in but maybe I just attended the wrong sessions. All the presentations I sat in on were entertaining and I gathered some good nuggets of information, but from a pure content perspective, it's hard to justify the expense. Or having to deal with the refrigerator they call Vancouver. It &*%$ snowed here the day I left, I'm pretty sure out of spite. But the real value of DevTeach (as with most conferences) is rarely the learning experience. Or rather, it's rarely the book learning 'cause quite frankly, I learned more than I would have preferred in some cases. Last night, I sat exactly in the middle 'twixt two tables at a bar with JP Boodhoo at the head of one discussing being a thought leader in the community and Scott Belware at the head of the other talking about how strippers can't scale. It was like those cartoons where there's a devil on one shoulder and an angel on the other, both vying for your attention. Much of the time, I stayed in my comfort zone and hung out with the western Canada contingent (see Appendix). There was much merriment with this crew even if, by the end of the conference, I started responding to e-mails with messages like: "Don't you people have an OFF button?" Maybe I'm getting too old. Despite my brains getting rattled with all the head shaking in disbelief, it was primarily this human interaction I was anticipating. Hallway conversations, lunch/dinner with old and new friends, chats in the hotel bar after the conference. These are things I don't get to do much and they are my lifeline to the industry. And they help me keep pace with the alt.net movement. All in all, a good introduction to the DevTeach experience for me and one I look forward to next May in Toronto where the flight will be more convenient. And the weather *better* be warmer. Kyle the Declimatized Appendix: The Coding Hillbilly's Peeps for DevTeach. A list of people or persons that kept me entertained and/or warm throughout the conference. Interpretation of that statement is left as an exercise to the reader. As I said more than once at the conference: I don't need to impress you people.
Wednesday, November 28, 2007
Day 1, for completeness, I spent shopping with Dave Woods, which he really should hire himself out for as a service considering how often he does it. Also saw No Country For Old Men (review, such as it is, is over at my usual movie haunt; short version: it rocks) and attended Party With Palermo and we now have undisputed, non-Photoshopped proof that Justice Gray and I are two different people. Summary sessions I will leave to others because as it is, this post will be lost in a sea of DevTeach: Day X blog posts. Instead, here are my reviews of the presenters' styles. No links to their blogs because they're pretty much all more well-known than I am. Jeremy Miller: How does design get done on an Agile project? Presentation alias: The Story Teller (no pun intended...ok, it was intended) Underlying motif: Down-home folksy; free and easy going Summary: Watching Jeremy present is kind of like talking with your older brother whose just come back from a trip to Europe and has some good stories to tell. Any advice he gives seems as if it has been passed down for generations. Donald Belcham: Continuous Integration with CruiseControl & NAnt Presentation alias: Pipes Underlying motif: Understated; commands respect Summary: Don, with his low, resounding voice, is the Barry White of presenting. Everything he says sounds like it will help you, personally, get laid. You could hear audible swooning from the audience whenever he said "continuous integration, baby". David Laribee: User Stories, Iterations, and Releases Presentation alias: The Hippie Underlying motif: Approachable and affable; Summary: Dave is the master of fonts and presents with a bit of an edge. He's got a quick wit that he pulls out sparingly but pointedly. And I'm pretty sure he was wearing tearaway pants. James Kovacs: The Persistence Ignorant Domain Model Presentation alias: The Ambassador Underlying motif: Professorial; Wise and well-traveled Summary: James' style is well-rounded and well-grounded. Ever the diplomat, he always manages to find good in everything. Such is the power of his pursuasion, for a fleeting moment, I considered using the ADO.NET Entity Framework. Richard Campbell & Kent Alstad: The Scaling Habits of ASP.NET Applications Presentation alias: The Geeks (I mean that in a good way) Underlying motif: Dynamic, good-natured rapport; Summary: I stayed only about fifteen minutes into this (family emergency, not content-related) so I didn't get the full Camb-stad experience. But the two feed well off each other and give a solid presentation well balanced 'twixt friendly jibes and hard-core techspeak. Kyle the Presented
Sunday, November 25, 2007
Airports aren't happy places. In fact, they are pretty angry in that they are filled with angry, angry people. People who have lost their luggage, missed their connection, just had a run-in with the humorless security agents who live for any event to break up the monotony after the novelty of "guess the passenger's ailments based on the contents of the carry-on" wears off. And when one travels alone and pays attention, it can provide an endless source of entertainment. Airplanes themselves are a little less entertaining. The people are generally in a better mood and the conversations you "overhear" are downright banal. Especially when you are leaving someplace tropical and the younger tourists are talking at a volume just slightly louder than normal so they can be sure those immediately around them can hear them talking about how drunk/sunburned/"almost" killed they got on their vacation. I cringe when I think I used to be those people (and very likely, still am). But those are just general observations that have nothing really to do with DevTeach except that they will set the stage for the next week on this blog-thingy. Like ALT.NET, I'll be focusing more on general impressions and stories than specifics of the technology because there are people more eloquent than I who can cover details. And frankly, tech-writing is boring to write and I don't have the attention span for it most of the time. My specific flight from NAS to YYV was fairly uneventful. Sat next to someone who was relatively chatty in the YYZ-YYV leg which doesn't bother me too much. He was apparently on his way to Vancouver to see his daughter who was having a hard time because of a recent car accident involving a drunk driver and she'd been laid off because of it and he was supposed to drive but the trailer he was going to use (which was filled with all kinds of valuable belongings including a bunch of old jazz vinyls) had been stolen and he suspected his friend's son but he couldn't tell the police because then the kid would get popped by the drug dealers he likely sold the trailer to pay off. Me: "Golly, that's a bummer....<awkward silence>....so...ummm, my name's Kyle....and....uhhhh....I'm just gonna go back and do my crossword puzzle, mmkay?" The Sheraton Vancouver Wall Centre has made an excellent first impression being nested near both an adult store advertising 25 cent peep shows and a church that celebrates the birth of Jesus old-school: with a dazzling Christmas light display. The room will make an excellent home for the next week despite the fact that it, like all hotels in North America, comes with a coffee maker but no kettle. The only oddity is that the room seems to lack cold water. The temperature ranges from blisteringly hot from the hot tap and slightly warmer than lukewarm from the cold tap. Internet access, I've been assured, is free, despite the ominous log-in page to the right (click for larger view) which also has another feature that's new to me in that it is very adamant that I ignore the last four fields (each helpfully labelled "Ignore this field"). So I had to wait about forty-five minutes before I could log in because my mind kept wandering back to those fields and I didn't want to break the rules this early into my stay. If they wanted me to ignore them, they shouldn't have called attention to them, instead labelling them something like "Enter your name here to receive spam from our hotel for the next four generations of your family." 'Tis all for now, hillbillies. Time to wander the streets. Kyle the Nomadic
Saturday, October 06, 2007
The first full day of sessions is over and I'm sorry to report there was not a single mention of moonshine, although by the end of Scott Guthrie's presentation on Microsoft's MVC, I sure felt like I'd had a few jugs. The Hillbilly doesn't do note-taking, but I seriously doubt there will be a lack of coverage on individual sessions given the audience. So you will have to be satisfied with my own little Appalachian-American take on the proceedings: Domain-Specific Languages This topic holds some interest for me academically but I doubt I'll see any real-world implementations of this in my immediate future. There were a lot of questions about what exactly constitutes DSLs, at least until Martin Fowler joined. And I must admit, he held himself well considering the inner turmoil he was going through. But his example domain, "Dealing with loss" was telling. Behaviour-Driven Design Hey, did you know that Scott Bellware likes BDD? Neither did I! Microsoft's MVC Framework Wow! This looks fine like a greased porky-pine. There was a *lot* to like about this presentation. It was nice to see that Scott Guthrie and his team looked at existing frameworks and didn't develop this in a silo. I'm sure there will be much talk on this subject by people more qualified and verbose than I so I'll leave it at that except to say the beta is expected in six to eight weeks. DDD Jujitsu A scrappy affair this one was with Dave Laribee and Scott Bellware (among others) sort of butting heads on how best to implement a model. The debate was whether a function like TransferFunds for an account should reside in the Account object or in a separate service. My instinct had me on the latter side but there were good arguments from both camps. After that was a quick wrap-up and judging from the comments from others, Microsoft still looms large with alt.netters. Much praise was given to Scott Guthrie for the new framework and when it was suggested that we shift focus from it, people simple commented on Microsoft in general. I did meet another healthy dose of developers. And in that vein, I'll close up with a "fill in the blank" quiz. Given the following last names, fill in the first names. HINT: All answers are one or more of: Chris, Dave, or Scott __________________ Laribee __________________ Hanselman __________________ Guthrie __________________ Woods __________________ Holmes __________________ Ortman __________________ Bellware __________________ O'Hara __________________ Patterson Kyle the Alternate
Saturday, October 06, 2007
First day of the ALT.NET
conference. I read the mantra for Open Spaces but didn't quite take it
seriously: Whoever shows up is the right group. Whatever happens is the only
thing that could have. Whenever it starts is the right time. When it's over,
it's over.
Sounds pretty zen, especially for Texas. In any case, it looks like it will
make for an interesting conference. And I'll be trying out these rules the next
time I get in trouble from the missus.
We started off with introductions and a little round table thingy where it
became clear that I have a different definition of "alternative" than others do.
I thought "alternative" implied the use of unconventional ideas or a choice
between two or more options. Seems there are a few people who took it to mean
"something better than what Microsoft feeds us". Hope that doesn't become a
prevalent theme because I'm more interested in getting tools for my arsenal than
discussing what's wrong with any particular technology.
We did manage to nail down some topics for discussion for the remaining two
days. Here is my agenda for tomorrow:
9:30 - 11:00 - Where is Justice Gray and why isn't he here?
11:00 - 12:30 - Who is Justice Gray really?
1:30 - 3:00 - Agile development as it pertains to Justice Gray's hair
3:00 - 4:30 - How can we make Justice Gray a better developer in six
months?
But despite at least one glaring omission, I've already met a lot of great
people and I'm looking forward to continuing the trend tomorrow. And if I happen
to learn something in the process, well, it'll still have been a successful
trip.
Kyle the Anticipatory
Monday, October 01, 2007
Why, I do, dear gatekeeper. And I can't think of any branch of software development more alternative than hillbilly development (as it were). Potential topics for discussion: - Backwoods-Driven Design
- The family tree problem: Is it really NP-complete?
- The open/closed principle as it applies to farm critters
- Mashups (aka Moonshine Development)
- Beauty
Lookin' forward to seein' all my software developin', system analyzin', enterprise architectin', red-green-refactorin', unit-testin', domain-driven cousins out yonder in Austin! The Hillbilly will be there repreSENtin'!
Tuesday, July 31, 2007
Just finished Jean-Paul Boodhoo's Nothin' But .NET course and everything you've heard about it is true. This was, I believe, the first course where I was paying rapt attention and still got lost. It was a fleeting moment but it was glorious! It was like the restaurant scene in The Meaning of Life where my brain is Mr. Creosote and JP is the Maitre d' trying to cram one more wafer of knowledge into it.
There are at least a dozen blog potential posts scattered throughout the week but I'll limit my own coverage to one since I believe Master Simser will probably cover the actual content better than I could. So I'll let him deal with any confidentiality conflicts with JP and instead, I'll post more personal highlights
Day One
JP covers factory methods, state-based vs. interaction-based tests, MbUnit vs. NUnit, guard clauses, and delegates. It's 8:35am.
At 6pm, we lose a couple of people who favour family over brain-scrambling. JP is adamant that it's cool but there's rejection in his eyes and for the remaining three hours, he covers only thirty-six topics, down from his usual rate of fifty-nine per hour.
At the end of the day (a respectable 7:15ish), I decide that what JP really needs is a soundtrack. I vow to remedy this tomorrow.
Day Two
8:30AM - I initiate the course soundtrack with Also Sprach Zarathustra.
1:00PM - Afternoon musical inspiration: Kids In The Hall Theme
6:15PM - I concede defeat and stop trying to keep up on my own laptop.
7:03PM - He invites me up to implement a test. I GOT TO TOUCH JP'S KEYBOARD! See entry for day five.
9:15PM - JP claims he's raring to keep going but prefixes this statement with a half-hidden yawn. We let him off the hook...this time.
Day Three
Today's musical selections: Feelin' Groovy (take note of the opening lyrics), Delilah (by request), and Linus & Lucy
8:30AM - JP claims not to have gotten any sleep last night. Despite this, I switch from tea to a double double with a shot of espresso at Starbucks to try to get my brain vibrating on the same frequency. Also, Jolt. JP orders water.
11:00AM - We take a break while he rants about properties. Or methods or operators or something. Frankly, I'm just glad he's distracted enough that I can catch up.
7:15PM - He laments that we've missed a couple of topics so he refactors the app we're working on so quickly, we travel back in time a few hours so that we can get back on track.
2:35PM - Maintainability trumps all other abilities. It takes me a while to determine he is talking about code and not children.
6:45PM - At one point in my life, I was able to play Flight of the Bumblebee on the piano fairly respectably. I may as well have been playing chopsticks compared to what it takes to keep up on my laptop. Interestingly, Bumblebee is probably an accurate description of the colour of JP's laptop.
8:15PM - It occurs to me that ReSharper has so many keyboard shortcuts, you could conceivably finish your application by mashing on your keyboard at random.
Day Four
Morning inspiration: He Ain't Heavy (He's My Brother) (by request)
9:30AM - We finish implementing the dependencies on the domain. JP claims, "Now we can *really* start moving"
1:00PM - He starts playing his own music to code to. *NOW* we're talking. There is a minor quibble about the selection but they are quickly smacked down (oddly enough, with a ReSharper shortcut).
3:35PM - I thought the music would lull him a little but he actually appears to be speeding up. He no longer moves his hands to type. Instead his hands hover over the keyboard and the appropriate keys press themselves out of respect. Or, more likely, fear.
6:55PM - We settle in for a long night because JP claims he has to catch a flight tomorrow night at 7:30.
10:45PM - We wrap up and I check in with the missus back home in the Bahamas who accuses me of neglecting my daughter, cheating on her, and eating too much cholesterol-laden pizza. Take note, prospective students, Nothin' But .NET is bad for the home life. Even if half your family is two countries away.
Day Five
9:45AM - JP's laptop has just undergone some minor emergency surgery for the last hour and a bit but steadfastly refuses to boot up. We hold a small service and JP performs a rousing rendition of The Rose with the rest of the class backing him up in five-part harmony. The Bumblebee is down and I volunteer my laptop as a surrogate for the day. It is promptly pimped out with "only the minimum [I'll] need to work effectively". I'm left with 2Gb of hard drive space and much software that will expire in thirty days.
1:25PM - Now I get it! He's pre-recorded everything he's done and is playing back at four times the normal speed and only *pretending* to type. Don't worry JP, you're secret is safe with the Hillbilly.
5:30PM - "Oh yeah, I cancelled my flight tonight. Is everyone okay to stay a little longer?" I'm too scared to leave as every single thing he covers feels like my entire career depends on my knowing it.
9:00PM - I have to physically pry JP off my laptop. He breaks free of my grip but amid cries of "Stop him! Before he refactors again!" we manage to subdue him with a Bumblebee to the left temple.
I jest, of course (which I mention only because I've name-dropped JP so much that I'm afraid some humourless Googler will come hunting me down). The course was a delight as my dear grandpappy would say if he had all his teeth and could speak (and were still alive). Especially give my recent odyssey into self-improvement, career-wise at least. Having tried self-study for the last few months on many of the topics, it was great to have them explained in a structured, albeit rapid-fire manner and to have a context for the many patterns discussed as well as some nuggets about how some of them fare in the real-world. And there is absolutely no denying JP's passion for what he does which in and of itself elevates this above many similar courses.
The hard part now is going to be reining myself in. Not since the three-day recap of the Hillbilly's family tree has my brain been so abuzz with possible avenues of opportunity. It will be a case of holding a hammer and trying not to look at everything like it was a nail. We were hit with so much so fast, there is an overwhelming urge to apply as much as we can as soon as we can so the knowledge does come dripping out of our ears.
And in that respect, I'm planning to spend some quality time with the resulting code over the coming weeks, adding remaining functionality and refactoring existing stories. Perhaps integrating NHibernate or Windsor just to say I did.
But I'm not looking forward to all the cash I gotta start laying out when all this trial software expires....
Kyle the Supersaturated
Monday, June 18, 2007
Have moved over to my usual haunt for my annual trip to London. The conference I'm helping out with is being held here as it has been since before I started coming four years ago. I won't dwell on it except to say it's very nice and, while not as conveniently located as the one we vacated yesterday, the staff is exceptional and the bathrooms are outstanding, including a separate shower with five nozzles each with water pressure so awesomely powerful, it should be declared an environmental hazard. The conference is on fiscal systems for oil and gas from around the world which I mention only for completeness. On the first morning, I overheard a snippet of conversation 'twixt two of the attendees. One of them was an older gentleman who clearly had invested the bulk of his career in the oil and gas industry and they were discussing the upcoming course. The other asked him why he needed to attend given how much experience he had. The reply: It's a life-long process. Whereby you now see where I'm going with this post. The gentleman clearly said it with a great deal of enthusiasm, such that I hope I show half as much when I'm attending the "Why Won't VB Just Die Already?" conference in 2021. Here was a man in his late 50s or early 60s barely containing his excitement at attending a course on oil and gas economics. And having "attended" the course eight times in the last four years, I have to admit that he's in for a treat even with my limited understanding of oil and economics (but not necessarily gas). Here's a tip for fledgling developers: If the prospect of taking at least one training courses per year for the rest of your working life seems only slightly less palatable than an "All Rosie All the Time" TV channel, then learn to fake it or get out now. As JP says, you need to develop with passion (or in Justice's case, lust). And that kind of fervor requires that you get excited about learning the industry. And it's drop-dead easy to develop an obsession in software development these days. Yes, it can be overwhelming. But by the same token, you aren't starved for choice. If you can't find something that interests you, you are trying too hard to complain. Go be an actuary. I use a pretty loose definition of "training course". In these days of blogs and white papers and "How-to" articles, you don't necessarily have to shell out cold hard cash to sit in an over-air-conditioned room for a week. But it does mean you need to spend the time. Which generally means taking time out of your contract/job to do it unless you don't sleep. I'll leave it at that for now so as not to belabor the point and also because you don't need a humble hillbilly telling you how to run your career. You've heard this advice before from smarter people than me...er, I mean, I. But it doesn't hurt to hear it again, if only to give the impression that I engage in such a practice to prospective employers. Kyle the Learned
Friday, June 01, 2007
Lots of talk on the new Live Writer. I'm just glad I can finally use the Ctrl+RightArrow key combination again the way I'm used to. The real topic of the day is repositories. In my last post, I raved about ActiveRecord but in that little mini-project, I didn't actually use any repositories. I'll admit that I didn't actually do strict TDD on that project, nor did I even write tests for it. The reason being...actually, I don't need to explain myself to you people. I have my reasons, lame as they may be. But that was important because I now understand what Jimmy Nilsson was talking about in his chapter on PI for repositories. I'm back in PD mode implementing tests against my repositories and it now occurs to me: I'm going to need two repositories. A fake one for the tests and a real one that hits the database and wraps my use of ActiveRecord/NHibernate. (Yes, Nilsson talks about this very explicitly. Hillbillies ain't what you might call "book learners".) To explain the issue (and thus, to pad my post) here is a sample test: [ Test ]
public void ShouldBeAbleToRetrieveJobFromRepository( )
{
int jobNumber = 42;
MockRepository mockery = new MockRepository( );
using ( mockery.Record( ) )
{
IJob fakeJob = mockery.DynamicMock<IJob>( );
SetupResult.For( fakeJob.JobNumber ).Return( jobNumber );
jobRepository.AddJob( fakeJob );
}
IJob job = jobRepository.GetJob( jobNumber );
Assert.AreEqual( job.JobNumber, jobNumber );
}
So I implement a basic (read: fake) JobRepository that adds a Job object to List<IJob> and in GetJob, I iterate through the list and find it. In the real repository, it'll use ActiveRecord to pull it from the database.
But now I have a couple of questions. First, what's the best way to wire in the fake repository for the tests and the real one for production? Is this where something like the Windsor container comes into play (he said without totally knowing what it does)? You reference one repository in your test web.config and another in the production app.config?
Secondly, and more importantly, do I even need this test? Why am I testing to see if I can pull objects from a fake repository? I don't even think an interaction-based test would work here since the underlying implementation will be different for each repository.
In the book, Nilsson adds a layer of abstraction so that the repository itself will be the same in both scenarios. That pushes things out of the repository but you still need a fake implementation of something, in this case the abstract layer. In that case, it makes sense to test the repositories since they are always "real" implementations. But then I'm not so sure about testing the abstraction layer.
So...ummm...help, I guess.
Kyle the Faked-Out
Tuesday, May 29, 2007
OK, so why hasn't anyone told me of the rockage that is ActiveRecord? I was halfway through writing my first NHibernate XML file when Oren himself pointed me to StoryVerse, whose code is easy enough to follow that I was able to pick up a practical use of ActiveRecord without too much hassle. Gives some context to the attribute vs. XML file debate which was passing me by. And I have to say, the thought of bypassing XML file management is pretty appealing for a hillbilly with the first signs of carpal tunnel. Data schema dependency be damned, that's some bit of magic when you can dump a bunch of attributes on a class and not write a single line of data access code. Which brings me to the real reason for this here hootenanny. One of my classes is called FiscalSystem. Its implementation is not worth explaining except for one of its properties. To wit: StateProvince a class which in turn has a property called Country. I.E. A FiscalSystem belongs to a State/Province which belongs to a Country. (I didn't do the reverse relationship because the app is small enough that I don't need it.) So to get a FiscalSystem's country: myFiscalSystem.State.Country.Name. Next comes the query: Show me all FiscalSystem objects that apply to a particular country. Here's the query I tried: ICriterion[] criteria = new ICriterion[]
{
Expression.Eq( "State.Country.Id", countryID )
};
FiscalSystem[] systems = ActiveRecordBase<FiscalSystem>. FindAll( criteria );
Side note: In reality, all I actually wanted on my FiscalSystem class were StateName and CountryName properties because I didn't need the semantics of a full State or Country object anywhere else. But I was unable to determine a way of having ActiveRecord look up information from more than one table (i.e. State and Country) for my FiscalSystem class. So I had to create objects for each of them.
No dice. The error is long gone now but it went something like "Could not resolve property name 'State.Country.Id'". Works if I query at the State level, but not at the Country level. Which leaves me to believe it has something to do with reflection.
Incidentally, you get a similar error if you try to bind a GridView to a list of FiscalSystem objects and use a BoundField that references State.Country.Id (or anything at the Country level). You get around that be using a TemplateField instead with Eval( "State.Country.Id" ).
My alternate solution was to dig into HQL which is amazing in its own right: SimpleQuery<FiscalSystem> query = new SimpleQuery<FiscalSystem>( @"
FROM FiscalSystem fs
WHERE fs.ParentState.ParentCountry.Id = ?
", countryID );
FiscalSystem[] fiscalSystems = (FiscalSystem[])ExecuteQuery( query );
Man, there is a price to be paid living out of the loop down in the caribbean all these years.
Kyle the Impressionable
Monday, May 21, 2007
This is part moot of inconsequential posts on my professional development odyssey in which I try to develop an online music library application using whatever techniques and technology strike my fancy at the time. Code can be found at: svn://208.109.223.228/Suvius.Flamingo if memory serves. In our last episode, I popped up an initial test to see if we could retrieve all songs by an artist. I've since added a test, ShouldBeAbleToRetrieveSongsWithPartialTitle, that tests to see if we can retrieve songs by title (or partial title). It's not altogether interesting so I'll skip it here. The next test was ShouldBeAbleToRetrieveSongsByGenre which garners slightly more air time because if the notion of a Genre. Here is the test in its current incarnation: [ Test ]
public void ShouldBeAbleToRetrieveSongsByGenre( )
{
Genre genre = new Genre( "Really &*%$ old" );
int numberOfSongs = songRepository.GetSongsByGenre( genre ).Count;
using ( mockery.Record( ) )
{
ISong fakeSong = mockery.DynamicMock<ISong>( );
SetupResult.For( fakeSong.Genre ).Return( genre );
songRepository.AddSong( fakeSong );
}
Assert.AreEqual( numberOfSongs + 1, songRepository.GetSongsByGenre( new Genre( "Really &*%$ old" ) ).Count );
}
And here is the GetSongsByGenre method: public IList<ISong> GetSongsByGenre( Genre genre )
{
List<ISong> songsWithGenre = new List<ISong>( );
foreach ( ISong song in songList )
{
if ( song.Genre.Equals( genre ) )
{
songsWithGenre.Add( song );
}
}
return songsWithGenre;
}
(NOTE: No this isn't my final implementation. But it's enough to pass the tests for now.)
I've decided to make the Genre a Value Object which you might be able to determine from the comparison in GetSongsByGenre. The inital reason for this is that a Genre seems like it should be an object and I'd like to be able to compare two songs' genres.
But as I write this, I realize I probably should apply the same thinking to an artist. If a genre is to be its own object, why not use an Artist object rather than a string? For the purpose of our application, both are to be used identically (i.e. as search criteria and metadata on a song).
So I should create an Artist object, yesno? Now it's starting to sound more complicated than it probably needs it to be. Do I care about genres or artists other than as a property on the song? Is there any other data about them that is interesting to me?
At this point, I'd say the answer is no. Certainly for genres. But also for artists for the moment. Maybe we'll get to the point where we want to store the names, birthdates, country, aliases, and a little bio on each one but for now, I believe it's time to demote Genres back to a string.
Kyle the Devalued
Thursday, May 17, 2007
Here's the Subversion info for the online music app I keep referring to sporadically as Flamingo: svn://208.109.223.228/Suvius.Flamingo. A couple of notes on the project structure: - The initial solution was created by TreeSurgeon, whose cause was recently taken up by Bil Simser
- The build file was subsequently modified to account for the fact that TreeSurgeon's NAnt file doesn't work for .NET 2.0 solutions. It was borrowed heavily from various demos by JP. I've removed the deploy dependency from the "all" target because there is nothing to deploy yet. Have also add an <nunit2report> task because for the most part, Hillbillies don't like to read XML natively.
- I'm using Rhino Mocks 3.1 which is where the funky new mockery.Record( ) functionality comes in.
So download the code and follow along with my professional development and we can explore the various definitions of the word "mock". Keep in mind that this series of posts differs from other demos in that it isn't a demo. It's a record of my learning shiny new things. By no means am I suggesting what I'm doing is a de facto standard or even a smart way of doing things. Quite the contrary, I encourage you to call me out if something doesn't look right. The astute reader will probably guess that I have just finished reading Jimmy Nilsson's Applied Domain Driven Design and Patterns. Well, you'd be wrong. I'm still a couple of chapters from the end. With that, let's get started. The solution contains two projects: Domain.Test and Domain. Like all the hot shot TDDers I'm trying to emulate, I started with a test: [ Test ]
public void ShouldBeAbleToRetrieveSongsByAnArtist( )
{
string artist = "Frank Crummitt";
int numberOfCrummittSongs = songRepository.GetSongsByArtist( artist ).Count;
MockRepository mockery = new MockRepository( );
using ( mockery.Record( ) )
{
ISong fakeSong = mockery.DynamicMock<ISong>( );
SetupResult.For( fakeSong.Artist ).Return( artist );
songRepository.AddSong( fakeSong );
}
Assert.AreEqual( numberOfCrummittSongs + 1, songRepository.GetSongsByArtist( artist ).Count );
}
This led to the ISong interface and the SongRepository class, both of which are in the Domain project and neither of which I think belong there. ISong probably should go in a separate Domain.Interfaces project. SongRepository...well, I haven't decided yet.
Pay no notice if the Song class. It shouldn't be there yet because there is no code testing it (which you can verify by executing the "coverage" target in the build file). I've added it because I keep forgetting the API for the UltraID3 library and I left some sample code in the Song's constructor as a reminder.
Incidentally, in case it's not readily obvious, I'm starting with the requirement: Should be able to retrieve songs by an artist.
Some comments on the process to date. Firstly, it's not as easy as it looks coming up with initial tests. It's odd that I've written a test about song objects and still don't need a Song class. Even as I look at the test I've written, I'm wondering if there shouldn't be another to test SongRepository.AddSong.
Secondly, after reading what Nilsson had to go through to create fake objects in his book, I have an even greater appreciation of Rhino Mocks. Here's hoping Oren Eini doesn't get hit by a bus.
But overall, I'm happy with how things have started out. It took a bit to understand the build files I pilfered from JP enough to make my own changes to it but it's effort that translates directly to time saved on future projects.
Kyle the Initialized
Thursday, May 17, 2007
The Suvius.Flamingo project is not quite dead although it is, to go with the motif of the National Geograhic show playing behind me, about ninety percent down the python's gullet. But let's see what we can't glean from the carcass. I haven't linked to the application because I'm scared to even check to see if it still works. Last I checked, Windows Media Player 11 had made the application all but useless so I kind of abandoned it. Now, in a fit of PD, I'm going to see if we can't all learn something from resurrecting the app and re-doing it in a TDD way. So with that, I shall carefully document its development from start to finish. Or at least until something else shiny catches my eye. For those that want to play along, I have a Subversion repository and will post the details for it in the near future once I have created a read-only user. If you *really* want to gain my undying gratitude, roll up your sleeves and ping me to become a developer on the project. The primary goal is learning. If we end up with a working application at the end, all the better. First, the boring part: defining what the application is supposed to do. This will be a moving target but in a good way. Mostly because I'm reserving the right to change the requirements to make development (and blog topics) more interesting. At a high level, I'm looking at building a front-end to my online music library. It currently resides at http://radio.baley.org as a directory list of about 300 songs. The other 2500 have yet to be migrated to the new server. If I were to free associate some features, they would include: - Ability to search for music based on one or more criteria, including title, artist, and genre
- Ability to chain search filters together to form a playlist
- Ability to play the playlist in at least one popular media player in a user-friendly way
- Ability to save a playlist
- Ability for an administrator to upload additional songs to the database and glean the metadata from it (as opposed to keying it in manually)
- Ability to update metadata and have it persisted not only in the database but in the underlying file as well
- Ability for users to rate a song
Woman, I'd better stop there or I'll be here all night. Suffice it to say, there is a lot more I could throw in....ah, what the hell: - Ability for any user to tag a song with keywords
- Ability to search based on tags
- Ability to apply more than one genre, artist, album, etc to a song. This might be combined with the tagging feature. E.g. Wish You Were Here would be tagged with Pink Floyd, Roger Waters, David Gilmour, Rick Wright, Nick Mason, Wish You Were Here (album), A Collection of Great Dance Songs (album), classic rock, acoustic
- Ability for users to add comments about a song (possibly in a wiki-like fashion)
- Ability to share playlists
- Ability to link songs (i.e. link to other versions of a song). This would also be user-driven
Let the music begin.
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.
Copyright © 2008 Kyle Baley. All rights reserved.
|
|
|
LATEST POSTS
POPULAR POSTS
LINKS
BLOG ROLL
|
|
CATEGORIES
ARCHIVE
| December, 2007 (8) |
| November, 2007 (8) |
| October, 2007 (23) |
| September, 2007 (15) |
| August, 2007 (8) |
| July, 2007 (6) |
| June, 2007 (11) |
| May, 2007 (19) |
| April, 2007 (14) |
| March, 2007 (3) |
| February, 2007 (4) |
| January, 2007 (7) |
| December, 2006 (5) |
| November, 2006 (9) |
| October, 2006 (11) |
| September, 2006 (14) |
| August, 2006 (11) |
| July, 2006 (15) |
| June, 2006 (8) |
| May, 2006 (10) |
| April, 2006 (12) |
| March, 2006 (3) |
| February, 2006 (7) |
|
|
|