473,669 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best way to modify code without breaking stuff.

I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on
the module to keep working while I'm making my changes. What's the
best way to accomplish this?
Jun 27 '08 #1
8 1001
On Wed, 04 Jun 2008 00:25:19 -0700, Jesse Aldridge wrote:
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on the
module to keep working while I'm making my changes. What's the best way
to accomplish this?
Version control system.

http://en.wikipedia.org/wiki/List_of...ntrol_software

Make your module a versioned repository.
Make your changes in different place, then commit them.

I use SVN and mercurial.

Ivan
Jun 27 '08 #2
Jesse Aldridge wrote:
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on
the module to keep working while I'm making my changes. What's the
best way to accomplish this?
You simply run the module's unit tests that tell you if the new module's
behaviour differs from the expectations. If you don't have unit tests, I'd
say it's about time writing them.

Uli

--
Sator Laser GmbH
Geschäftsführ er: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Jun 27 '08 #3
Jesse Aldridge wrote:
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on
the module to keep working while I'm making my changes. What's the
best way to accomplish this?
Don't ;-)

If the changes are that extensive it might be considerable to write a new
module and switch the depending code to use that new module when you're
done and they're ready.

As mentioned in another posting revision control is a good thing as well.
Not just for that task.

nd
Jun 27 '08 #4
André Malo wrote:
As mentioned in another posting revision control is a good thing as well.
Not just for that task.
From my point of view revision control is not a question but a fact.
Seriously, if you are not using any RCS already, it is about time you start
doing so. I even use it for my private toy projects.

Uli
--
Sator Laser GmbH
Geschäftsführ er: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Jun 27 '08 #5
On Jun 4, 3:25 am, Jesse Aldridge <JesseAldri...@ gmail.comwrote:
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on
the module to keep working while I'm making my changes. What's the
best way to accomplish this?
If I'm understanding you correctly: you want to load the old module
when running code normally, but want to use a new module when
developing, but is has to have the same name?

Here's what you could do:

1. Rename "whatever.p y" to "oldwhatever.py ".

2. Copy "oldwhatever.py " to "newwhatever.py ", and make your extensive
changes there.

3. Create a new "whatever.p y" with code that imports all the symbols
from the old or new module depending on which module you want to use.
For instance, you could use an environment variable to choose which
one:

if os.environ.get( "USENEWMODU LE") == "yes":
from newwhatever import *
else:
from oldwhatever import *

Or, you could set a flag in some sort of configuration module and
check that:

import config
if config.use_new_ module:
from newwhatever import *
else
from oldwhatever import *
Carl Banks
Jun 27 '08 #6
On Jun 4, 3:44 am, Ivan Illarionov <ivan.illario.. .@gmail.comwrot e:
On Wed, 04 Jun 2008 00:25:19 -0700, Jesse Aldridge wrote:
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on the
module to keep working while I'm making my changes. What's the best way
to accomplish this?

Version control system.

http://en.wikipedia.org/wiki/List_of...ntrol_software

Make your module a versioned repository.
Make your changes in different place, then commit them.
That doesn't seem like a good solution for the OP's particular
problem. To do it in a "different place", as you say, he'd have to
check out a new working copy, which might be a bit of overkill
depending on the size of the project. It could also be problematic to
have separate working copies; there could be programs outside the
project that are configured to use a certain location, for instance.

One thing you could do with some version control systems is to switch
the particular version for the module in question between different
branches depending on whether you're using the tools or changing the
model. (Subversion can do this, but I'm not sure if it's for
individual files or only directories.)
Carl Banks
Jun 27 '08 #7
Jesse Aldridge <Je***********@ gmail.comwrites :
I've got a module that I use regularly. I want to make some extensive
changes to this module but I want all of the programs that depend on
the module to keep working while I'm making my changes. What's the
best way to accomplish this?
Do you mean you want to hot-patch a running program? The short answer
is: don't.
Jun 27 '08 #8
On Jun 4, 4:44*am, Ivan Illarionov <ivan.illario.. .@gmail.comwrot e:
On Wed, 04 Jun 2008 00:25:19 -0700, Jesse Aldridge wrote:
I've got a module that I use regularly. *I want to make some extensive
changes to this module but I want all of the programs that depend on the
module to keep working while I'm making my changes. *What's the best way
to accomplish this?

Version control system.

http://en.wikipedia.org/wiki/List_of...ntrol_software

Make your module a versioned repository.
Make your changes in different place, then commit them.

I use SVN and mercurial.

Ivan
Also:

http://en.wikipedia.org/wiki/Regression_test
http://en.wikipedia.org/wiki/Design_by_contract
http://en.wikipedia.org/wiki/Test-driven_development
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

131
21637
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately get some good real world examples. Fire away! :) Regards, Peter Foti
16
3020
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
29
2233
by: pmatos | last post by:
Hi all, Sometimes I have a function which creates an object and returns it. Some are sets, other vectors but that's not very important. In these cases I do something like this: vector<int> * f() { vector<int> * v = new vector<int>; return v; }
136
9312
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
22
8002
by: stevenkobes | last post by:
If a word has a hyphen in it, IE will permit a line break at the hyphen, but Firefox/Mozilla won't. Apparently the Firefox behavior is standards-compliant, but it is not what I want. Is there a way to denote a hyphen in HTML, that the line can be broken after? I've read some stuff about soft hyphens and non-breaking hyphens, but those seem like the opposite of what I'm looking for. I want a normal hyphen, that always appears, and I...
19
3211
by: Johnny Google | last post by:
Here is an example of the type of data from a file I will have: Apple,4322,3435,4653,6543,4652 Banana,6934,5423,6753,6531 Carrot,3454,4534,3434,1111,9120,5453 Cheese,4411,5522,6622,6641 The first position is the info (the product) I want to retreive for the corresponding code. Assuming that the codes are unique for each product and all code data is on one line.
7
1770
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the problem is with this code, it just simply won't work properly. Some of the functions aren't done, but the main one gives me a Not a Number message in the text box where the calculations are supposed to come up. I tried to use a parseInt on my stuff,...
9
3184
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will load with different data (locations, departments, etc.).
7
2855
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hello, I have an issue with some code I am updating: An entire file is loaded into a memory stream then that memory stream uses its WriteTo method to write to the responses output stream. With larger files (250 mb) I get a system out of memory exception because the whole file is loaded into RAM. I need to modify this so the file is buffered into the output stream (maybe
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8382
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8586
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.