Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. To script or not to script...

To script or not to script...

Scheduled Pinned Locked Moved The Lounge
questiondiscussionsysadmintools
22 Posts 18 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Tim Carmichael

    Started with the scripted solution because it's quick and should have worked. However, despite destroying objects, there is still an issue with something not being released, but, of course, the scripting app won't tell me what it is. If scripting worked, I could edit in place and move on. Since it is causing issues, I will be moving to an app (.NET based) where I can control the environment better. And, what does one have to do with the other and this response? Prefer the simple and elegant, but moving to the more involved, but probably better in the long run. And.. continued to try to get scripting working after original post.

    T Offline
    T Offline
    Tieske8
    wrote on last edited by
    #12

    Your main question is related to maintainability of the solution imo. Who is going to maintain it? What technology (script language) do you intend to use? Who else can handle this technology in your team? What is your rollout strategy like? Do you require formal testing and signoff for example... Just to name a few... For me; scripts are easier to roll out than executables. And .NET is not a data friendly solution if all you need is CSV formats to be handled.

    Cigarettes are a lot like hamsters. Perfectly harmless, until you put it in your mouth and light it on fire.

    1 Reply Last reply
    0
    • R R Erasmus

      I'd say write a script. It is what the scripting languages are there for. Size of your script (depending on the scripting language) will be much smaller (thus less effort) than the app. It should be much quicker to execute too (depending on the scripting language and your scripting skills). In the long run you can build yourself a scripting tool kit. Advantages of writing a script for the current project will possibly not show yet but will definitely show in the projects to come. When you require the use of a scripting language in the future, you'll have scripts performing script related tasks and apps performing app related tasks and not a unmanageable toolkit consisting of both scripts and apps performing only script related tasks. I agree with GuyThiebaut that you won't have advantages of debugging... thus would suggest sanity checks throughout your script (a good practice even if you're writing a compiled app).

      "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

      T Offline
      T Offline
      Tieske8
      wrote on last edited by
      #13

      R. Erasmus wrote:

      I agree with GuyThiebaut that you won't have advantages of debugging... thus would suggest sanity checks throughout your script (a good practice even if you're writing a compiled app).

      Not ok... even scripts should get a complete test set. Especially as it is going to be important in production. Don't cut corners there, you'll regret it.

      Cigarettes are a lot like hamsters. Perfectly harmless, until you put it in your mouth and light it on fire.

      S 1 Reply Last reply
      0
      • T Tieske8

        R. Erasmus wrote:

        I agree with GuyThiebaut that you won't have advantages of debugging... thus would suggest sanity checks throughout your script (a good practice even if you're writing a compiled app).

        Not ok... even scripts should get a complete test set. Especially as it is going to be important in production. Don't cut corners there, you'll regret it.

        Cigarettes are a lot like hamsters. Perfectly harmless, until you put it in your mouth and light it on fire.

        S Offline
        S Offline
        Shining Dragon
        wrote on last edited by
        #14

        Agreed, if its going to be production code then it needs to be unit tested which makes the decision for you. Scripts are good for adhoc operations tasks but not for a production system that's going to evolve and go through a number of versions

        1 Reply Last reply
        0
        • T Tim Carmichael

          I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

          S Offline
          S Offline
          StatementTerminator
          wrote on last edited by
          #15

          When I process CSV files this way I usually just do it all in SQL with temp tables. If you have to do a lot of string manipulation then procedural code might be better, but otherwise processing the CSV with a stored procedure is generally going to be fast and easy to maintain. Otherwise I don't see much difference between a script and a compiled app, other than possibly speed. But if you can do it in set operations with SQL rather than with loops, that's going to be a huge speed gain right there.

          1 Reply Last reply
          0
          • T Tim Carmichael

            I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

            R Offline
            R Offline
            RafagaX
            wrote on last edited by
            #16

            For me, everything rounds to what would be easier, if the script language (or environment) have everything I need then I do a script, if the compiled app would be easier to create, then I go for the compiled app. As a rule of thumb, if the script will end up with more than a hundred of lines, then a compiled app may be better.

            CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

            1 Reply Last reply
            0
            • T Tim Carmichael

              I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

              R Offline
              R Offline
              Rowdy Raider
              wrote on last edited by
              #17

              Try this package, CsvHelper [^] For my team this made handling csv files a snap in C#.

              1 Reply Last reply
              0
              • T Tim Carmichael

                I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

                Z Offline
                Z Offline
                Zuoliu Ding
                wrote on last edited by
                #18

                Try Power Shell script if like

                1 Reply Last reply
                0
                • T Tim Carmichael

                  I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

                  M Offline
                  M Offline
                  Member 3728100
                  wrote on last edited by
                  #19

                  I have several apps that do this and I have used scripts, console apps and now I pretty much create services. 1. Unless you control the box the script is on, some one is going to open up the script in a text editor just to look at it. Come you know you have. Ever think you can make it better with just a little tweak? 2. If people log into the box with different credentials and run your console app. Oops different results - must be a bug, not a security feature. 3. With a service I can control the user the app is executing under, and people are less likely to mess with it.

                  1 Reply Last reply
                  0
                  • T Tim Carmichael

                    I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #20

                    The issues that you expressed shouldn't have any thing to do with "script" or not unless the scripting language you have is severely limited in some way. It should still be able to log, recover from errors, etc.

                    1 Reply Last reply
                    0
                    • T Tim Carmichael

                      I have an third party application that will be processing CSV files and pushing data to a data store. However, due to limitations in the application, the CSV files need to be pre-processed to add some additional data, reformat some fields and split the original file into smaller files. The question is: to write a script to process it daily or to write a compiled app... Either way, the solution will be running as a scheduled task on a server. Thoughts? Opinions?

                      A Offline
                      A Offline
                      AndrewJacksonZA
                      wrote on last edited by
                      #21

                      I would prefer to do it in a compiled .NET application because I'm more familiar with C# than scripting languages and, as you pointed out in a later post, memory management is (IMHO) better in .NET. However, whatever you choose to do, MAKE SURE THAT YOU WRITE TESTS FOR IT so that eight months down the line you can catch any bugs that the "tiny little small change" that you need to do might introduce.

                      1 Reply Last reply
                      0
                      • T Tim Carmichael

                        Started with the scripted solution because it's quick and should have worked. However, despite destroying objects, there is still an issue with something not being released, but, of course, the scripting app won't tell me what it is. If scripting worked, I could edit in place and move on. Since it is causing issues, I will be moving to an app (.NET based) where I can control the environment better. And, what does one have to do with the other and this response? Prefer the simple and elegant, but moving to the more involved, but probably better in the long run. And.. continued to try to get scripting working after original post.

                        S Offline
                        S Offline
                        Simon ORiordan from UK
                        wrote on last edited by
                        #22

                        I would have said .NET from the get-go; the difference between a script and source code is one, measly compile, but the .NET will give you so many options and so much reference in the literature. Of course, sometimes you have to hack a prior script, in which case you just have to dive right in and stay with it. ;)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups