Group:  English: General ยป microsoft.public.windows.powershell
Thread: How to learn scripting/programming constructs

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

How to learn scripting/programming constructs
"Clint Bergman" <clint[ at ]psd267.wednet.edu> 13.07.2007 16:20:20
This is a multi-part message in MIME format.

------=_NextPart_000_0018_01C7C52F.08E3F380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Reading through PowerShell in Action has made me acutely aware of just =
how ignorant of ...I don't even know what, just ignorant when it comes =
to effective problem solving constructs. I wish I knew how to express =
that more precisely. Perhaps an example.

While addressing the subject of XML processing Bruce writes:

"The basic approach we'll use is to look for the command tag, extact and =
save the command name, and then capture the discription in the =
description element that immediately follows the command name element. =
This means that we'll use a state-machine pattern to process the =
document."

This may be putting the cart before the horse, but where can a person =
learn about programming "patterns" and when/why you would use one or =
another? That's a level of knowledge I have never even known to ask =
about, and can only imagine would be of tremendous value. Can anyone =
point me in a good direction?

Sorry to be a total newb on this one, I feel like I don't even know what =
to ask. TIA for any info.

~clint
http://outputredirection.blogspot.com

------=_NextPart_000_0018_01C7C52F.08E3F380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16481" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Reading through PowerShell in Action =
has made me=20
acutely aware of just how ignorant of ...I don't even know what, just =
ignorant=20
when it comes to effective problem solving constructs.  I =
wish I=20
knew how to express that more precisely.  Perhaps an =
example.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>While addressing the subject of XML =
processing=20
Bruce writes:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"The basic approach we'll use is to =
look for the=20
command tag, extact and save the command name, and then capture the =
discription=20
in the description element that immediately follows the command name=20
element.  <STRONG>This means that we'll use a state-machine pattern =
to=20
process the document</STRONG>."</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This may be putting the cart before the =
horse, but=20
where can a person learn about programming "patterns" and when/why you =
would use=20
one or another?  That's a level of knowledge I have never even =
known to ask=20
about, and can only imagine would be of tremendous value.  Can =
anyone point=20
me in a good direction?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Sorry to be a total newb on this one, I =
feel like I=20
don't even know what to ask.  TIA for any info.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>~clint</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://outputredirection.blogspot.com">http://outputredirection.b=
logspot.com</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>

------=_NextPart_000_0018_01C7C52F.08E3F380--

Re: How to learn scripting/programming constructs
"Jason" <nospam[ at ]nospam.com> 13.07.2007 17:02:20
This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C7C545.AA8D22E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Clint:

You could read a college programming textbook to get the background =
theory, but what you want is probably best learned by simply reading =
other peoples' well-written and well-documented code to learn these =
patterns and techniques implicitly. For example, search Google or =
Amazon for the word "cookbook" or "patterns" and whatever programming =
language or IT topic you're interested in and then go through the =
examples found line-by-line. You can find many examples of PowerShell =
scripts floating around to study, but there's not yet a =
cookbook/patterns-style book out there yet just for PowerShell per se. =20

If a programming jargon term comes up that you'd like a quick =
description of, try searching Wikipedia, e.g., =
http://en.wikipedia.org/wiki/Finite_state_machine (related to your XML =
quote). =20

And for a very high-level but readable discussion of design principles =
that apply to PowerShell and operating systems in general, see =
http://www.faqs.org/docs/artu/ch01s06.html=20

Hope this helps!

Cheers,
Jason


------------------------------------------------------
PowerShell Training at SANS Conferences
http://www.WindowsPowerShellTraining.com=20
------------------------------------------------------


------=_NextPart_000_0020_01C7C545.AA8D22E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16481" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Clint:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>You could read a college programming =
textbook to=20
get the background theory, but what you want is probably best learned by =
simply=20
reading other peoples' well-written and well-documented code to learn =
these=20
patterns and techniques implicitly.  For example, search Google or =
Amazon=20
for the word "cookbook" or "patterns" and whatever programming language =
or IT=20
topic you're interested in and then go through the examples found=20
line-by-line.  You can find many examples of PowerShell scripts =
floating=20
around to study, but there's not yet a cookbook/patterns-style book out =
there=20
yet just for PowerShell per se.  </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>If a programming jargon term comes up =
that you'd=20
like a quick description of, try searching Wikipedia, e.g., <A=20
href=3D"http://en.wikipedia.org/wiki/Finite_state_machine">http://en.wiki=
pedia.org/wiki/Finite_state_machine</A> =20
(related to your XML quote).  </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>And for a very high-level but readable =
discussion=20
of design principles that apply to PowerShell and operating systems in =
general,=20
see <A=20
href=3D"http://www.faqs.org/docs/artu/ch01s06.html">http://www.faqs.org/d=
ocs/artu/ch01s06.html</A>=20
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Hope this helps!</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>   =20
Cheers,<BR>        Jason</FONT></DIV>
<DIV> </DIV><FONT face=3DArial size=3D2>
<DIV><BR>------------------------------------------------------<BR>PowerS=
hell=20
Training at SANS Conferences<BR><A=20
href=3D"http://www.WindowsPowerShellTraining.com">http://www.WindowsPower=
ShellTraining.com</A>=20
<BR>------------------------------------------------------<BR></DIV>
<DIV> </DIV></FONT></BODY></HTML>

------=_NextPart_000_0020_01C7C545.AA8D22E0--

Re: How to learn scripting/programming constructs
"Clint Bergman" <clint[ at ]psd267.wednet.edu> 13.07.2007 17:20:07
This is a multi-part message in MIME format.

------=_NextPart_000_0033_01C7C537.62F5AF50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks Jason. I would be interested in reading through the textbook(s) =
to learn the theory and principles eventually. I've been doing some =
searching and there is a great deal of information on programming =
patterns, etc. Do you think books on that topic would be helpful, or =
should I be searching for something else?

"Jason" <nospam[ at ]nospam.com> wrote in message =
news:OCZ7U%23WxHHA.4916[ at ]TK2MSFTNGP04.phx.gbl...
Hi Clint:

You could read a college programming textbook to get the background =
theory, but what you want is probably best learned by simply reading =
other peoples' well-written and well-documented code to learn these =
patterns and techniques implicitly. For example, search Google or =
Amazon for the word "cookbook" or "patterns" and whatever programming =
language or IT topic you're interested in and then go through the =
examples found line-by-line. You can find many examples of PowerShell =
scripts floating around to study, but there's not yet a =
cookbook/patterns-style book out there yet just for PowerShell per se. =20

If a programming jargon term comes up that you'd like a quick =
description of, try searching Wikipedia, e.g., =
http://en.wikipedia.org/wiki/Finite_state_machine (related to your XML =
quote). =20

And for a very high-level but readable discussion of design principles =
that apply to PowerShell and operating systems in general, see =
http://www.faqs.org/docs/artu/ch01s06.html=20

Hope this helps!

Cheers,
Jason


------------------------------------------------------
PowerShell Training at SANS Conferences
http://www.WindowsPowerShellTraining.com=20
------------------------------------------------------


------=_NextPart_000_0033_01C7C537.62F5AF50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16481" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks Jason.  I would be =
interested in=20
reading through the textbook(s) to learn the theory and principles=20
eventually.  I've been doing some searching and there is a great =
deal of=20
information on programming patterns, etc. Do you think books =
on that=20
topic would be helpful, or should I be searching for something=20
else?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Jason" <<A =
href=3D"mailto:nospam[ at ]nospam.com">nospam[ at ]nospam.com</A>>=20
wrote in message <A=20
href=3D"news:OCZ7U%23WxHHA.4916[ at ]TK2MSFTNGP04.phx.gbl">news:OCZ7U%23WxHHA.=
4916[ at ]TK2MSFTNGP04.phx.gbl</A>...</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>Hi Clint:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>You could read a college programming =
textbook to=20
get the background theory, but what you want is probably best learned =
by=20
simply reading other peoples' well-written and well-documented code to =
learn=20
these patterns and techniques implicitly.  For example, search =
Google or=20
Amazon for the word "cookbook" or "patterns" and whatever programming =
language=20
or IT topic you're interested in and then go through the examples =
found=20
line-by-line.  You can find many examples of PowerShell scripts =
floating=20
around to study, but there's not yet a cookbook/patterns-style book =
out there=20
yet just for PowerShell per se.  </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>If a programming jargon term comes up =
that you'd=20
like a quick description of, try searching Wikipedia, e.g., <A=20
=
href=3D"http://en.wikipedia.org/wiki/Finite_state_machine">http://en.wiki=
pedia.org/wiki/Finite_state_machine</A> =20
(related to your XML quote).  </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>And for a very high-level but =
readable discussion=20
of design principles that apply to PowerShell and operating systems in =

general, see <A=20
=
href=3D"http://www.faqs.org/docs/artu/ch01s06.html">http://www.faqs.org/d=
ocs/artu/ch01s06.html</A>=20
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Hope this helps!</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>   =20
Cheers,<BR>        =
Jason</FONT></DIV>
<DIV> </DIV><FONT face=3DArial size=3D2>
=
<DIV><BR>------------------------------------------------------<BR>PowerS=
hell=20
Training at SANS Conferences<BR><A=20
=
href=3D"http://www.WindowsPowerShellTraining.com">http://www.WindowsPower=
ShellTraining.com</A>=20
<BR>------------------------------------------------------<BR></DIV>
<DIV> </DIV></BLOCKQUOTE></FONT></BODY></HTML>

------=_NextPart_000_0033_01C7C537.62F5AF50--

Re: How to learn scripting/programming constructs
Hal Rottenberg <halr9000[ at ]gmail.com> 13.07.2007 18:09:22
On Jul 13, 12:20 pm, "Clint Bergman" <cl...[ at ]psd267.wednet.edu> wrote:
[Quoted Text]
> Reading through PowerShell in Action has made me acutely aware of just

> While addressing the subject of XML processing Bruce writes:

As a side note let me say that I had to skip this chapter to come back
later. Later hasn't happened yet. :)

Re: How to learn scripting/programming constructs
"Jason" <nospam[ at ]nospam.com> 13.07.2007 20:05:22
[Quoted Text]
> Do you think books on that topic would be helpful,
> or should I be searching for something else?

My personal opinion is that it's best to learn a language (human or
programming) by practicing it, not reading about abstract principles of
grammar, composition rules, optimization strategies, "agile" programming
theory, etc. Those books are for *after* you've learned a language and you
want to fine-tune, not to learn the language in the first place. I think
the best way to start is to read through other peoples' scripts until you
start to internalize the patterns/strategies/techniques which those scripts
are utilizing but not describing explicitly or formally. Then, when you
want to write your own script which does something complex, break down that
script into small managable sub-tasks, write functions or chunks of code for
each sub-task while looking at other peoples' code for guidance, then
combine these smaller functions/chunks together into the main script.

For example, if you want to learn Active Directory scripting, a great way to
start would be to pick up Robbie Allen's "Active Directory Cookbook" and
work through his examples (which you can get for free from
http://robbieallen.com/scripting). Unfortunately, almost all his code is in
Perl or VBScript, not PowerShell. The same learning approach applies, but
there's not yet a ton of PowerShell cookbooks out yet, so you'll have to
scrounge the Internet for those PowerShell scripts to learn from. This
newsgroup is a great place to start! :-)

My two cents...

Cheers,
Jason


------------------------------------------------------
PowerShell Training at SANS Conferences
http://www.WindowsPowerShellTraining.com
------------------------------------------------------



Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net