Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Casey Charlton - Insane World

Hang the code, and hang the rules. They're more like guidelines anyway
  • Have a Very Merry Xmas

    Nothing more to say really ... whatever faith you do or do not hold, enjoy the holidays, time to relax and contemplate life!

     

     

  • Oxite - An Example of How Not To Write MVC Applications

    You may have missed the release of Oxite recently, and some of the hype and comments around it. Having now seen some absolutely ludicrous comments on the web chiming in about how good it is, I feel compelled to write my own short appraisal. Lets start with some of the hype by the Oxite team about their application, as published on CodePlex:

    Oxite is an open source, standards compliant, and highly extensible content management platform that can run anything from blogs to big web sites.

    We heart you so much, that we thought of everything. Oxite was developed carefully and painstakingly to be a great blog sample, or a starting point for your own web site project with CMS needs. Its line-up of sexy attributes includes: provider-based architecture allowing you to swap out database and search providers (SQL Server DB, local and Live search providers included), built for testability and hence most likely to be voted "hottest in class" by TDD fans (repositories, everything has an interface, etc.)

    That is the honest opinion of the Oxite team of the application they have written ... "hottest in class" by TDD fans

    Now come on!!!! Firstly, to be admired by TDD fans it would have to have been developed using TDD, which clearly it wasn't - it's test coverage is pitiful, seriously pitiful.

    But even forgetting picking on specifc ridiculous statements, it only takes 10 or 15 minutes of digging through the source to realise how poor this codebase is - really poor.

    Now this has sparked a large number of web responses - one of the first was Rob Conery. Rob is a good guy, a very talented developer, and with his MVC Storefront application he has provided a very good example app for ASP.NET MVC. He took on Storefront  as a learning excercise, and although he has had some problems, and has changed things a few times, overall the app is pretty damn good. Rob is pretty restrained in his comments, understandabl as that is the kind of guy he is, and this was an application from his own company, Microsoft. Although not officially endorsed by MS, anything they release will obviously be held up as an example to others of "the right way"

    This mild rebuttle was followed by Karl Seguin, who was far less restrained in his comments, with good cause. And that's where the furor began. For some peculiar reason, many people popped up out of the woodwork to say how good Oxite was, how it was really good of MS to release it, and about how they were going off to start writing other sites like it.

    Then another peculiar thing, Rob Conery decided to refactor the application to try and make it half decent - he also commented that people who said negative things about Oxite were making his job harder in getting the Oxite team to sort the mess out.

    Chad Myers commented, and tried to be restrained in his remarks - but never the less, his conclusion was less than complementary about Oxite.

    Scott Hanselman then decided to chime in, and fairly predictably so as a MS employee, urged restraint in critisism. Scott has always been the diplomat, and his post was definitely down the middle of the road.

    But Scott was missing the point, Oxite was not only shockingly poor, but was being promoted as a some wonder application, highly testable, "hottest in class" by TDD fans ... ultimately the puff on the CodePlex site was making this out to be "the right way" to do ASP.NET MVC. Oren decided his commentary would be on the PR blunder this had been, and specifically about Scott's comments, which he felt were less than appropriate.

    Fast forward to today, when I was directed to a blog post via Twitter - in which Nigel Parker had swallowed the blue pill and repeated the ludicrous puff stuff from the Oxite team. (this link now appears to have been removed from Nigel's blog). More suprisingly he then went on to say how good this was, and how it as just what the development community needed. This prompted more than a few raised eyebrows - though clearly the post was written before Nigel had downloaded the code or read it - I can only hope he has now done so, and has come to the same conclusion that most of the developers I respect have done - Oxite is poor beyond belief.

    I got narked enough to write this because I am stunned at ho many people thnk the Oxite application is "good", to be honest I am stunned by any developer who thinks it is of release quality, let alone to be released by Microsoft as an example application. Many many newcomers to ASP.NET MVC (an MVC in general) are going to pick this application up and copy it - consciously or subconsciously - and then we have the next generation of spaghetti mess that MVC is designed to eliminate.

    And then these newcomers will find their MVC projects as f***ed up as the Webforms projects, and blame MVC, blame TDD, and generally blame anything but their own actions. And in this they would have some element of being in the right - if Microsoft employees release an example application, that in any way bears the Microsoft name - they have a responsibility to get it right.

    And to round this off, Glenn Block posted the perfect response to Oxite - a piece of honesty and openess that elevates him even further in my estimation. The situation is summed up perfectly with:

    There is no excuse for this. There are tons of folks both internal to Microsoft or external that can help people who want to learn good practices for developing software. The fact that the MVC team was not even consulted by the Oxite guys is literally stunning. Not to mention all the other folks we have internally like patterns & practices, folks in our evangelism team, and TDD and Agile email discussion groups which have hundreds of folks. I really wish the "Look what we can do" mentality would become a thing of the past.

    Hallelujah, somebody gets it!

     

     

  • The MacBook Pro Review and Why Mine Went Back to Apple

    After some "umming" and "arrring" I decided I needed a new laptop - my 17" Rock is a beast, and rips stuff up, but it is heavy, and noisy. I asked some questions, read a lot of reviews, and decided finally that a MacBook Pro 15" should do the job - it had numerous glowing reviews, including from Windows biased developers like myself.

    So I ordered my MacBook Pro from Apple, top of the line spec - and was very impressed by their speed of delivery - it was with me 2 days later. Damn efficient!

    First Impressions

    Opening the box I found a typical Apple experience (I own an iPhone too) ... plenty of designer packaging, pure minimalism, sleek, shiny and all around impressive.

    The first surprise was the power adapter. It was very very light, and very compact. For a machine of this spec, it was ridiculously light. A really pleasant surprise, as the adapter is often what makes a laptop non-portable - lugging it around is no fun.

    In a few minutes all was unpacked, and all was up and running. OSX was simple to setup and Bootcamp was setup with Vista not many minutes later.

    The Screen

    When ordering the MacBook Pro I was aware that the screen resolution wasn't the greatest, 1440 is a little limiting, but I was prepared to go with it for the saving in weight. The screen was actually superb quality, though it was very reflective, even for a gloss screen - mostly noticeable when I was watching some movies. The worst thing about the screen though was something I hadn't expected - it was Apple's equivalent to ClearType for smoothing fonts - it was terrible. I have seen this commented on before, as the Windows version of Safari uses the same renderer - I had just expected the one in OSX to be better. Pehaps on massive screens it is good, but on the MacBook screen it looked ugly. When I switched to Vista in Bootcamp (using ClearType) the quality was perfect, beautifully readable. I struggled on for a week, but never really got to like their font smoothing, every time I went back to Vista the difference just hit me.

    Software

    The general user experience of OSX was much as I remembered from the last time I used Macs (and that was a LONG time ago) - although OSX has gone through many evolutions, it was still very familiar.

    I loved Expose (quick application switching) and the Dock (a much better variation of the Windows taskbar) in OSX - very user friendly. And Spaces on the Mac is simply brilliant - multiple desktops are SO much better implemented than on any Windows version I have ever seen.

    I needed to be able to run Windows apps quickly without resorting to a reboot to Bootcamp, so at first I downloaded VMWare Fusion. Fusion was pretty good as a virtual machine manager, but it's integration with OSX (called Unity) I found to be clunky. After a day or two I decided to try Parallels, a similar product, and found it was nearly the same running a VM, but it's OSX integration (Coherence) was infinitely better than Fusion.

    Parallels and Unity made it possible to run Windows apps inside OSX, but it still wasn't perfect. It was "fast enough" but not the speed I like in a development environment. Basic use of MS Office would have been fine - using VS was a little slow for my liking - for anything more than code tinkering I was going to have to reboot into Bootcamp and lose OSX.

    I downloaded 10 or 15 open source and demo applications, but nothing was any better than the Windows equivalent.

    The one killer app on the MacBook though was a surprise to me - Front Row. Front Row is like Windows Media Centre, a full screen media experience, play music, TV, movies, or whatever ... but the killer part of the application was that Apple shipped a remote control with the MacBook - one press on "start" and the screen faded to black and let me get straight to the media. A brilliant idea- and I seriously considered this when I was deciding if the MacBook was for me - and I'm not really a media freak.

    Keyboard Woes

    The other thing I hadn't counted on was the keyboard. I guess I was expecting it to be better than other laptop keyboards I had owned (it was Apple after all), but I never really gelled with it. Firstly the key spacing, all that space wasted - they could have made bigger keys, or laid them out better.

    Then a peculiar quirk, as a developer I am used to using CTRL, ALT and SHIFT a lot, in various combinations - but on the MacBook keyboard these keys just sit in the wrong place for me, I sort of have to twist my thumbs to use them effectively, which was gonna lead to pain eventually. The MacBook function key was where CTRL should have been, and the ALT key was where a Windows key would normally have been. Of course I am sure I could have soldiered on with these issues and got used to the layout, but I have to use PC keyboards on a regular basis, a lot of different ones, and getting used to the MacBook and then switching would certainly have slowed me down - I type pretty fast, and I don't need the hassle. No Delete key, and odd key combos for Home, End, Page up and Page Down added to my woes.

    And another quirk - the " and @ were reversed (with the @ above the 2 and the " above the '). This is the American keyboard layout, but on a UK machine. I don't know if I got sent a US machine, or they all come like that but it was confusing. I tried and failed miserably for days to figure out how to remap those the right way around - and while I am sure there is a way, it wasn't obvious!

    The trackpad was a pain to get used to at first, and drag/drop was always a pain, but the multiple finger gestures it allowed were great, and using 2 fingers to scroll a window, or 4 to bring up Expose was absolutely brilliant.

    The Pros and Cons

    So I was faced with a decision, do I keep the MacBook or send it back?

    On the plus side for the MacBook was:

    • Build quality was superb
    • Weight, amazingly light, and the PSU was phenomenal
    • Front Row was da bomb!
    • Power was pretty darn good (2.8 processor and 9600M graphics)
    • It cost around the same as a similarly specced PC laptop, which would be heavier

    But on the down side:

    • Mac OSX didn't offer me anything I couldn't do on Vista (Expose and Dock excluded)
    • OSX font smoothing
    • The keyboard was driving me nuts
    • The trackpad was a pain in OSX, but under Vista I never even figured out how to right click, and all the shortcuts I was used to in OSX only worked in OSX.

    Conclusion

    Eventually I decided to return the MacBook to Apple - it just wasn't for me. As a developer I want the fastest damn thing I can get my hands on - and that left me with the option of using the MacBook almost exclusively as a Windows machine. As a Windows laptop it is pretty impressive, but you lose all the nice parts of OSX (Expose, Dock, Front Row), and are left with a well built machine, with a cool logo, and a quirky trackpad and keyboard.

    Maybe I didn't spend long enough with the MacBook - others think it is the best laptop ever for Windows development - I only had 6 days with it,  but had to make a choice.

    I look forward to a future generation of MacBooks, because if they can sort out some of those minor annoying niggles, I'm sure I could get to like the MacBook.

    So What Now?

    For the moment I'm back to using my 17" monster. It's not exactly portable, but it is luggable. And I'm feeling more comfortable already.

    I decided to see if Windows could be made a little friendlier, and managed to find Switcher as an alternative to Expose - it is a brilliant clone, and if anything is a little better. The one thing I miss is the 4 finger drag on the trackpad to bring it up.

    And for a replacement for the Dock I found two Windows options that shined - RocketDock and ObjectDock. I went with RocketDock for the moment, and it has made Vista a little more usable - again if anything it is a little better than the OSX Dock.

    New Laptop

    I have a new laptop on the way, it's actually a gaming laptop, a fair bit heavier than the MacBook, a fair bit more powerful too. It has a higher resolution on a 15" screen which will be welcome, and it has a good old fashioned Clevo keyboard (which I know and love). The MacBook beats it on 9/10 features, but unfortunately the 1/10 is the bit that matters most to me.

    I may get a much much lighter laptop for mobile stuff (I use a laptop mostly so I can change room in the house, or go in the garden), which leaves me with the best of both worlds, just not at the same time.

  • BlogEngine.Net

    A while I had a problem with my old blog at goinsane, and as I was now posting regularly at devlicio.us I didn’t pay it too much attention. Recently I have had a few people contacting me about my old site not working, so I figured I best get it up and running properly.

    Looking around at blog software, I went through the usual suspects including DasBlog which I used to use. Great piece of software that DasBlog is, I kept finding references to BlogEngine.Net so I thought I would give it a try.

    The software itself was simplicity to get up and running, far easier than I remember it was with DasBlog, and a whole world of pain less that Community Server. Pretty much an FTP to my host, and I had a blog up and running.

    After playing around a while I found a few things were annoying me, so I looked to get those sorted out.

    Code Formatting

    This has always been a problem, due to the peculiar way markup works, and due to various addins, I can never seem to get code quite the way I would like. On devlicio.us I have been using the formatter from manoli.net but this often has quirks.

    BlogEngine.Net has a version of the manoli formatter built in as an extension (extensions are a really cool idea in BlogEngine), but it wasn’t quite working for me – sometimes my code formatted one way, sometimes another. It turns out that this has been mentioned a few times in various places, and it seems the built in extension is a little picky on how things are formatted.

    After a bit of searching I came across SyntaxHighlighter, but the theme I had chosen to use doesn’t like <pre> tags too much. A little more searching and I came across an alternative SyntaxHighlighter for BlogEngine.Net on CodePlex. This one was much simpler to install – just copy over the .cs files to your extensions folder, replacing the built in formatter. And it looks great:

    syntaxhighlighter

    TinyMCE to FCKEditor

    Now my next annoyance, TinyMCE is the chosen editor in BlogEngine.Net, and one of the things TinyMCE does badly is let you put in the tags to get the syntax highlighting working.

    Luckily, it is pretty easy to replace the editor in BlogEngine.net, and so I searched around and found some pretty good instructions. Fifteen minutes later and my editor was replaced.

    Conclusion

    All in all, BlogEngine.Net has been a delight to setup, and although my main blog will remain at devlicio.us, I will now try and ensure I cross post to my own domain just to keep Google happy.

    If you need to get a blog up and running on your own domain, you should certainly check BlogEngine.Net out

  • Amazon EC2 Now Running Windows

    Is this the future of web hosting? Certainly very very interesting

    We are excited to release the public beta of Amazon Elastic Compute Cloud (Amazon EC2) running Microsoft Windows Server and Microsoft SQL Server. AWS is also announcing that Amazon EC2 is now Generally Available and includes a Service Level Agreement (SLA). In addition, we're giving you a sneak peek at some upcoming features that will make Amazon EC2 even easier to operate. Please see details below on these announcements.

    Pricing for Amazon EC2 running Windows Server begins at $0.125 per compute hour. Please go to aws.amazon.com/windows for more information.

     

  • Frustration Friday - How NHibernate Can Waste Your Day

    Well, OK I exaggerate slightly, it wasn't NHibernate that wasted most of my day, but the fact that we are having to use a slightly out of date version of 2.0 to allow us to use NHSearch.

    NHibernate Search is a great piece of code, it abstracts Lucene.NET away from your application, and lets you pretty much pretend that you are dealing with NHibernate. However NHSearch has slipped a little in development behind the main NHibernate trunk.

    So earlier today, one of our devs got a problem with his seemingly correct query:

    var newsGroupTitles = new[] { "Steel News" };
    
      
    var tagTitles = new[] { "Asia" };
    var criteria = DetachedCriteria.For(typeof(Article), "article")
    .CreateCriteria("article.NewsGroupList", "newsGroups")
    .Add(Property.ForName("newsGroups.Title").In(newsGroupTitles))
    .CreateCriteria("article.TagList", "tags")
    .Add(Property.ForName("tags.Title").In(tagTitles))
    .AddOrder(new Order("article.Date", true));

    Well, actually that query worked just fine, until you added a simple .SetMaxResults() to it ... at which point it threw an exception and told us that the id had been duplicated in the query:

    System.Data.SqlClient.SqlException : The column 'articleid' was
    specified multiple times for 'query'.
    The column 'articleid' was specified multiple times for 'page'.

    Of course this didn't look right. So I dropped it onto the NH users group on Google, and awaited someone far more knowledgeable to point out what I had done wrong. Tuna Toks&#xF6;z promptly pointed out, somewhat less than helpfully, that this was probably fixed in the last two days. Of course Tuna thought he was being very helpful - unfortunately we were running a few versions behind the trunk due to NHSearch - so I couldn't get the latest version to see this bug disappear ... my only option was very loud cursing.

    So with some to and fro, and some suggestions from Ayende and Fabio, I stumbled along trying to get something to work - and as per the last time I tried, I failed miserably to get all the NH components to compile against each other, NHSearch was still the limiting factor.

    Eventually Tuna provided me with the HQL version of the query we were trying to do, which alleviated my initial problem, though in a less than perfect way. But, solve the problem it did, and so it will get into our code base on Monday, and probably be semi-replicated across other entities we need to query in similar ways. BIG thanks go to Tuna!

    IList result = sess.CreateQuery(
      
    "from Article a join a.TagList tag
    join a.NewsGroupList newsGroup
    where tag.Title in (:tagtitle)
    or newsGroup.Title in (:grouptitle)
    order by a.Date"
    )
    .SetParameterList("tagtitle", tagTitles)
    .SetParameterList("grouptitle", newsGroupTitles)
    .SetMaxResults(15).List();

    An even better result, it turns out that Ayende has NHSearch on his radar imminently (this weekend was mentioned), so I am really hopeful that I can get an up to date version of all my favourite components working in harmony again, I may even be able to put Rhino Commons back in and remove my awful home grown versions of Repository and UoW!

    This has to be the biggest reason to go with a mature open-source project like NHibernate, apart from it being pretty much the market leader in it's field, it has possibly the best support network you could hope for.

    For all those companies that worry that using an open-source component in their code will be risky due to lack of a "real company" backing it up, I can only say:

    "that big company could never be half as effective or responsive as the community support that exists around projects like NHibernate, Castle, Moq, Rhino, xUnit, and all the other great open-source work on which I depend to help me deliver high quality software"

  • jQuery Gotcha - Functions in Events

    I just spent way too long wondering why my silly page kept refreshing itself, one of the forms on the page was submitting itself over and over ... I had been refactoring some Javascipt to allow me to use it generically across pages.

    My orginal code to bind an ajax call to the submit of the form was as follows:

    $("#SearchForm").submit(function() { ... previous ajax code inline here ... ; return false; });

    And all was fine ... except I wanted to reuse the inline code, so I put it into a function:

    $("#SearchForm").submit(GetTableContent(controller, displaySelect));

    And suddenly the page started refreshing automatically, making debugging it rather hard to even find the mistake. After 20 mins scanning through the jQuery documentation on form submit I noticed that "submit()" reads "Trigger the submit event of each matched element" but that "submit(fn)" reads "Bind a function to the submit event of each matched element" ... clearly the first version was being used by jQuery, where as my code should have been the second one - after all I had a function in there now?

    Then I twigged it, the jQuery (fn) wants a plain basic function with no parameters ... so a quick change wrap my new function with a parameterless function resolved the problem:

    $("#SearchForm").submit(function() { GetTableContent(controller, displaySelect); return false; });

    Annoying ... I hate wasting 20 mins on silly things like this ...

     

  • Resetting a TeamCity Password

    I switched to a new machine yesterday, and had to reinstall my TeamCity notifier ... so off I went to our TC site to download it, and bam, I was asked for my login ... annoyingly TC maintains it's own password and user accoutns, and then matches these up to NT accounts - so my domain login and password wasn't working, and nor was any previous version of it I could think of.

    After much digging around ... I finally found out how to reset a TeamCity password. We have to drop to the command prompt, and use java.exe to fire off a password change.

    Firstly, turn off the TeamCity services, or the database will be locked

    Next, the basic command we need is: java -cp server.jar;hsqldb.jar ChangePassword <username> <newpassword>  <teamcitybuilddir>

    Navigate to "<TeamCity home>/webapps/ROOT/WEB-INF/lib"

    For this to work we need to point it to an instance of java.exe, and although we can omit the build directory if it is set to default, ours had changed. So our final command is: 

    C:\TeamCity\jre\bin\java -cp server.jar;hsqldb.jar ChangePassword ccharlto password   C:\TeamCityBuild\.BuildServer

    Voila a reset password ... 30 minutes of my life wasted, hopefully this will save you that 30 minutes if you have the same problem.

     

  • Finally a Good Use for Extension Methods - Unit Testing

    I somehow missed this post by Ben a few weeks back, but it is a great example of extension methods making something much clearer than it was before - by putting common Asserts into a few extension methods.

    Leveraging simple extension methods to make your tests more concise and readable can really help reduce the overall weight of your tests (especially if you want to change behavior later).  This stands as an excellent reminder to write high-quality test code, just as you would for production code.

    I'm generally a big sceptic of extension methods, so far every one I have used (or been forced to use by ASP.NET MVC) has been a little dubious and has proved a pain to track problems down to - but in a unit test suite, at least with the examples Ben gives, these can be a real boon to clarity and consistency.

     

  • Testing Is Not Technically Hard, It Is Hard Because It Requires Clear Thought and Understanding

    This whole "lets make TDD easier for the masses" thing is getting out of hand.

    Unit tests are not technically hard, as Udi points out, what is a test? Anything with TestFixture on it?

    It is not a technical challenge to write a unit test, any half trained monkey could do it. A few attributes, a couple of classes, a few new() statements, and a few Assert statements. We don't need magic mocking frameworks, we don't need any mocking frameworks for 90% of our tests, we don't need application of 12 GoF principles before we can write a test, honestly.

    Testing and writing automated tests is hard because it requires a strong understanding of the user stories that sit behind your code and project, because it requires you to think as a user and not as a developer, and because it requires you to be able to think of multiple conflicting axioms, test cases and class interactions, and how to cover the weaknesses of each individual test with other complementary tests.

    Bad tests have no value - none. The only "value" that matters is "business value", and a bad test will not reduce your development time, nor will it reduce your maintenance time ... in fact quite the reverse, bad automated tests will require significant maintenance themselves, will force your code to become rigid and resistant to refactoring to a better code base, and give people relying on your tests as a form of usage doumentation totally the wrong ideas, or worse still confuse the hell out of them.

    A project with no automated tests is verifiable by observation and UAT. A project with bad automated tests can still be verified by UAT but will now be complex to refactor or fix when problems or bugs appear. A project with a few key *good* tests around *key* functionality will provide a good balance of verification and sanity checking, and still allow the project to be maintained later.

    By all means start writing unit tests, but make them Spikes, and you will soon see how your Spikes project becomes fixed in time, with most of them not working after a few weeks of development - now imagine they were automated tests you were maintaining ... /shudder

    I can teach someone every part of SOLID they need to be able to write a technically competent unit test inside a day, teaching them how to write tests that have value takes months or years, there is no substitute for experience - but gaining that experience on your employer's time is only valid when the business says it has value to them, and when they understand it will result in a significantly longer delivery schedule - otherwise pay some good testers to do what testers do very well.

    Morning rant over, your normal service can now resume.

     

  • Where Did filterContext.ActionMethod Go?

    Awww cmon Microsoft, play nice with us. I want to do something that should be pretty simple, I just need to know what action is being wrapped by my custom filter in ASP.NET MVC

    After a surreal amount of Googling I finally found a blog post that showed where this little bit of information hides, in filterContext.ActionMethod. But I could have sworn I went over that 100x with Intellisense and never saw anything like that. Oh yes, indeed I did, Preview 5 removed this convenient method.

    So after a bit of swearing, and a small (140 chars or less) rant on Twitter ... Sidar came up with the answer buried in the ASP.NET forums.

    So what is the new location ... would you believe it is now an entry in the dictionary in RouteData??? No, nor would I have believed it. What kind of crazy world is this, when a strongly typed method is replaced by a magic string key to the RouteData dictionary :S

    So for now, this fixes it, but I hope MS can make this all nice and strongly typed again, it is a fairly minor thing, but I like my Intellisense, and I hate magic strings:

    public override void OnActionExecuting(
                     ActionExecutingContext filterContext)
    {
       var methodName = (string)filterContext.RouteData.Values["action"];
    

    p.s. Hmmm this Twitter thing may be the future ...

     

  • 8am and The Managed Extensibility Framework

    Brad Abrams can always be relied upon for a great post - and the latest whizzy thing to come from Microsoft is the Managed Extensibility Framework. I know this is a good thing, because Ayende and Sidar blogged and told me it was.

    In his simple step by step run through, Brad shows some of the benefits of MEF to those kind of applciations you have to plug together ... but for the life of me I cannot understand a word of it ... I'm pretty sure it isn't Brad, and I'm pretty sure it is me ... 8am really isn't a good time to approach this stuff. It isn't helped by MS calling it the "Managed Extensibility Framework", but Brad referring to it as the "Managed Extensions Framework"

    On a similarly related note, I decided to sign up to Twitter last night to see if anything interesting happens there (I left my mouse in work, and couldn't be bothered to use my laptop glide pad, so I was playing on my iPhone, and Twitter came up in a search, and ... well you know how this goes). Anyway ... the main reason this is related is that one of my first comments to Twitter was "6am sucks" ... well 8am hasn't got any better ... and I strongly suspect the day is going downhill from a bad start. Ever have a feeling it was going to be "one of those days" ?

     

  • Development is Hard

    Oren, as he often does, hits the nail bang on with his latest post Cuddling is consider harmful.

    Development is hard, and getting harder all the time. For every new framework that comes out to simplifying the complexity of the code we write, another two technologies hit the market. For every practice and principle we get to grips with, two other will evolve. The better we make software, the more users expect.

    Not only is development itself hard, but you have to be constantly learning and adapting to stay in the game - it is an endless race.

    As Oren says:

    Development requires a lot of skill, it requires quite a lot of knowledge and at least some measure of affinity. It takes time and effort to be a good developer. You won't be a good developer if you seek the "X in 24 Hours" or "Y in 21 days". Those things only barely scratch the surface, and that is not going to help at all for real problems.

    The rewards can be high, but the tradeoff is that you must work for your money, both in terms of producing real results, in keeping yourself educated, and in being aware of what is happening in the wider field, and that requires time and effort.

    And yes, a lot of the people who call themselves developers should put down their keyboards and go home.

    I cannot help but agree. If you aren't willing to put in the time and effort, then you probably should be in an easier profession.

    This isn't an elitist rant on my part, nor I am sure on Oren's - it is merely an observation that things don't come for free, and hard work and dedication can pay off. We all have to start somewhere, and for those people I would offer every encouragement and helping hand, but in return you must put the effort in, and strive to be better.

     

  • ASP.NET MVC, JQuery and Cross-View Javascript Events

    I wrote a nice little charting component for our site recently, and needed to call a Javascript function in one View (the one that was the main page for charting), from another View (one that went off to the server using Ajax to load up a list of feeds that could be charted).

    This would have been traditionally done by putting a function on one View and calling it from another, but this is just a little bit "messy" and prone to breaking. Luckily I decided fairly early on to use JQuery on this site (mostly as I hate writing Javascript and JQuery makes it a doddle). With JQuery I can define a Javascript event across the two views, thereby providing me with a loosely coupled way of achieving my objective.

    On my main index page I have:

    $('#graphFeeds').bind("add", function(e, feedId, description){
            for(i=0;i<graphedFeeds.length;i++){
                if(feedId==graphedFeeds[i].feedId) return null; }
            var theFeed = new feed(feedId, description, "Green", "Line", 0, 1);
            $('#graphFeeds #table tbody').append(createFeedTableRow(theFeed));
            graphedFeeds.push(theFeed);
       });

    And on the view that contains the list of feeds I have:

    function addFeed(feedId, description) {
       $('#graphFeeds').trigger('add', [feedId, description]);}

    Now by calling the addFeed() function on my list of feeds (I have a little "add to chart" link to the right of each feed), the Javascript event will be fired for the #graphFeeds div ... and the listening handler defined on the index view will go off on it's merry way and add the selected feed into the chart.

    Much as I hate Javascript, I love JQuery 

     

  • Don't Tell Me "How", Tell me "What"

    During a discussion with our project manager earlier today, I used the phrase "Don't tell me how you want it to work, tell me what you want it to do"

    We were discussing user stories, and I was trying to get across what I wanted to see on a story card, and what I didn't want to see. He had put a story card on the wall that read:

    On the login screen:
    Should be a username box
    Should be a password box
    Should be a change password link
    Should be a remember me link
    Should be a register link

    As user stories go, this pretty much sucks as badly as it could. He was trying to tell me how to write a login page, as he saw it, but he wasn't describing what functionality he wanted the accounts system to have.

    Don't Tell Me "How", Tell me "What"

    My user stories for a similar scenario would be more like:

    • As a registered user I want to be able to use my existing account details to sign in to the site to allow me to access restricted content
    • As a registered user I want the site to offer to remember me when I sign in so I don't have to enter my details every visit
    • As a registered user I want to be able to get a password reminder so that I can login even when I have forgotten my password
    • As a registered user I want to be able to change my password so that my account is more secure
    • As a new user I want to be able to register on the site and receive a username and password

    None of these say how the user achieves the objectives, but they do encapsulate what functionality is actually required. The first card would have had a developer acting as a parrot and likely producing something that missed the goals widely. The second version allows the developer to see how all these functions will interact, and to make a page that best reflects the requirements ... it also happens that the second set of cards neatly becomes a directly applicable UAT script.

    Now we can easily adapt the functionality to new requirements, for example these stories encourage a separation of the view from the actual functionality, so it is more likely we can put a login box on every page, or provide a register by email option instead of filling out a form.

    What Format Should Stories Be In?

    Traditionally I have tended to go for a simple format:

    As a [insert role or type of user here]
    I want to [insert required fucntionality here]
    So that [insert business benefit, or desired outcome here]

    There is a pretty good write up of this on Dan North's site, so to save me repeating it, check his page out, he also steps into BDD style stories too, and how they reflect various scenarios.

     

     

More Posts Next page »

Our Sponsors

Proudly Partnered With