LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-15-2012, 03:40 PM   #1
towardstheedge
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Rep: Reputation: Disabled
Making new script vs adding to existing script


I am new to computer science. I am just taking a few cc courses in programming and Linux to prepare for taking computer science at the local university.

I am trying out an optional project in shell scripting. I can see there are a lot of ways to approach the problem.

Are there many standards, or conventions, or just good ideas, for when to make a whole new script vs just adding the desired function to an existing script?
 
Old 11-15-2012, 04:15 PM   #2
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Ubuntu
Posts: 1,057

Rep: Reputation: 284Reputation: 284Reputation: 284
Quote:
Originally Posted by towardstheedge View Post
I am new to computer science. I am just taking a few cc courses in programming and Linux to prepare for taking computer science at the local university.

I am trying out an optional project in shell scripting. I can see there are a lot of ways to approach the problem.

Are there many standards, or conventions, or just good ideas, for when to make a whole new script vs just adding the desired function to an existing script?
You will probably get many responses to this question and the responses will be diverse because the answer is a matter of opinion and style. This is my view of the world.

If you want to improve performance by 10%, modify the existing code.
If you want to improve performance by 100%, start from scratch.

If you want to improve function by 10%, modify the existing code.
If you want to improve function by 100%, start from scratch.

The same guidelines apply to hardware designs, with variations such as ...

If you want to reduce manufacturing cost by 10%, modify the existing design.
If you want to reduce manufacturing cost by 50%, start from scratch.

If you want to reduce weight by 10%, modify the existing design.
If you want to reduce weight by 50%, start from scratch.

Do the same guidelines apply to improving government?
This forum is the wrong place to open that can of worms!

Daniel B. Martin

Last edited by danielbmartin; 11-16-2012 at 09:00 AM. Reason: Improved math
 
Old 11-16-2012, 08:50 AM   #3
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Slack14_64_Multilib
Posts: 3,039
Blog Entries: 4

Rep: Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734
Quote:
Originally Posted by towardstheedge View Post
...when to make a whole new script vs just adding the desired function to an existing script?
Depends on the function I suppose.
A simple text replacement on a Regular Expression in someone else's code may be a simple matter, but calculating the total time root has been logged in could be a significant rewrite.
You could write the function and call it from the original, via "source'ing". Shell scripting requires you only be flexible.

Personally, I always start fresh for 1 reason, it provides me with the opportunity to learn, using someone else's code as a guideline.

I print them out and study them with some serious highlighting techniques.

Last edited by Habitual; 11-16-2012 at 01:51 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Adding start up script in rcX.d --> Via update-rc SCRIPT defaults .... :-( jv2112 Linux - Newbie 6 07-04-2011 06:19 AM
Adding New Selections to the existing Script NetRock Programming 5 03-19-2010 02:05 AM
how do i call an already existing script in another script? Predatorian Programming 3 03-14-2008 08:49 AM
logrotate shell script help with existing script sridhar11 Debian 7 11-04-2005 04:11 AM


All times are GMT -5. The time now is 04:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration