Fizzbuzz in Scheme/Racket

No idea why I did this…

(define (fizzbuzz listIn [currentList empty])
  (define (showWhich itemToTell)
    (let ([testString
           (string-append
            (if (= (modulo itemToTell 3) 0) "Fizz" "")
            (if (= (modulo itemToTell 5) 0) "Buzz" ""))])
      (if (= (string-length testString) 0)
          itemToTell
          testString)))
  (define (add-head-to-list itemList listTAddTo)
    (append listTAddTo (list (showWhich (first itemList) ))))  
  (cond
    [(null? listIn) currentList]
    [(null? (rest listIn)) (add-head-to-list listIn currentList)]
    [else (fizzbuzz (rest listIn) (add-head-to-list listIn currentList))]))

Into the unknown… sort of.

So after about eh 3? months of not writing anything (Mostly due to the joy slash nightmare of a newborn) I’ve had a real “come to [Religious Figure]” moment… And that moment has taught me that java based off shoot languages are a pain in the ass to even get started with. This is the typical how to guide:

So yeah, I’m back to the Net but with a twist. Not much an M. Night ‘They call me Mr. Glass’ kind of twist, more of the ‘Oh for &$#@’s sake’ The Happening kind of twist. Yes, I am venturing into F#… and maybe never back again… except for work. But never to be back again outside of work. Ah who am I kidding? Who cares. (That includes me)

What Defines a Bad Developer?

This is more of a question post than one with answers ’cause I’m all mysterious like that.

Today I was debating (and by debating I mean fat fingering my way through instance messages) with a co worker about whether a certain somewhat well known developer was good. Though I won’t divulge such a person, let’s just say he’s built a a game that might or might not have to do with mining and/or crafting.

I can’t remember how we got on the subject, but his contention was that such a developer was horrible. This made me pull out the big guns loaded with pure dickish and fired off this salvo:

Well when you write a program that surpasses 100000+ users, I suppose that can be your rock to throw

Nothing inflammatory about that, right?

So from there it became an amazingly deep debate that could match the irrelevance of the most heated of Star Wars versus Star Trek debates.

Ok maybe it did have some usefulness to it. After all, it is a good question to ask… which is why I am asking it.

My point was that it’s not easy to make a game, even one that couldn’t give Quake a run for its money in the graphics area. (And yes I mean Quake 1… You know, that game that had polygons that would suggest you were holding a weapon but you were never quite sure.) And to make something like that in his spare time proves that’s he’s at least competent.

His main point was that as a part of professional pride, the game shouldn’t be as buggy as it is. The inability to create a product that didn’t have a solid foundation is just bad. Flat out bad. After all if I build a car, that’s cool. However, if I’m trying to run over some jack–s with three collars popped and due to lack of control takes out an Apple Store…. ok bad example. Takes out Mel Gibs… –CK! Takes out a puppy store, that doesn’t really mean I’m a mechanical genius regardless of other factors involved building it.

And I think in there is the question. Should things like time constraints, degree of difficulty, and having no help (That I know of until end of last year) be taken into account when you look at a body of work, or should it be the end product and end product only that defines the competence of the coder?

I think it can go either way depending on what you consider ability. Is ability defined as doing something difficult AND doing it well or just being able to churn out something a good majority of developers couldn’t do alone.

Now make no mistake, I’m not saying he’s the best developer ever. I’m sure there are people far beyond his ability. I just don’t buy that he’s incompetent due to the more intangible things that effect development.

Off Topic: Finally Hit 500 on Deadlift

Yeah I know, kind of lame to announce this on a programming blog, but this is a huge thing for me. I’ve come close to 500 quite a few times but there was always something that set me back. It isn’t the best lift ever, but still happy with it overall as I didn’t cheat the pull in any way. And as making claims without proof on the internet is pretty common, I figured I’d post the video.

Looking to set a new personal record on the bench at 330 this week. 325 is something that I’ve done on a few occasions, but like I said, something always came up.

WARNING: Sound is probably bad unless you want to hear a nerd war cry at the end… That and apparently I swore at the end too.

I Have Found Python and I Am a Changed Man

Ok so maybe the title is full of sensationalism, but in some ways it’s true.

In the beginning there was Microsoft.

