by willsteele at 2012-08-30 21:38:24
As I have written more and more scripts, they have gotten larger, more complex, and, the expectations have increased dramatically. At first, my stuff was very, very simple. Run a scheduled task to remove temp files off web servers. Archive files. Recycle web app pools. Et cetera. Simple, discrete tasks. Now, some of my larger tasks involve provisioning web servers and rolling out production code, installing IIS, setting up complex applications, and, providing SCOM management capabilities. As I have shifted from smaller, one-liners, to, larger, very complex, production grade scripts, I have found thinking about them like software development projects, with the SDLC in mind, helps. However, these are scripts, not, code. I can’t do complex testing, as you can with C# and VS. I can’t do UML modeling and develop code-bases from early-stage designs in VS.by JonBryce at 2013-02-04 13:31:06
So, I was wondering, for developers, how do you handle this type of situation? Do you just keep it all straight in the back of your head? Do you use any sort of formal model on bigger projects (waterfall, Agile, etc). How do you guys handle the PM side of these coding/scripting projects? I have been looking for a good book on project management/SDLC framewok basics, but, the best I can find are MSCD/MSPD titles which only hint at this “bigger picture” or older, wisdom based literature, like Code Complete. I know scripting can easily be written off by devs and management duct tape development, but, I want to be more professional in my projects and was hoping folks might have some suggestions on things worth looking into. Articles? Books? Patterns? Anything I can use to help me transition from what would be the equivalent of a solution level developer (in VS) to an application and ultimately, an, enterprise level developer (in the development model) or scripter (in my little world).
Also, any tips on how others think through their projects would be greatly appreciated. I am essentially a one-man team when I write my scripts, even the big ones, because we have no buy in at even the grassroots level. Management likes that we can kill our annual renewal of InstallShield’s license and the fact that PowerShell is a language most any professional developer can become competent in very quickly. That means we don’t need to have the “Powershell” guru and project development and maintenance can be handled by most anyone. From this perspective, management is very interested in Powershell. It’s simpler, cheaper, and, faster, than many alternatives such as InstallShield (which is expensive and requires licensing) or WIX. Plus, there is no need, for most people, to get into complex IDE’s, etc They can just run PowerShell ISE, incorporate their own new piece of the puzzle, test on a development machine and move on to the next task at hand. One of our developers took the script base I had developed, and, in two weeks, created full-scale, provisioning packages for 5 of our enterprise products. And, he had never seen the language before. Management likes that, and, I suspect, now that he has seen the benefits of PowerShell, he too may turn to it over other languages more quickly. I would be scared to think of what it would have taken to do this same project in VBScript. Maybe 6,000 lines.
Hi WIll. I’ve been in Powershell for about a year, but 'way back when I was in the UNIX world I supported two or three sites with Bourne Shell. In that environment I developed what I called “Object scripts”. Instead of testing the residence of a file directly in one script, I’d call an ‘object script’ to do it. The subscript would do the work, do some nice logging and return an exit code (yes, no or error). In true OO fashion, I can change the object script workings but not it’s functionality. It always returns the same exit codes, and scripts that call it don’t get affected by the subscript change.by luesec at 2013-04-23 00:53:04
That’s one way I keep track of what’s going on - I have a library of about 20 or 30 now. Something as simple as a copy is something I did in an object script - it checks the input file is there, checks the output file isn’t, does the copy, checks every 10 seconds to see if the file is in the output folder … if you’re in a belt-and-braces sort of mind, the functionality expands quickly - but the end result is the same.
I’ve not written any scripts longer than 300 lines (or so) - mainly through the use of these object scripts. I still have problems, but with logging from the object scripts (called with <parameters>, did this, exitted with exit code <nn>) I can debug fairly quickly.
I guess I’m a little old school - I usually work on the theories that
-if you can’t understand the code when you read it, you’re not doing it right
- if it’s long and complex, you’re not doing it right
And I work alone too … best place to be. No-one under your feet, and you can develop your own standards and coding practices.
This is a topic i am alsoe interrested in.
Having no Developer Background, created PS-Scripts which started small and got bigger and bigger and improved my Scripting skills, i am now at the Point wher i have bto basically review/recreate my module.
Always wondered what is the best way to go:
- Seperate File for each Function (including "internal helper functions)?
- Having a “Common” Folder where to place General Functions (e.g Write-Log, Convert-xy) Maybe also outsource Helper Functions?
- How to implement central Functions like Logging / Result checking / …
- Having One Module with SubModules? Or seperate Modules?
- Where to Place User Configuration for the Module (Prefered Logfolder, Paths, etc)
- Should i write extra Documentation for my Collegues how to use my Module?
I really would like to see how others manage these issues, get some Lessons Learned or just practices that worked.
Before i will start over with my Module i will defenetivley have a look on some bigger Codeplex Projects like PSCX.
If you have interresting Resources, Blogs, Ideas , please post them. Think some of you, espessially with Developer Background are a some steps ahead
I am also wating for: “Learn organizing your Scripts/Modules in 30 Day’s” -> Don? Any Plans?