Time for D-CRUD?

I was thinking on the plane back from the PowerShell summit about the CRUD activities. They are a concept we have inherited from the database world:

C = Create

R = Read

U = Update

D= Delete

Create, Update and Delete correspond directly to the PowerShell verbs – New,Set and Remove respectively.

The Read action corresponds to the Get verb.

Well sort of.

Get-* is used in two distinct scenarios.  Firstly we know of an object and we we want to read its properties – for example:

Get-Process -Name powershell

We are reading the information about the PowerShell process. That corresponds directly to the Read action in the CRUD paradigm.

However, we also use Get* when we want to Discover the processes that are running:


In which case we are Discovering the processes that are running.

I think its time to update the CRUD concept and make it DCRUD where D stands for discovery.

This entry was posted in Philosophy, Powershell. Bookmark the permalink.

2 Responses to Time for D-CRUD?

  1. I disagree; feel you are elevating a special case of Read. Get-Process is still a Read, but directed a level up, with an asterisk. A little rusty on my SQL, but try this on:

    Get-Process -Name Powershell is like
    SELECT *
    FROM item INNER JOIN type ON item.fkType = type.name
    WHERE type.name = ‘Process’ AND item.name = ‘Powershell’
    Get-Process is like
    SELECT *
    FROM item INNER JOIN type ON item.fkType = type.name
    WHERE type.name = ‘Process’

    These are “optimized” for demonstrating a point, not for execution, and I haven’t dealt in SQL in a year.

    I often find the answer I’m looking for on your blog via Uncle Google, so this is very friendly disagreement. I just think you overlooked something from the Powershell perspective that should leap out at you from the SQL perspective. In both cases, you are telling the machine where to look, and what to look for.
    By the time we need a real “Discover” command, it will probably have to be a polite request, lest they squash us like grapes.

    • I’m more than happy for you to disagree🙂

      I think of discovery as being equivalent to looking at the contents and index of a book to discover the where the information is that you want. Then you read it.

      I don’t expect to see Discover-* cmdlets. The point is that Get* can perform multiple actions

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s