|
LATEST POSTS
Thursday, December 13, 2007
<to the tune of The Beverly Hillbillies> Come and listen to a story 'bout a blogger named Kyle Didn't have much to say but he said it with some style Day after day, he'd talk of TDD AJAX and patterns and working remotely Far, that is. Distant. Boondocks. Kyle blogged on and off for a little more'n a year Then the CodeBetter folks said, "blog on over here!" Said "we're big fans of your posts on hooch and 'shine" So he packed up his feed and left his home behind. Virtually, that is. Forsaken. But not forgotten. Alas, it is the end of an era. The Coding Hillbilly has a new home (which explains the irony of the new skin). I've been called up to the majors over at www.CodeBetter.com. This place has been a nice little starter trailer but you can go only so long without indoor plumbing. Not sure what I'll do without dasBlog as my default blog-filler now. The feed will (theoretically) stay the same for those of you who want to continue reading my ramblings without subscribing to the CodeBetter main feed. http://kyle.baley.org will continue to point here to minimize broken links but I've moved http://www.codinghillbilly.com to point to the new location (again, theoretically). See y'all on the other side Kyle the Promoted
Wednesday, December 12, 2007
Greetings brothers and sisters and solidarity to you. The revolution is off to a tremendous start. We have integrated continuously and Comrade Marc Davis has won a key early victory by excising the putrid web service that so fiendishly guarded our data access layer. As for myself, I have just returned from a bloody battle with the enemy and have come away battered but triumphant. It was a great blow to the despots of uncohesiveness! Our wily foes tried to gain the upper hand early by striking when our defenses were low. After opening a seemingly benign file, we were awash, AWASH I tell you!, in a veritable SEA OF ORANGE running along the right side. I stared dumbfounded at the awesomeness of the task before me. "How can this be?" asks I, "this is no mere autogenerated class? This class was typed by hand. Clearly by the devil himself!" No matter, with a cry of "ONWARD!!! TO BE RELEASED FROM UNDER THE OPPRESSIVE THUMBS OF THE HIGHLY-COUPLED SWINE-PIGS!!" I leap headlong into the fray. My battle begins and I become the Comment Warrior. It is a bold move because of the sheer numbers. <summary> tags that hold no relevance, <param> tags for non-existent parameters. No comment survives. Void methods have been tagged with <returns>Nothing</returns>, a move which stuns me at first but I quickly recover. After several skirmishes, I no longer notice the empty lines of History: in the <remarks> tags as I go about decapitating the methods in the name of maintainability. Soon, I see an opening! Find & Replace can take a regular expression! After a brief two-day refresher of the syntax, the first phase is mine in one fell swoop of replacing the following expression with an empty string: ///.*\n With that, the opposing army is almost 1000 less strong. But the enemy is quick and responds with waves upon waves upon waves of: catch { throw; } along with their slightly bigger pawns: catch ( Exception ex ) { throw ex; } These blocks are thrown at me from *every single method*. Some even have finally calls that set object references to null. Clearly, this army's overlords were trained in the style of Crouching Tiger/Visual Basic from the late 20th century. Luckily, they are easily picked up with the Blade of Alt-Enter from my ReSharper arsenal. But after untold hours, my fingers become weary. And my Mace of Shift-Ctrl-Alt-F fails me when it is unable to reformat the 6000+ soldiers remaining in this class. But I risk a glance to the right and allow myself a brief bout of euphoria as the orange gives way to the dull gray of victory. By this time, the battle is all but won. I drive a final blow by deleting all regions (regular expressions: \t*\#region.*\n and \t*\#endregion.*\n) and with a flourish of Ctrl+Alt+O, all references are properly qualified for the final victory! Resistance is NOT futile! Kyle the Understated
Tuesday, December 11, 2007
Have started a new project at the current contract and I'm muy excited about it. It's a "legacy" .NET 1.1 app that was upgraded to 2.0 by running the wizard, then left alone. It has a web service created by an architect who appears to have worked with Jeremy Miller before. It returns datasets. Lots of them. There's a DataDude project created in some CTP version that can't be upgraded. There is no CI process. I discovered most of this without cracking open the code. I have since done so and analogously speaking, it is clearly the result of the type of relationship we hillbillies are *very* familiar with. I'm pretty pumped to dive into it, actually. The CI process is mostly done. The tests are running regularly (2.5% code coverage, woohoo!). Now it's time to start the grand-scale refactoring. First, however, we need to go to the customer and tell him, "The architecture of this app is not unlike something akin to roadkill. It compiles only during the waxing phase of the moon and the fact that it runs at all has restored my faith in God. I know you've been using it relatively successfully for several months but we'll need several tens of thousands of dollars from you to refactor large portions of it. When we're done, there will be no discernible difference to the application from your perspective but we in the IT department will sure feel better about ourselves." Now I've never been able to say "discernible" out loud convincingly and I'm sure as heck not going to imply that I believe in a higher power so obviously, this isn't going to work for me. Which leads me to a tactic I've become quite fond of: Guerrilla Refactoring Guerrilla refactoring requires some unconventional tactics. Like in guerrilla warfare, I'll need to ambush the code often. Come at it from an angle it's not expecting. Do quick, focused skirmishes and get out again before anyone notices (except the code which will be grateful to be liberated from its bourgeois oppressors). Subterfuge and guile will be my allies. "How long will it take to implement the 'sync' function? Four hours, minimum. Change the layout of the form? A good day of coding. You need the text changed on this label? I'd say....three full days. Not including writing tests to expose the bug." I will bear the brunt of their skeptical, leering eyes for the sake of the common good. No longer will we toil under the totalitarian regime of logic-laden views and hand-rolled data access code. Their armies will *tremble* in fear in the face of my legion of Freedom Fighter Presenters! And the fascists will COWER as I slash at them with my Sword of NHibernate!! JOIN ME, brothers (and to a lesser extent, sisters), as we stamp out the Dictatorship of Duplication and drive a *hammer* through the very heart of hardcodedness!!1!!1!!!! VIVA LA REVOLUCION!!!! Kyle the Pacifist
Monday, December 10, 2007
It's just like skinning a raccoon, really. Ya outsource it. Seriously, I do have some technical posts on the way. There's a reason I'm holding out on them. In the meantime, you're stuck with the philly-sophical side of the Coding Hillbilly. So I recently went through a branding phase where I decided the hillbilly needed a more profeshunal look if he wuz to be taken seeryuslee. If you are viewing this post directly on my site (and I imagine exactly none of you are but that you'll be clicking the link to check it out shortly), you'll notice a brand spankin' (tee hee) new skin courtesy of the Design Goblin. It was a bit of an odd decision to make and one that will seem all the more ironic hopefully sometime this week. On the one hand, I wanted something a little easier on the eyes than the "Sepia Gone Wild" theme of the last one. On the other hand, considering most people come at this with an RSS reader, who cares how it looks? (Side note: I'm not going to erase what I typed but now that I've said it, I shouldn't discount the power of the search engine.) In implementing this theme, I did have to sell my soul a little and rely heavily on tables for layout. (Sorry, Justice.) But after looking at some of the things you have to do in CSS just to have two blocks of text on the same line, one aligned left and the other aligned right, I chose instead to go the tried-and-true route and make up some rationalization for it (which I'm still working on). And after taking that first step into the abyss, I pretty much abandoned all I know and love about CSS and even stopped using class names for the remainder of the theme. So, such as it is, this is the new look of the Coding Hillbilly. In doing so, I've rendered more than a few posts on ASP.NET AJAX that much more confusing with their references to rounded corners and watermarks on the site. If I were an industrious person of the earth, I'd go back and add caveats... Feel free to leave comments on the look if it's something you feel strongly about. Consider though that any negative feedback will result in some heavy editing of your name in the comment XML file. Kyle the Reborn
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
Wednesday, December 05, 2007
I swear I do code once in a while and my blog will reflect that again soon. But first, I want to follow up on my DevTeach presenter summary for the remaining presenters I saw during the conference. Oren Eini - Rapid web development with MonoRail Presentation Alias: The Mentor Underlying motif: Experienced and practiced Summary: Oren's presentation had a feel of "I've tried every possible combination and this technique is the best one". Although it was an introduction, he covered not only MonoRail but Windsor and ActiveRecord. Steven Rockarts - Generics: They're not just about collections Presentation Alias: The Energizer Underlying motif: Laconic and unflappable Summary: For a guy whose last name is barely an anagram away from Rock Star, I was expecting at least a mullet. You won't see the words "unrestrained energy" in his evals but he's got a good Steven Wright thing going that is interesting to watch. And the guy is not fazed by anything. Justice Gray - Microsoft MVC Architecture...what side are YOU on? Presentation Alias: The Sex Magnate Underlying motif: Wanton and uninhibited .NET lust Summary: I'll confess, I didn't make up the presentation alias. I took it directly from Justice's business card (you probably think I'm kidding). He mixes entertainment (depending on whether you're the topic at hand or not) with hard-core tech talk like no other and dove pretty deep into MVC in a way people won't soon forget, even if Donald really wants you to. All in all, I'd love to see all the presenters again next DevTeach. Preferably at the bar after the session. Kyle the Teetotalled
Wednesday, December 05, 2007
One of the highlights of DevTeach last week was meeting Ayende for the first time, albeit fleetingly. But it was enough for Bil Simser and me to form a theory that bears consideration. And it's one that will probably put me at great personal risk should it be true but such is the sacrifice I'm willing to make for the community: Ayende Rahien is an android I know what you're thinking. Shock at first. Maybe a little indignation. But now your considering your own experience with him and there's a little nod of recognition, isn't there. A bit of "hmmm...that would explain it", yesno? How many times have you read about some coding prowess he's done and thought, "man, that guy ain't human"? Let's consider the evidence: - Seemingly codes more than is possible in a 24-hour day even assuming he doesn't sleep
- He doesn't sleep
- The code ranges from good to stellar (depending on how much power remains in his batteries)
- His low, monotone voice
- The way he pauses while he talks under the guise of "well, English is not my first language".
- Constantly asks for explanation of English colloquialisms (particularly during conversations with Scott Belware)
- 3000 posts in three years
- Goes by a pseudonym because of some super-secret military reason. (The name originates from a series called The Wheel of Time so I'm working on a corollary that he's from the future, too.)
- Finally, if you watch him closely, you'll notice he never blinks
So what do we, as a development community, do about this information? Nothing. He was clearly created for the purpose of good. Or rather, if Hollywood is as accurate as I believe it to be, he was created for evil, gained sentience, and decided to use his power to better mankind to make up for his past transgressions. Perhaps, under the command of his brilliant-but-demented creator, he was responsible for all the brackets in Lisp or something equally nefarious. Now that I think about it, this would explain APL. The point is: he is here to help humankind and we should encourage him to continue about his business. But keep an eye on him in case his eyes start glowing red which, as Hollywood has again taught us, is the universal sign of an android gone bad. Kyle the Theorist
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
Wednesday, November 28, 2007
So I made it to Part 3. Who knew I had it in me? For the uninitiated, I'm braindumping on my meanderings through the Timok sample application. I'd advise you to check out part 1 and part 2, partially because Part 2 includes a disclaimer that says, now that I look at it closely, don't listen to me. So far, we've followed a request through a controller and how to apply filters to controllers. This time, we're finally going to look at some rendered code. When we left off, we had determined that unauthenticated requests to the main page, /home/index.rails, we're redirected to the Index action on the Login controller. LoginController derives from ControllerBase, rather than SecureController. So it will not run the request through the AuthenticationFilter. Instead, the Index action executes normally. That is, it will use the default layout and the index.vm view. So are we finally rendering something on the screen yet? Why, yes, we are. As mentioned in part 1, the default layout will be rendered with the index.vm view in Views/Login. The HTML you see in index.vm is what is rendered on the page. Sort of. We'll take a look at it now. OK, it kinda looks like HTML but I'm having some acid ASP flashbacks Yeah, and it's not as pleasant as you would have hoped, right? The HTML you are looking at is littered with escape sequences that mean something to the view parser. Like classic ASP, these are processed server-side and the view engine will render appropriate HTML based on the command and its arguments. Note that we are using NVelocity as the view engine. It is the default one provided by Monorail but is not the only one. Brail is pretty popular as is ASP.NET web forms, which has a syntax similar to what you are used to in ASP.NET. I have zero experience with either of them so in the immortal words of Handy: Read a book. In the meantime, just assume that anything with a funky character in front, like # or $, is for NVelocity to figure out. We'll look at a couple of these next. #capturefor(head) The text 'twixt this and the #end block will be rendered in the page's <head> tag. $siteroot Generates a base URL corresponding to the base application. For example, if your application resides at http://localhost/Timok.Rbr.Portal, this URL will be substituted in place of $siteroot when the page is rendered. It is like using ~ in ASP.NET web forms. "$UrlHelper.For("%{action='ForgotYourPassword'}")?username=" + $F('username'); This is a busy little bit of code. First is the UrlHelper which is an NVelocity construct that will create a URL for you based on the parameters passed in.In this case, it will build a URL corresponding to the ForgotYourPassword action. $F isn't actually server-side code. It is rendered as-is in the client. $F is defined in one of MonoRail's js files (AjaxScripts.js). It is a sort of shorthand that says, "append the value of the 'username' form field to this URL when this code is executed. And since we don't know what this will be when the HTML is generated, it has to be a client-side function. It is similar to: document.getElementById('username').value $Form elements These are for various form-related functions. $Form.FormTag generates the <form> tag in HTML while $Form.EndFormTag generates the </form> (along with some validation code). $Form.LabelFor and $Form.TextField generate <label> and <input type='text'> elements respectively. I'll leave it to you to figure out what $Form.PasswordField does. #if($error) This should be somewhat self-explanatory. The HTML in this block is rendered only if the "error" server variable is defined. Summary We finally got to look at some HTML even if it looked a little funny. I sorta skimmed over the funky NVelocity syntax for a few reasons: - It's NVelocity-specific. Brail, ASP.NET WebForms, and other view engines will have their own syntax
- The idea should be familiar to you if you've done classic ASP development, even if the syntax is different
- You can view the source of the resulting page just as easily as I can to see what each of these things does
From here, we'll follow through with the form submittal to see what happens when the user actually does log in. Kyle the Moot
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) |
|
|
|