When I started programming at the unusually late age of 24, I was brought into the world by Microsoft. At the time, ASP was still in fair use and .Net was the new wonder drug and no one, not even Microsoft, could nail down what it was exactly. It was a miracle in a bottle, an olde time elixir. It would fix everything known and even unknown unknowns. Now personally, I had only really taken a liking to the style of C++. I preferred brackets to subs and never minded semi-colons. So you can imagine when I found out about “the C#” , I was all about it. Looking back now, it does seem sort of silly since there really wasn’t that much of a difference between VB.Net and C#, but d—-it I was going to get my semi-colons or here go hell come. Naturally this meant I would start a journey of 8+ or so years into the Microsoft frontier.

Have Carrot and Stick, Will Travel

I think one of the strongest suits of the .Net framework was Microsoft’s need to constantly improve it. Now these improvements weren’t overnight but it seems like they made a lot of improvements in relatively short time. Every version just seemed to have the answer to every question I didn’t know I needed to ask. It was like they were reading the mind of future me and adding features based on that mind. Yeah ok, it’s a little ego centric to suppose that future me was the only person asking for such things, but I’m cool with my version. I can still remember how annoyed I was that the place I was working for wasn’t going to invest in 2.0 for a while, thus keeping me from my coveted generics. (Pretty sure I said the word to the point it didn’t sound a like word anymore) And honestly, a little nerd rage was expected since I didn’t want to type every parameter as Object. I can also remember how in awe I was of Linq and some of the semi-functional programming concepts being introduced with 3.0/3.5. It seemed like as soon as I started to covet something new, BAM it was there. So really, I had no reason to ever stray from .Net because I was always well taken care of. Course then something changed and it was Microsoft’s fault.

There some things you can’t unsee

Remember that thing named Linq? Well Linq was more in line with the whole .Net mystique. It wasn’t just a way to manipulate lists, it was a whole lot more. With Linq came a few nice concepts like typed delegate, anonymous types, type inference on a much larger scale, extension methods, and a whole slew of other larger concepts like Entity Framework. It was kind of like taking a trip to the moon. Sure the whole moon thing is great, but the massive amount of new technologies that came from just getting there was where the real gold was. In the development of Linq, Microsoft had to come up with new stuff to even run the concept of Linq. At some level it was touted as Microsoft’s attempt to bring a more dynamic and functional look to C#. Now no one was claiming that C# was a functional language but d—ed if it didn’t try. After all, it’s not easy to make something more dynamic when the underlying technology is meant to be more static. Between being able to easily pass methods around like objects and using lambda expressions to simplify dealing with lists, it was a huge step forward and personally a large shift in my programming paradigm. (Yes I just used paradigm in my blog.) So where’s the catch? It’s simple, my eyes were opened to stunning new concepts. The use of Linq, lambda expressions, and Func/Action got me to start looking at programming as a whole in a different way. I wanted to be more dynamic. I wanted to start solving old issues using all this exciting stuff. And because of this I started expecting more and pushing .Net to the limits. For the first time in my programming career, the carrot was chasing me.

Model View what?

If Linq was the straw that broke the camel’s back, then MVC was the bus that ran it over by mistake. For years I had been in the standard world of Web Forms. Something that at one time seemed to be a beautiful bridge between the web and stand alone projects was now looking worse and worse. All the issues I had with Web Forms were now being magnified by the overall streamlined approach with MVC. It was such a strong double-hit between Linq and MVC that I just couldn’t ignore the outside world anymore. It’s sort of like that moment when you realize that your parents are human just like you. It makes you think that maybe everything you knew wasn’t actually the only way to do things. That maybe there’s something more out there. Maybe, just maybe, people didn’t eat cold pizza with syrup. This was the moment when I started wondering if there was something greater out there. (Just like Vger) Because I had never dabbled in anything outside of .Net (except a regrettable affair with PHP that still worries me that someday a little PHP will show up at my door claiming that I’m it’s dad) so this concept was brand new to me. Of course anyone who wasn’t completely clueless like me would have known that MVC had been used by things like Java for quite a few years. To makes matters ever worse, the poor camel was struck by a huge meteor named Javascript. Yes, I typed Javascript. With MVC came my heavy use of Javascript and it’s much fancier suit and tie JQuery, and guess what? I noticed that most of the cool new dynamic stuff for .Net was being used in Javascript all the while. I had shied away from Javascript for a long time since I was brainwashed into thinking it was evil. Just use post backs and server side code. Stay away from the language that we dare not speak its name. Problem was, it is almost a need when using MVC unless you want to refresh the page on any form post. Long story short, I was reeling from all this new information.

