Ad hoc development

I was having a discussion about how people can learn PowerShell at the recent UK PowerShell day and mentioned ad hoc development. Surprisingly, no-one really knew what I meant.

Ad hoc development is a concept more than a development type. It was used extensively back in the days of PowerShell v1 and v2 but seems to have dropped off the radar these days.

Many people seem to learn the PowerShell language – either from a class or a book – but then don’t have any idea how to put that into practice. This is a failing of our teaching methods. Too many times I’ve seen people asking for help because they’ve dived into trying to create huge complicated scripts, or modules, and don’t have the background knowledge or experience to actually get the code to work.

Ad hoc development is one approach to moving from a basic knowledge of the PowerShell language to coding production level scripts and modules.

The starting point is the command line and working interactively. Use individual cmdlets or even a pipeline of cmdlets. If you find you’re using the same pipeline a lot then save as a script. Later, as you learn more you can parameterise the script, add all the production bells and whistles and even turn it into a module.

PowerShell is a huge beast these days with many parts you probably don’t need to start with. Use what you need now and add to your code as you learn rather then trying to jump right into a big complicated project. In the long run you’ll learn faster and end up getting more done with less frustration.

This entry was posted in Powershell. Bookmark the permalink.

2 Responses to Ad hoc development

  1. Photographer says:

    I think it could be my way of learning. I bought “learning powershell in a month of lunches” and the first sentence on the first chapters asks me to set up a SERVER to work with.

    I don’t work anymore with servers. I want to automate my work using what freeware and my operating system have to offer: not only for economic reasons, but also for my personal point of view about what computers and software are for. I used to work with a server and a domain 10 years ago for a company. But now I’m a freelancer photographer in the microstock industry: taking photos, editing photos, adding captions and keywords are my regular basis work. Some of these things are always new, some are very, very repeating, time consuming and not human-error prone.

    So everything about keywording and uploading files, documents etc, to multiple agencies, are made via commaldinline script by me.

    I’m going on with windows legacy commandline and a mini-set of freeware commandline softwares (exiftool is one of the most valuable and necessary) in combination with a little piece of VBS-scripting.

    But I read your posts since … I can’t remember. I think since version 3? I always think: I MUST learn powershel before everything I need in automation will disappear.

    And of course there are ideas I simply can’t develop with these instruments.

    For people like me , maybe some exercises like “if you can do this with cmd, then learn immediately to do this with powershell and never come back!”

    But lots of things are tremendously simpler with cmd. And when I automate, then I forget.

    It’s even more simple to learn some “new” (he he) gnu commandline tools converted for windows. The sintax is sometime simpler, even if they have very complex possibilities and the complex tasks could be accomplished in a simpler way, maybe, in powershell.

    I think lots of people like me, maybe “lazy” from your point of view, will be the most happy powershell users if only they made themself more confident to do their everyday “oh, let’s do this with that black screen, it’s easier and quicker than click here and there” with powershell.

    We learnt cmdline with dos, you know. We HAD to do it. Now I love to have this chance everytime I can do something quicker than going to search in menus, options, pages, interfaces click by click.

    My commandline is my hammer. My tools are not only cameras and lights, but my PC. I’m automating on a purpose. I think this could be “ad hoc” 🙂 Couldn’t it?

    Thanks for sharing your knowledge, Richard.

  2. Photographer says:

    errata corrige: they ARE human-error prone!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s