More VIM tricks

Since my post a few weeks ago, I've been using VI when developing and I only need to access one file, if I need to be workin with multiple tabs at once then I use UtraEdit.(I wrote a review here).

Comment a block of code
I learned this from my friend Brian... say you have 5 lines of code you want to comment out, perhaps you are doing caveman debugging to find where the real problem is..

ctrl-v to go into visual block mode
j down to select the first column in each line
I to insert at begining of line
enter your comment symbol
esc

And there you go! Thanks Brian :)

VIM does orgami
Almost, although you can't make a paper crane with VIM, you can fold your code to make long chunks of code easier to live with. This is something I use in UltraEdit, when I have a really looooooong function that I am not curently working with and I have to scroll up and down to see the code around it.

Learning Design Patterns – Iterator Pattern

This week I'll be stepping through the Iterator Pattern in my series on design patterns plucked from this book and from examples on the Internet.

What is it?
The Iterator Pattern encapsulates the functionality for stepping through a collection of items. The iterator object implements the stepping; the aggregate itself does not step through its own collection.

The pattern generally has a few of methods like first(), hasNext(), Next(), isDone() in some combination. In some programming languages it is possible to step through an iterator using a For Each item in Aggregate....<code>....Next type of construct.

Where is it used?
Anywhere there is a group of items. An array list is a common example; an iterator would step through the array items until the end of the collection was reached.

PHP can be cool like Ruby

All the cool kids these days are using Ruby...however I am stuck in a PHP world at the moment. I've been doing Ruby on some side projects and its got me thinking in a ruby mindset...and I wonder.. can PHP do that? And I've found a few things that might make a PHP geek's life a bit easier or at least PHP a little more tolerable.

Looping
Yes yes, the good old for loop.

for ($i = 1, $i <= 10; $i++) {
    print "Processing $<br>";
}

The simple act of doing something 10 times. Ugly huh? He's one way to do it in Ruby..

Hi Ho Silver! Away!

Remember the Lone Ranger? Believe it or not, I actually watched it as a kid. I don’t know why he was called the Lone Ranger, he always seemed to have Tonto - his Indian sidekick with him. Often, I code alone (I thought about rewriting the "I Drink Alone" song to "I Code Alone" but I had only had 1 small cup of coffee when I wrote this) and I’ve been thinking of some "tricks" to help me with my lonely quest.

Live Clipboard, or not…

I set aside my Codesnipers time this week to continue last week’s exploration of the Live Clipboard technical introduction. Then I found this link on Bob’s blog, and that kind of threw me off track:-

Live Clipboard Specification v0.91

I know it wouldn’t be smart to press on regardless, pretending that there was no new information, so I need to do some reading. In a normal week, that wouldn’t hold me back; I’d read the new information, adapting the article if necessary, or I’d pick something else to write about. I decided that this week would be different, for a couple of reasons.

Versioning - The Next Big Thing

In the web development world, anyways. So, in the grand scheme of things, maybe not a huge deal to anyone else. Versioning is going to be one of the biggest problems and opportunities there is in web development, and it's going to take us at least five years to get it right.

Actually, let me admit up front that five years is a shot in the dark, and optimistic to boot. If people keep hanging out with bondage and discipline languages like Java and C# that are still catching up to language and framework developments from the 90's it'll take us more like ten years. (Attention Lisp Weenies: Yes, I know you solved every problem forty years ago for certain values of "solved" and "problem" while the rest of us were getting work done.) Not only is versioning a difficult technical problem, it will be difficult to educate programmers in what it is, how it works, and why you'll wish you used about a year after you decided it was too much work.

A look at Rails' Code Generation and Java

Bill Venners of Artima recently posted a look at how Rails' code generation compares with Java, and talks about Bruce Tate's recent DeveloperWorks article on the comparisons between Hibernate and ActiveRecord.

New Contributor - Peter Harkins

Let's all give a warm welcome to our newest contributor, the incredibly brilliant and good-looking Peter Harkins.

That's right, clap for me -- er, him, clap for him. I'm not writing this about myself. I mean he's not. Crap.

Hi, folks. I'm a new contributor to CodeSnipers. I'll be writing mostly about design and coding, though I may wander into MicroISV territory if any of my side projects should start doing particularly well.

To tell you a little about myself, I'm a 25-year old web developer in Chicago, IL, USA, Earth. I've been programming for about fourteen years, professionally for the last 5.5. My constant obsession is writing code that's just a little bit better, a little bit smarter, a little bit higher-level. Even though the steps I've taken and will be writing about are small, they're a great way to improve code and design every time you touch it.

Say Hello to My Little Friend

With my recent Ruby on Rails project, I've done more on the linux command line than with PHP development. For example, you run a ruby script to generate a code skeleton for scaffolding, controllers, models and views. Stuck with a windows environment for my development on the go (I commute 3 hours a day, in which time I'm hacking away on my laptop, which I am doing right now. In Vim.)

I reached into the crevices of my mind to remember how to create Batch files. Yes, that’s right, batch files. Yes, Good Old MS-DOS. I still have a DOS For Dummies book (aquired long after DOS was out, I just couldn't resist the nostalgia and I think it only cost 2 bucks). I created a batch file for ls, mv and cp. Not rocket science I know and although I had installed cygwin I was not particularly keen on using that all the time, I also had found some exe's that imitate many of the unix commands...but I didn't need all that jazz. I just wanted a ls, mv and cp command!

As my project progressed, I was doing more and more on the server side, tweaking here and there. Man, I said… I need to get VI for windows I knew it existed, I had it many years ago. Actually, I think it was only a dos version that I had. I searched and discovered GVIM. And it’s pretty darn nice!

House of Software Development

We've started a software developer's book club at work, and our first book is Code Complete, 2nd ed. by Steve McConnell - probably the highest recommended book on software development today.

Our division is just starting to organize itself from a staff-augmentation focus where we'd help out clients with relatively quick and easy programming solutions to a structured software development focus. It's more of an attitude shift than a job-type shift, really. We aren't going to start selling shrink-wrap, we're just going to start laying down some procedures and standards and a methodology of sorts.

Coincidentally to reading the first chapter which reviews the major aspects of software development and discusses different analogies (including that of building a house), my boss asked me last week to basically define my own role in the new hierarchy, which itself is still being defined daily.