Every silver lining has a dark cloud

One thing that I didn’t like about most examples of how the model and view work together was the use of a dictionary to hold values that would appear on the view. I’ve never liked magic string programming so I naturally went with typed views. This meant that for every view I would have a model class working alongside to help pass values in a much more clean and safe way. The issue? A whole f–king lot of models. So much that it almost became a separate project in itself to hold all of them. Something just didn’t seem right about this. One of the nice things about C# is it’s more rigid feel to keep people from screwing things up (unlike the magic string theory). Problem was, for rapid development this just didn’t cut it. And let’s be honest, in the real world (unless you are the lucky few that have decent deadlines, i.e., top-end jobs) rapid is all we get. This left me in an uncomfortable place. We’re talking showing-up-to-school-naked-and-realizing-it’s-not-a-dream-this-time uncomfortable.

In time all things become clear

It would seem natural that if I liked all the more dynamic features of .Net and Javascript, I would possibly try to find a language that suited my needs. Well there’s an old thought in psychology: People don’t change unless something makes them. And as much as I’d like to say I braved the new world on my own, it really was more of a wake up call. While Microsoft has done a lot to add needed complexity to the framework, they continue to add far too much simplicity.

Not to long ago, some time after 4.0 was just about to go “gold” I read a couple articles on how easy programming was becoming in the .Net world, and how salaries for .Net were starting to drop. To sum it up, Microsoft has always tried to walk two lines: Cater to the more expert programmer AND the drag-and-drop programmer. Some nice examples would be from 2.0 in generics and update panels. Generics are still not understood by drag-and-drop programmers (as I have been shown on many occasions) but man they love their update panels. I mean it’s ajax without actually knowing anything about it. And I think this is where .Net is going to head. I think as elitist programmers we’d like to think that knowing design patterns and how to successfully design a streamlined system is important but honestly, it isn’t. And I’m saying this as a person who has had 7+ jobs jobs in the last 9+ years. Businesses want results. They don’t care if it costs them more in the end if you hack something together. I’ve never really met a company that thought that far ahead, and in some ways I can understand this. Getting to the market first can be a huge advantage. The “Just get something out now and worry about it later” mantra is prevalent in all walks of business. It’s hard to convince companies to take more time to develop a more solid system. Because of this, things like update panels and drag-and-drop design are still hanging strong which by proxy means having a solid understanding of how things work really doesn’t matter as much.

Though way too lengthy of a side bar, the point is that this is the event I needed to change. Because Python is a more fringe language but is used by some really good companies, it seemed like a reasonable switch… or at least something to experiment with. There is nothing really drag-and-drop about it.

If at first you don’t succeed…

I will admit that at first I was a little apprehensive about Python. It just didn’t seem to offer anything that C# didn’t… again at first. However, the more I used Python and Pylons, the more free I felt. All those years of pushing and expecting rigidity were washing away. Don’t me wrong, it took a while to really get how powerful Python can be. I mean stuff like adding properties to objects dynamically was nice, but that was also in 4.0. Passing methods like objects: C#… well at least with some restrictions. But with that being said, having options like that without the need for typing parameters and done so with a natural feel made it pretty well suited for web development. I’m not going to spout the virtues of Python and I’m pretty sure I’ve derailed this post quite a bit, but the moral of the story is simple:

There’s more out there than Microsoft/.Net. Now I realize that probably 2/5 readers (not a fraction but an actual guess on how many people will read this) will be thinking ‘DUH’ but this isn’t really written for people who know this already. This is written so that even Microsoft slappies like me can break free of a what I thought was the be-all and end-all, and really learn something new that isn’t new to .Net. I’ve built my career around .Net and have no doubt it will most likely be what I’m paid to use for a while. With that being said, there’s absolutely nothing wrong with trying new paths. Is Python the language to do this for you? I have no idea. Maybe it’s Ruby or (maybe(the(language(is(Lisp))))). That I can’t tell you. Only thing I can tell you is that you won’t know until you get out and try something new. You can’t possibly know what’s out there if you stay at the house that Microsoft built. In a world with too few eggs and a ton of baskets, you really can’t afford keep things the same.

Are you a good programmer?

