Category: Programming

Things I Learned at Startup Weekend Calgary

Posted by – May 4, 2011

Last weekend I went to Startup Weekend Calgary. The event was hosted by @deveshd and @justinnowak at CoworkYYC. Our Startup Weekend coordinator was @thubten. I would like to give a massive shout out to all of these people as they did an incredible job making the weekend great.

As I had never been to a startup weekend before, I really had no idea what to expect. Despite never having been to a startup weekend I had two goals:

  • I wanted to meet some new people in my field or a related field
  • I wanted to try something a little bit new and different and fun

I’m sure there’s a ton of people who have written posts about what happens at startup weekend. Aaron and Chad sum it up much better than I will likely be able to anyway.

My Journey

The night started off with the pitches. There were a ton of good pitches and some very exciting ones. I had some ideas but there was exactly one reason why I didn’t pitch: All my ideas had some sort of resemblance to applications I have built at work – And I came here explicitly not to work on the sort of things I do at work. I came to work on something fun.

My night started off by getting on a team with @clangager. Despite my goal of working on something fun, the original idea we were working on centered around bridging two applications via a middle tier. Luckily for us, the problem had already been solved and in such a way that it wasn’t worth attempting over.

Finally, after a night of deliberating, Chad and I ended up deciding on building @sextrics (Sex+Metrics), initially created to be iPoo of sex. Yes, a ridiculous idea. And if you check our twitter stream, many, many laughs were had over the weekend.

Here is the interesting part. Despite being a totally crazy and outlandish idea (I mean – “Hey! We’ll track how often you have sex, what position, what room and we’ll give you some badges and everyone will laugh”) everyone was intrigued. Literally every single person who came through the space came by to see just what the hell we were doing. And laugh. And talk. We had a ton of fun building it and a ton of fun with each other.

Halfway through the day Saturday, we were also joined by @ianj_alberta, who had never used Ruby, Rails, GitHub or Heroku before. We had a lot of fun discussing Ruby, what it was and how it works. However, where his expertise really shone was due to the fact that not only was he a developer, he is also a photographer with Photoshop experience. He built all of the location icons and helped cut out all of the position icons.

In the end, we made our pitch and came in second to @MidoDeals. Congrats to that team.

My Lessons

It was a long weekend and my description above is a very distilled version of the weekend. However, I learned one very valuable lesson.

Any idea, no matter how small or ridiculous you might view it to be has the power to become great if you are just willing to throw it out there and see what people say.

I never thought we would get as far as we did with our idea. But we did.

I never thought an idea that started out as a sex trophy case could turn into a viable prospect. But it did.

I never thought the experience would have such a profound effect on me. But it did.

My Takeaways

  1. Take a step outside the norm. It doesn’t even have to be outside your comfort zone. Just something different.
  2. You would be surprised what you can accomplish in 54 hours.
  3. Never limit yourself. Negativity and nay-saying could prevent you from seeing true value of something.

Oh, and if you’re going to pitch something – make sure you have some sort of a business plan. We didn’t and I’m sure it cost us winning the weekend. Not that I care because I came away from Startup Weekend learning things that are far more valuable than a first place finish ever would have been.

Look who finally showed up! — An Ode to Microsoft

Posted by – July 4, 2010

 

I’m going to start by saying that the first part (and majority) of this post will be negative. Not the whole thing, but you’ve been warned.

With the introduction of the Razor view engine today and the subsequent very expected questioning and praise, I’m feeling the same way I do about so many releases that Microsoft has made since I’ve been a .Net developer:

At best, a little pissed off. But let’s get to that later.

Let’s start with Razor. High level, is it:

  • New? Check.
  • Different? A little bit.
  • Ground breaking? No.
  • Revolutionary? Not even close.

If you take a look at the example’s in Scott Gu’s introductory post and the examples for the Spark View Engine, you’ll see why people are commenting about the similarity.

The fact of the matter is, it’s been done. So really, why be upset when people question the use of it? It’s this attitude that starts me on my rant.

