Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IT tasks: F# script vs Powershell script [closed]

Tags:

powershell

f#

I know that Powershell is generally considered the IT management language for windows, but why/when would you choose F# instead, which is strongly typed and 'intellisensed' ?

like image 330
Clement Avatar asked Jan 04 '11 05:01

Clement


People also ask

What are the types of tasks?

We basically distinguish between 3 different types of tasks: Incidential tasks. Coordinated tasks. Planned tasks.

What are tasks in software?

1. Task is a term used to describe a software program or section of a program that is running in a multitasking environment. Tasks help the user and computer identify between each of the programs running on the computer. Microsoft Windows users can view currently running tasks using Task Manager.

How do I run Schtasks?

By default, the command runs with the permissions of the current user of the local computer. The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only when you use /s. Specifies the password of the user account specified in the /u parameter.

What is task management example?

Task management is the practice of tracking a task through to completion. Most people do some type of task management, without thinking about it, every day. Even making your morning coffee requires you to break down a larger project (“make coffee”) into smaller steps (“grind coffee,” “change filter,” etc).


2 Answers

I'd choose F# when it was a better fit for the company I was working for, the team who'll be using it, and the task at hand. Otherwise I'd choose something else.

I can't be more specific than that without more details, but I can suggest a few questions you should ask:

  1. What is the problem you're solving?
  2. In which language is it easier to express the solution to the problem?
  3. Are existing staff F# developers themselves (i.e. consider the learning curve involved)?
  4. Will the people maintaining this code be administrators (who are usually quite familiar with Powershell, & not at all familiar with F#)?

A related hint: don't allow a profusion of languages to develop in your production code and infrastructure.

By all means experiment to find the best language to solve the problem you're having, but if you find in five years time that someone has written a core component of your solution in a language that is no longer understood by anyone in the company, you may have a serious problem on your hands.

My personal rule of thumb (of course there are exceptions) is that a project should have a core language and a scripting language to hold it all together, & that those languages should be chosen first to fit the problem domain, and secondly to maximise proficiency across the team. 'Pet languages' should be strongly discouraged in production code or infrastructure.

like image 93
Duncan Bayne Avatar answered Oct 05 '22 07:10

Duncan Bayne


It depends on your problem and on who will maintain the scripts.

PowerShell is very strong in administration areas (working with files, active directory, csv/xml, computers, etc.), but it's programming abilities are quite limited (e.g. case of generics). Threading in PowerShell is not as easy as it could be. But nobody expects from administrators that they will use threads. Instead there are background jobs that satifisfy administrator's needs.

On the other hand, F# is real programming language, which means it is quite low level and therefore verbose (compared to PowerShell). Some tasks written in PowerShell are one-liners, whereas in F# you would write a lot of code. Besides that - how would you achieve running command on remote computers (Invoke-Command -computer myserver ...)?

As you see, it depends on your problem.
Very important is also who will maintain the scripts. You might be on holiday and your colleagues will need to edit the scripts. Both languages need some time to learn. IMHO it is easier to learn PowerShell; thinking in functional style needs to bend your head.

like image 24
stej Avatar answered Oct 05 '22 08:10

stej