Something I’ve struggled with for a long time is how to define a good programmer. It’s not an easy task since it’s fairly subjective and there are a lot of different opinions on this. So many that you could say that this is just another drop in the bucket of irrelevancy known as byatool.com. But a post being pointless hasn’t stopped me before, so damned if it will stop me now.

The first question that a person might ask after reading the title of this page is: Do you really think the iPad will revolutionize the way schools handle reading material? And that is a fine question, but a bit off topic. So if I were to tell you what first question to ask, I would tell you to ask: Who the hell are I..you to ask you…me if I’m eh you’re? Oh f–k it, you get the picture. And the answer is: No one really. ANTI CLIMATIC!!!11oneonesevenone I’m not the world’s best programmer and won’t be winning the prestigious Byatool Programmer of the Year award. (And sadly I’m the only one in the running.)

But what I do have is a thirst… No, not that kind. I have thirst for knowledge.

Yeah yeah, I know “cliche”. However, the point is still there AND that’s only part of it. You see the thirst for knowledge is only a step, and it’s the easy one. Anyone can WANT to learn more, it’s taking the time to DO more. It’s not enough just to show up.

And I think it’s the doing that separates the real from the others. The doing is what separates. Separation is bound to doing. Doing separation. F–k where was I?

Look, despite what people tell you, life is not a box of chocolates otherwise we’d all be morbidly obese… and happy. Life is more like… one of those damned invisible fences with a shocking dog collar. Yeah you’re going to get zapped more often than not but at some point you’ll find that one area in the fence next to some kind of electricity tower that screws with the fence and allows you to break on through. Course most likely you’ve already lost most of your brain living so close to an electricity tower, so in reality you’re just breaking through to a life of madness and too dumb to know it.

But this was a really stupid analogy anyhow that doesn’t really make any f–king sense, so who cares?

The point, if there ever was one (which even I’m debating at this moment), is it is never easy. NEVER. It’s always a struggle. It’s always a pain in the a–, but it’s necessary. Why? Because it defines what a good programmer is. The struggle. Or more to the point, the perseverance. It’s so easy to just be happy with what there is now. You know, the old “If it ain’t broke, then let’s run the wheels off it” mentality that I think comes from an earlier generation. (Most likely the generation of any given current professional programmer)

Fact is, it’s OK to try something new. It’s OK to venture out into the unknown. And more importantly, YES YOU WILL BE SCURRED AND GET FRUSTRATED AT SOME POINT! This is completely natural. You aren’t stupid. It isn’t just you that feels that way. You aren’t a mutant because you are afraid you’ll fail. Sure I don’t doubt there are people out there that just naturally jump into the unknown, feel no fear, and figure it out in a day. That’s why they are billionaires and rare. For the rest of us relatively poor goofs, we have to deal with all of that AND perform.

Just remember, you have been conditioned by multitudes of areas to be afraid of change. Hell, even your brain fights change because it’s far more efficient to keep things as they are. It’s even a basic principle of existence: path of least resistance. What am I getting at? Just do it. Be that person. Fight your way into the new world.

Why? BECAUSE YOU’RE A GOOD PROGRAMMER. And if this doesn’t sound like you, well you know what you have to do. Well two things: One is to stop being such a baby and set a dentist appointment for your annual check up. Cavities are no laughing matter. Second is to stop letting your fears and comfort get in the way of your growth. After all, this is your (And I’m assuming) profession. It’s your job to be the best you can be.

It’s going to suck. It’s going to be nerve wracking. It’s going to push you to your limits… and you’re going to like it. Just remember to repeat to yourself, “F–k the noise, it can’t fade me.” (I’m not exactly sure what that means but it sounds tough.)

75k Visits, 110k Views…. 59k uniques This Year

Yeah I know there are a billion sites that get that in a day, but still feels like victory of sorts since it’s pretty much 3x what I did last year. Mind you, most of the views come from searching engines, but I want to believe it’s because of all the love. It’s a strange love though. More like an abusive relationship where I yell at you and you still come back. So I guess that makes you guys dogs. But whatever, analogies, and venomous typing, aside I couldn’t have done it without you: random google searching person. You’ve made this site the 735,849th most popular site in the world (277,328 in India… Yeah India. I’d say I owe you a drink but I don’t think I could afford that.) Maybe if I’m extra special I can break into the top 500,000 next year.

