Timothy Johnson <[EMAIL PROTECTED]> writes:

>       I think you're missing a couple of points here, and feel free
> to disagree with me, I think this is a very important debate that
> will come up in every programmer's career and is an important part
> of the topic of this list, administering a Win32 network with Perl:

Fair enough.  I figured this thread was getting long and people might
get bored...

[good list of questions snipped]

> >We were talking about "Disabling a service"....
> 
> Actually I believe you were the one that moved the conversation on
> to a more general discussion of WMI vs. third-party modules, but
> pandora's box has been opened, so let's look into it.

True.  But "disabling a service" was the example that spawned the
discussion, so I thought it would be obvious that I was talking about
applications like that, not processing 1000's of transactions per
second.

There is a trade-off here, and the details of your application matter.
My point is not that you should *always* trade efficiency for
maintainability; like most absolutes, that would be an overstatement.
But I do think that the majority of script authors worry too much
about running their script today and too little about maintaining it
in the future.  Anyone who worries about the "efficiency" of disabling
a service certainly falls into that category.

> Your contention that you spend most of your time writing and
> debugging scripts and a minimal amount of time actually running them
> will be contrary to the experience of many of the people in this
> list.

I did not say "running them", I said "waiting for them to run".  There
is a difference:

> Perhaps it has been requested of them that they disable a service on
> x number of machines,

For example, I would probably fire this off and go do something else
while it ran.  If it were a huge number of machines, I would
parallelize it.  But there again, writing and debugging that
parallelization would consume the bulk of my time; I would not sit
around waiting while it ran.

I simply do not value the computer's time that much.

> , or perhaps they needed a way to automate new user account
> creations to enable them to pass the responsibility on to someone
> with less experience with NT Administration.

And for this 1 second versus 2 seconds matters?

I would rather write the script with the less experienced people in
mind, imagining them trying to read/modify/debug it without me around.

Most scripted tasks need to run "fast enough", not "as fast as
possible".  Someone else on this thread said that scripts should be as
fast as you can make them while keeping them maintainable.  I am
arguing that scripts should be as maintainable as possible while
keeping them fast enough.  Both of these are overly extreme positions,
but I think mine is closer to the truth.

> >But we are not talking about Win32 API calls.  We are not talking
> >about writing this stuff in C (although that would be the logical
> >consequence of your argument).  We are talking about Win32::Lanman.
> 
> I think that you have some confusion about the relationship between
> Perl and C.

Actually, I am familiar with the Win32::Lanman source code.

> Many modules, like Win32::Lanman and Win32::OLE are an interface via
> a DLL to C code.  AFAIK this is how Win32::Lanman calls the Win32
> API, and this is how you are able to access WMI through Perl via
> OLE.

Yes.  But using Perl at all sacrifices some performance; there are
very few Perl scripts which would not be *much* faster if rewritten in
C.  But for most administrative tasks, using C instead of Perl would
be silly.  (Although I have seen plenty of precisely this silliness!)

The question of readability versus maintainability is very similar to
the question of using Perl versus using C, and many of the same
arguments apply.

> Again, I think this has a lot to do with your experience, but I
> would tend to disagree that Win32::Lanman makes scripts more complex
> than WMI.

You caught me:  I was confusing two issues.

One issue is the simplicity of the code, for which you may be right.
Would anyone care to rewrite my "enable/disable a service" script
using Win32::Lanman so we can compare?

  
<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/unattended/unattended/install/bin/startup-type.pl?rev=HEAD&content-type=text/vnd.viewcvs-markup>

The other issue is using third-party modules at all.  A lot of Perl
hackers seem to think of this as being free.  (I certainly used to.)
My point is that it carries a very real maintenance cost which you
need to justify before using such a module.  And "efficiency" is
usually poor justification.

> Anyway, don't be afraid to continue the debate if you want.  I can't
> promise to agree, but I value your point of view.

And I value yours.  I am sorry if I have been using an overly
confrontational discussion style; I do not intend any disrespect.  I
actually believe I have a lot in common with many people on this list.
We certainly have the same adversaries (buggy software, annoying
users, etc).

> Perhaps if you could point out a small example of where WMI makes it
> simpler and clearer than Win32::Lanman...

I could pore through the WMI docs until I found something which the
Win32 API makes difficult, but that would be cheating.  Real-world
examples, like "disabling a service", are probably best.  I am sure
more will show up on this list over time :-).

 - Pat
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to