ASP.Net

Let’s start way back on January 5, 2002. Love it or hate it, Microsoft introduced ASP.Net Webforms. Whether you agree with it’s methodology or not, you can’t deny that it was:

  • New.
  • Different.
  • Ground breaking.
  • Revolutionary.
  •  

    In fact, it was so revolutionary, that it took until March 17, 2009 before they even released the ASP.Net MVC framework that acknowledged there was another point of view on web development. Now was ASP.Net MVC:

  • New? That’s a big fat no.
  • Different? Maybe to webforms developers.
  • Ground breaking? Far from it.
  • Revolutionary? Way too late for that.
  •  

    Yet there everyone the pure MS developers were finally being enlightened on what web development could be like. And we were supposed to be grateful. Grateful that literally years after other developers figured it out, MS did. Java got struts in 2000. Ruby got Rails in 2005. There’s numerous others, but to finally get to the subject of my annoyance:

     

    WHAT IN THE F@%& TOOK MICROSOFT SO LONG?

     

    Powershell

    Yet another leap forward…. at least for the Microsoft world. How does it stack up:

    • New? Nope.
    • Different? A little.
    • Ground Breaking? Maybe if you include the .Net Integration.
    • Revolutionary? Not at all.

    There’s literally hundreds of shells. Microsoft finally got up to creating a real one. Reaching at least as far back as 1971, shells have a long and storied history. Probably the most celebrated of the shells, the Bourne Again Shell (bash) was first released in 1987, and was blowing the Microsoft world out of the water in terms of usability, capability and power from even back in the days of DOS. So why is it that it took until 2006 for Microsoft to take the next step?

    The obvious omissions for me are: a real history search and a preserved history. Two of the most beneficial tools in a bash user’s aresenal. Credit where credit is due though: The .Net integration story in powershell is immensely intriguing.

    Are you seri-OSS?

    Bad pun, I know. But the problem is so bad that the developer community has had to take it upon themselves to solve these problems and innovate themselves. There is too many for me to go into each one so I’m going to short list it:

    And the four point system of New, Different, Ground Breaking and Revolutionary is going to look the same for all these. Even the aforementioned items had OSS precursors (MonoRail vs MVC and cygwin/bash vs Powershell).

    So why all the acclaim?

    Instead of looking from the outside in, let’s take a look at these from the average Microsoft Developer who never strays from the walled garden. Every single technology mentioned would answer something like:

    • New? And shiny too!
    • Different? Mind bendingly so.
    • Ground Breaking? I’ve never seen anything like it!
    • Revolutionary? Unbelievably so!

    I’ve been an avid *nix user and had at least one or more *nix based systems in my house for 10+ years. I’ve been working (very casually) on a Rails site since 2006. I was a Java developer before I was a .Net developer. To me it always feel like we finally are arriving at the party, years after everyone else.

    Better late than never

    Truth be told, there _is_ a bright side to all this. Microsoft is finally starting to provide their developers with tools that other platforms have had for decades. Is there a push to be more developer friendly again? I’m not sure. All I know is that finally, they are attempting to move in the right direction. This is very positive. They aren’t there yet.

    In fact, currently Microsoft is playing catch up. But it seems like once you awaken the sleeping Beast of Redmond that things start to get done.

    It’s not all a miss

    I’ve personally used some Microsoft Techs with great success in projects. The ones that come to mind immediately to mind are Prism and WPF. Though both could be improved (we rolled our own Event Aggregator in Prism) and WPF’s INotifyPropertyChanged is frustrating, both are a great step over what we previously had.

    In fact, I think that the Framework itself is, overally, extremely impressive. I love C# as a language. I enjoy it and enjoy using it. It’s in many ways, far ahead of most other static languages, combined with VS and R# it’s a dream to use too.

    But…

    What happens if tomorrow the python devs make some huge leap forward that no other platform has? I would put money on the Java/Ruby/etc communities to mimic it almost immediately. Probably even the .Net OSS community will get something out. But will Microsoft have to wait for “the next release cycle”?

    Grateful?

    I’m going to be honest, I’m not happy with being second rate. In fact, I’m downright insulted that second rate is shoved in our faces and we’re expected to act like it’s the greatest thing ever. Yes new framework X IS much better than what we’ve got, but it’s still years behind what the other guys have. It’s a classic grass is greener situation, except for that the grass is measurably greener. You want to know why so many leaders are leaving .Net? It’s because Microsoft is behind the times and seemingly refuses to outright acknowledge it until people whine, bitch and complain for YEARS.

    Here’s an idea

    Wow me. Let’s go back to 2002. Do something. ANYTHING. Don’t just play catch up. Take it to the next level. Be the innovator. Beat the OSS community to the punch. If nothing else, Microsoft is putting itself in the position to do so. But intentions don’t keep developers on your platform.

    I’ve been saying it for the last few years: .Net is in many ways stagnant, old and behind the times.

    But I couldn’t be happier if they just came out and PROVED ME WRONG.

    So prove me wrong. PLEASE.

    My feelings on testing

    Posted by – November 15, 2009

     

    At one of the recent WAN Parties, there was some discussion on testing. Some items came up that really got me thinking about why the last 2 years has sold me on testing. From memory, I’m going to go over my thoughts on some of the comments.

    It’s hard to write tests first. How did you learn?

    Well, I didn’t have a choice. I learned TDD by taking a job as a junior looking for some mentorship. My first two projects were:

    1. Get every old app we supported (~ 24) into a build script and onto our CI server
    2. Write a small make work app, but do it completely via TDD.

    Me and my coworkers had done some pairing and I had written some tests with people, but I always had someone to lean on so it was kind of easy.

    However, once I started out on my own, building a system from the ground up and having no idea where I wanted the design to go? That’s when things got difficult. I remember spending literally an entire afternoon writing a single test. One. I don’t even know if I finished. I just remember knowing Point A and Point B and having no idea which path to take between the two.

    Of course, as my boss would come and check in on me he would say "That’s good… but why can’t it look like this"? He’d sit down and write a few lines and suddenly I’d feel like a total moron.

    The point of the story is: It takes work. It takes writing tests and realizing their crap and continuing on writing more. Don’t expect your first foray into true TDD to be easy, and don’t expect to do it well. However, I can guarantee you that if you stick with it, it _will_ become second nature.

    Also, if you can get one, find yourself a mentor to help you. It will help immensely.

    How do I know what I should be testing?

    I’m inclined to say "Pretty much everything". I’m not a coverage nazi, though we do have some guidelines and goals around it in our shop. However, there’s just code that it doesn’t make sense to test. Like a value object made up entirely of autoprops. I’m pretty sure I know how that thing’s going to work.

    Don’t tests force your design?

    It seems like many people feel that because everyone has their brilliant idea of what the design of the system is going to be, that they will write tests that will suit their perceived design. For me this is true, but the true power of it is that it shows you ahead of time where your design has flaws.

    Yes, I usually have a path that I think I’m going to take when I start writing a test. However, often times before I’m done a set of tests for a feature, I end up changing my mind. The thing about writing the tests first is that it shows you where your design has flaws and where it’s going to cause you pain. If it’s painful for me to write a test then it’s probably going to be a pain in the ass to write and maintain. Pain in writing tests usually signals that you’re trying to do too much at once, often you’re trying to break SRP.

    In the end, you’re not only testing your code. You’re also testing your design.

    I hear all this propaganda over and over, but how do you know?

    For me, I have two projects that I currently work on. One with tests and one without. The one without tests was started before I learned about TDD (though I’m currently trying to begin adding tests, it’s very difficult to retrofit). As well, the one without TDD uses ruby. I heard someone say at the WAN Party the other night that Static Languages and their compilers are just a set of implicit tests. After using a dynamic language I can totally agree.

    Anyway, I always find myself trying to find excuses to do something else than my non-TDD project. Why? Because I’m scared to do anything with it. Since I have no tests, I have spent (literally) countless hours fixing bugs only to have them come back into play the next time I fix another bug. I have no way of telling whether what I’m fixing is breaking something else that depends on it. Personally, I think that had I just bitten the bullet a year ago and started putting the tests ever just around the bugs I was currently fixing that I would be well ahead of where I am today on that project.

    I’m starting to notice a trend here….

    I agree. The funny part I’ve always thought about testing is that as someone learning it, you don’t really see the benefits. In fact, in most cases, the benefits don’t ever fully show themselves until you’ve been working on a project for a long time, or even better, need to come back to it.

    Maybe you’re at the opposite end of the spectrum. You’re not skeptical of the claims, you’re curious. Maybe you’re curious like I was 2 years ago because making any changes to an old project is like pulling teeth. Or maybe your current project has hit a standstill because bugs keep creeping in and every change introduces two new ones.

    My Story (in a nutshell)

    I graduated from University in 2004. I had been working for an Oil and Gas company doing some development part time during the 3 years prior. After graduating I took my first job as a software developer in a small (2 developers, about 6 hardware/network/whatever guys, plus admin staff) company. I was taught to develop in ways I always somewhat questioned. After a while I started to read up on things. The only article that still stands out in my mind that I read was Martin Fowler’s article on Dependency Injection. I know I read some on the Open Closed Principle. And none of it made sense to me. I had too many stumbling blocks in my way:

    • I didn’t learn anything in my Computer Science Degree except algorithms and some cool hardware stuff
    • My current ‘mentor’ didn’t understand these things either
    • I knew I had problems, but I couldn’t even define them even though I was reading about the solutions to my problems

    Then I got lucky. I went looking for jobs because I knew there was a better way and I told everyone I interviewed with that. Then I was finally told at one interview that they knew exactly what I was feeling because they had just gone through that pain. They also told me that they had the answers I was looking for.

    I took that job and it was the best thing I ever did.

    It gave me the things I needed:

    • People who understood where I was coming from
    • A requirement to learn every day
    • Mentorship

    I truly believe that the easiest and best way to learn is to have someone with you guiding you in the right direction while also forcing you to go out on your own. I can understand people skepticism, I once had it. But then I got sick of fixing the same thing over and over. I realize that this is getting long so I’ll just end with another personal note: If I hadn’t taken that job and learned what I have over the last two years, I would no longer be in software.

    The short story is, Testing saved my career.

    You really shouldn’t test that

    Posted by – May 22, 2009

     

    You know, sometimes, you really shouldn’t test your code.

    What?

    Yes. You heard me. You shouldn’t test your code.

    Well, let me explain that better. I recently took a course where I was paired with someone where neither one of us knew what it was that we _really_ wanted to do. We started to flush out an API for wiring up a hand rolled IOC automatically, and every time we did so, we hit a brick wall. The reason is that we kept trying to ‘test first’.

    Don’t get me wrong, I am a complete advocate of test first development. HOWEVER, if you don’t know what the hell you’re doing, you can’t really test first. Being able to test first implies that you can think ahead of yourself and write something that does exactly what you know you need.

    In our case, we kept wasting time trying to write tests that just didn’t work with how we NEEDED to do things. How did we solve this dilemma? We sat down and spiked out some code. Just hammered it out and got something working. Now, let me tell you, we wrote some pretty damn horrible and untestable (except via black box testing) code. However, what we did gain was an insight into the process and steps we needed to take to accomplish our task.

    However! We didn’t keep that working code we spiked out. Once we had a spiked set of code and a solid idea of what it was we needed, we were able to test and rewrite the code we’d spiked in a much better, tested and well designed manner that would have taken forever if we’d just kept banging our heads against the wall.

    To reiterate:

    1) TDD with no idea what we were trying to accomplish = 3 hours wasted.

    2) Spiking out some code, getting our heads around the steps needed, wiping it clean and restarting the TDD approach with an idea of what we needed to do = less than 1 hour to completion.

    Remember, testing first doesn’t mean you should beat your head against a wall just to write a test before writing some code. Sometimes, in order to write a test, you need to write some code first. I guess some people will write tests afterwards, I personally prefer to rewrite, as I find I spend just as much time fixing the code when retrofitting tests as I do just rewriting it out.

    In the end, you just need to remember that even if you’re doing TDD, you shouldn’t be afraid to spike out code. It’s the best way to learn and give yourself some direction.

    Why don’t you put it somewhere else?

    Posted by – October 29, 2008

    I can’t begin to tell you how many times I hear this from my boss. Really, I should know by now, but I still manage to just keep my head down and code sometimes. Sometimes I get so involved with the code and getting everything working that I don’t keep my eyes open on the big picture.

    Currently, we’re working on a system that manages the database itself, so no nHibernate. It uses and Oracle database, so in some data import cases, we were running the exact same queries over and over. Part of the solution was to use data parameters.

    Overall, it was quite nice using the parameters. However, I started to notice a really bad trend. In a nutshell it looked something like this:

       1: public IList<IFoo> GetFoosByBarAndBaz(string bar, string baz) {
       2:     IList<IParameter> parameters = parameterFactory.CreateListWithParameterFrom(1, bar, DbType.String);
       3:     parameters.Add(parameterFactory.CreateFrom(2, baz, DbType.String);
       4:
       5:     return MapFoosFrom(gateway.ExecuteSqlForDataTableWithParameters(queries.GetFooByBarAndBaz(), parameters));
       6: }

    parameterFactory.CreateListWithParameterFrom(1, bar, DbType.String) as it looks like creates an IList<IParameter> and populates it with a parameter with a name of 1, value of bar and type of String. However, the the Sql string itself sits in an entirely different class. Think about it, how is the next person supposed to know that the parameter :1 is supposed to be bar (yes, we could get into naming here, but there are reasons for using :1, :2 instead of :bar, :baz so bear with me).

    The disconnect is huge, and will be nasty for me (or anyone else for that matter) down the line. Plus: I now have the extra work of stubbing out those calls to the parameterFactory in each one of my tests for each of these 50 or so queries.

    So I started to think. Yes, I do that sometimes.

    We already had an IParameterizedSqlStatement which was used elsewhere.

       1: public interface IParameterizedSqlStatement() {
       2:     string SqlStatement { get; }
       3:     IList<IParameter> Parameters { get; }
       4: }

    And on the Gateway:

       1: public interface IGateway {
       2:     DataTable ExecuteSqlForDataTableWithParameters(string sqlStatment, IList<IParameter> parameters);
       3:     DataTable ExecuteSqlForDataTable(IParameterizedSqlStatement parameterizedSqlStatement);
       4: }

    And yes, the ExecuteSqlForDataTable(IParameterizedSqlStatement) just delegates to ExecuteSqlForDataTableWIthParameters.

    In the end, I took the queries object, and instead of returning just a string of Sql, I build the entire IParameterizedSqlStatement and return it. Now my original function looks like:

       1: public IList<IFoo> GetFoosByBarAndBaz(string bar, string baz) {
       2:     return MapFoosFrom(gateway.ExecuteSqlForDataTable(queries.GetFooByBarAndBaz(bar, baz));
       3: }

    I now have 50 functions with 1-3 lines less of code in them, with 1-3 less stubbed calls to make in their tests, plus I was also able to convert the entire application to use IParameterizedSqlStatements, so now the gateway looks like:

       1: public interface IGateway {
       2:     DataTable ExecuteSqlForDataTable(IParameterizedSqlStatement);
       3: }

    The other function is still inside my concrete implementation, and the remaining one still delegates to it, but overall my outlying interface is much cleaner, my repository is much cleaner and all the work for creating the query is now inside of the queries object where it belongs. Plus, now my sql string and my generation of the parameters are side by side, so no more tabbing between classes just to make sure that my parameter names are matching in the string and the parameter list.

    And the best part is that it didn’t take my boss looking over it and saying “You know, if you just moved this piece over here….”