Ok I realize that goal is like a product placement for Mad TV’s Lowered Expectations, but you know what? Screw you. As the late and great Leslie Nielsen put it, “It’s a topsy-turvy world, and maybe the problems of two people don’t amount to a hill of beans. But this is our hill. And these are our beans!” I’ve got my beans. You can’t take that from me.

Ok nerd rage subsiding, I’d like to thank some people for this “accomplishment”. First off, I want to thank me for being chock full of awesome. I’d also like to thank… eh… me? What? You thought I was going to say you? I’m waaaaaay too narcissistic for that. (Expect for India, I heart you India)

Anyway, as this post spirals down into the inevitable useless drivel that all two repeat readers have come to expect, I think it’s time to wrap things up, so I’ll leave you with this thought:

Hi.

Awesome Language, Now What?

Let me tell you about my friend Bob. Bob is from the future.

Bob came here from about 300 hundred years from now where time machines are sold at Walmart… which apparently owns everything.

I met Bob just randomly at a plunger convention (Apparently plungers are all the rage in his time but hard to find.) and we struck up a conversation… mainly about plungers. Anyhow, when he finally revealed he was from the future (The trippy multicolor shirt kind of gave it away honestly since by my calculations it will take at least 250 years for pleather to come back in style. Give or take 50 years.) and the first thing he said after revealing this was, “No its not a f—ing utopia so don’t ask.” Oddly enough I was going to ask if Gilligan’s Island was still on repeats in his time, but I just humored him. Long story longer, by the end of the night he was my bffff (Best friend forever from the future) and he decided to give me this awesome device thing from the future and said he’d be back in a week to get it back.

Apparently it was something he bought from Walmart but was going to return before the week long return policy was up. However, he thought I might have fun with it and then just did this sort of wavy, melty, star treky thing and was gone. Odd note: No one watching seemed to be phased by this. Cause you know, that’s something you see everyday.

Anyways, I took said device and set out into the world, determined to enrich my life with the blinking-light-a-tron. Problem was, I had no f—ing clue what it did. So I did what any person would do when faced with a blinking-light-a-tron from the future, I put it through various scientific tests.

After my barrage of highly scientific investigations, I could see that it was applicable to most useful situations. Sounds good right? Except it took me a ton of time to figure out how to use it while doing things I already knew how to do.

Now I have to admit the time difference was a knowledge issue as there wasn’t much documentation and it wasn’t intuitive in use compared to what I was used to. However, it wasn’t until I found out that it can not only make a sandwich but it can make it into a smoothy too that I realized it had some powerful features. It wasn’t long before I started to realize how much it had to offer.

After the E like excitement, there was inevitable crash: When the f–k will I ever really want a turkey sandwich smoothy? I know the thing has something bigger to offer. Something just mind blowing, like somehow being able to combine sharks with an FBI agent to form some kind of super crime fighting force, but hell if I can figure out how.

It was at that point Bob just appeared, punched me, grabbed the blinking-light-a-tron and did his futuristic wavy, melty, star treky thing. I never did find out what that was all about, but I just surmised it was some kind of futuristic way of saying goodbye for good. Or it could be that I used it to find naked pictures of his wife and posted them on the internets. (Apparently there was an app for that)

Either way, the blinking-light-a-tron was gone for good, and I’m not sure if I was better off with knowing it or not. Sure it showed me what was possible but I came back to the same conclusion: When the f–k will I ever really want a turkey sandwich smoothy?

In a weird way, I’ve come to this conclusion with something like Python. I have no doubt it has crazy capabilities to be used, but put in the hands of simpleton it’s a point of confusion. I want so badly to unlock its potential, but the best I can do is make a turkey sandwich smoothy, because I lack the overall grasp of the language and have no idea how to get it through application.

And here’s the thing, it’s not a matter of being too comfortable with C#

Ok, so maybe there is some comfort but honestly it really isn’t that. It really just comes down a frustration of finding something to showcase Python’s abilities. It just plain difficult to come up with some grand plan when I don’t even have a clue what sort of plan I need.

It’s one thing to find a language that is just a horizontal move or even a step back. Then it’s easy to say, “Screw it” and stay with what you know. In the case of Python, I really want to be convinced to move to it. Nothing against C#, I still find it to be a good language, I just have a feeling. Problem is I have no way to back the feeling up.

In order to understand something, you need a reason for it. This is the hill we all must climb at some point and it’s a big hill.