<p>I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too.</p>

<p>Given that situation, I can't see a reason why I would ever choose to use shell scripting, vb scripting etc, no matter how small the task is if I wear one of my other hats like my cool black sysadmin fedora.</p>

<p>I don't wear the other hats too often, <strong>under what circumstances should I choose scripting over writing compiled code?</strong></p>

[{'answer_id': 54716, 'author': 'Ryan Lanciaux', 'author_id': 1385358, 'author_profile': 'https://Stackoverflow.com/users/1385358', 'pm_score': 1, 'selected': False, 'text': "<p>I would say where it makes sense. If it's going to take you longer to open up your IDE, compile the script, etc. than it would to edit a script file and be done with it than use script file. If you're not going to be changing the thing often and are quicker at Java coding then go that route :)</p>\n"}, {'answer_id': 54717, 'author': 'Craig H', 'author_id': 2328, 'author_profile': 'https://Stackoverflow.com/users/2328', 'pm_score': 2, 'selected': False, 'text': '<p>If you are comfortable with Java, and the JRE is everywhere you work, then I would say keep using it.  There are, however, languages like perl and python that are particularly suited to quickly solving problems.  I would suggest learning either perl or python, and then use your judgement on when to use it.</p>\n'}, {'answer_id': 54720, 'author': 'stimms', 'author_id': 361, 'author_profile': 'https://Stackoverflow.com/users/361', 'pm_score': 1, 'selected': False, 'text': '<p>It is usually quicker to write scripts than compiled programmes.  You don\'t have to worry so much about portability between different platforms and environments.  A shell script will run pretty much every where on most platforms.  Because you\'re a java developer and you mention that you have java everywhere you might look at groovy (<a href="http://groovy.codehaus.org/" rel="nofollow noreferrer">http://groovy.codehaus.org/</a>).  It is a scripting language written in java with the ability to use java libraries.  </p>\n'}, {'answer_id': 54731, 'author': 'Tom Hawtin - tackline', 'author_id': 4725, 'author_profile': 'https://Stackoverflow.com/users/4725', 'pm_score': 1, 'selected': False, 'text': '<p>The way I see it (others disagree) all your code needs to be maintainable. The smallest useful collection of code is that which a single person maintains. Even that benefits from the language and tools you mentioned.</p>\n\n<p>However, there may obviously be tasks where specialised languages are more advantageous than a single general purpose language.</p>\n'}, {'answer_id': 54740, 'author': 'Brian Warshaw', 'author_id': 1344, 'author_profile': 'https://Stackoverflow.com/users/1344', 'pm_score': 2, 'selected': False, 'text': "<p>If I have a small problem that I'd like to solve quickly, I tend to use a scripting language. The code tax is smaller, and, for me at least, the result comes faster.</p>\n"}, {'answer_id': 54741, 'author': 'Nick', 'author_id': 4949, 'author_profile': 'https://Stackoverflow.com/users/4949', 'pm_score': 1, 'selected': False, 'text': "<p>If you can write it quicker in Java, then go for it.</p>\n\n<p>Just try and be aware of what the various scripting languages can do.</p>\n\n<p>e.g. Don't make a full blown Java app when you can do the same with a bash one-liner.</p>\n"}, {'answer_id': 54747, 'author': 'SkunkSpinner', 'author_id': 5592, 'author_profile': 'https://Stackoverflow.com/users/5592', 'pm_score': 0, 'selected': False, 'text': '<p>Weigh the importance of the tool against popping open a text editor for a quick edit vs. opening IDE, recompiling, redeploying, etc.</p>\n'}, {'answer_id': 54750, 'author': 'Compile This', 'author_id': 4048, 'author_profile': 'https://Stackoverflow.com/users/4048', 'pm_score': 3, 'selected': True, 'text': "<p>Whatever you think will be most efficient for you!</p>\n\n<p>I had a co-worker who seemed to use a different language for every task; Perl for quick text processing, PHP for small internal web applications, .NET for our main product, cygwin for filesystem stuff. He preferred to use the technology which was most specific to the task at hand.</p>\n\n<p>Personally, I find that context switching between technologies is painful. My day-to-day work is in .NET, so that's pretty much the terms I think in. For most tasks I find it more efficient to knock something up in C# using SnippetCompiler than I would to hack around in PowerShell or a scripting environment.</p>\n"}, {'answer_id': 54775, 'author': 'TALlama', 'author_id': 5657, 'author_profile': 'https://Stackoverflow.com/users/5657', 'pm_score': 0, 'selected': False, 'text': '<p>Of course, the prime directive should be to "use whatever you\'re comfortable with." If Java is getting the job done right and on time, stick to it. But a lot of the scripting languages could save you some time because they\'re attuned to different problems. If you\'re using regular expressions, the scripting languages are a good fit. If you\'re dropping into shell commands, scripts are nice.</p>\n\n<p>I tend to use Ruby scripts whenever I\'m writing something that\'s small, because it\'s quick to write, easy to maintain, and (with Gems) easy to bolt on additional functionality without needed to use JARs or anything. Your milage will, of course, vary.</p>\n'}, {'answer_id': 54782, 'author': 'John', 'author_id': 2168, 'author_profile': 'https://Stackoverflow.com/users/2168', 'pm_score': 0, 'selected': False, 'text': '<p>At the end of the day this is a question that only you can answer for yourself.  Based on the fact that you said "I can\'t see a reason why I would ever choose to use shell scripting , ..." then it\'s probably the case that you should never choose it right now.  </p>\n\n<p>But if I were you I would pick a scripting language like python, ruby or perl and start trying to solve some of these small problems with this language.  Over time you will start to get a feel for when it is more appropriate to write a quick script than build a full-blown solution.</p>\n'}, {'answer_id': 54827, 'author': 'Binil Thomas', 'author_id': 3973, 'author_profile': 'https://Stackoverflow.com/users/3973', 'pm_score': 0, 'selected': False, 'text': '<p>I use scripting languages for writing programs which are not expected to be maintained beyond few executions. Most of these languages are light on boiler-plate syntax and do have a REPL. Both these features enable rapid prototyping.</p>\n\n<p>Since you already know Java, you can try JVM languages like Groovy, JRuby, BeanShell etc. Scala has much lighter syntax than Java, has a REPL, is statically typed and runs on the JVM - you might give that a shot as well.</p>\n'}]
['https://Stackoverflow.com/questions/54703', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2362/']