I understand the differences between a multithreaded program and a program relying on inter-machine communication. My problem is that I have a nice multithreaded program written in 'C' that works and runs really well on an 8-core machine. There is now opportunity to port this program to a cluster to gain access to more cores. Is it wo...
We have all heard of Premature Optimization, but what do you thing about Premature Refactoring? Is there any such thing in your opinion? Here is what I am getting at.
First off, reading Martin Fowler's seminal work "Refactoring" quite literally changed my life in regards to programing.
One thing that I have noticed, however, is that i...
I am looking for experience/tools to improve refactoring techniques using VS Studio 2005/2008.
Currently I only use standard refactor menu choices:
Rename...
Extract Method...
Encapsulate Field...
...
The IT department I work in as a programmer revolves around a 30+ year old code base (Fortran and C). The code is in a poor condition partially as a result of 30+ years of ad-hoc poorly thought out changes but I also suspect a lot of it has to do with the capabilities of the programmers who made the changes (and who incidentally are stil...
I have the following snippet of Javascript, which is just attaching an onclick to a button and then updating the text of an em tag underneath it. I'm slowly trying to educate myself and work with jQuery more as I've found to like the syntax a lot more and for some tasks, it's more of a pleasure to work with.
Some of the best examples I...
I've inherited a project where the class diagrams closely resemble a spider web on a plate of spaghetti. I've written about 300 unit tests in the past two months to give myself a safety net covering the main executable.
I have my library of agile development books within reach at any given moment:
Working Effectively with Legacy Code
...
We have an existing "legacy" app written in C++/powerbuilder running on Unix with it's own Sybase databases. For complex organizational(existing apps have to go through lot of red-tape to be modified) and code reasons(no re-factoring has been done in yrs so the code is spaghetti), so it's difficult to get modifications done to this appl...
How would you refactor something like this?
protected void btnAdd_Click(object sender, EventArgs e)
{
try
{
string username = txtUsername.Text.Trim().ToLower();
string password = txtPassword.Text.Trim().ToLower();
string email = txtEmail.Text.Trim().ToLower();
string status = ddlStatus.SelectedVal...
I'm Currently reading two excellent books "Working Effectively with Legacy Code" and "Clean Code".
They are making me think about the way I write and work with code in completely new ways but one theme that is common among them is test driven development and the idea of smothering everything with tests and having tests in place before ...
Suppose you're working in a language with variable length arrays (e.g. with A[i] for all i in 1..A.length) and have to write a routine that takes n (n : 1..8) variable length arrays of items in a variable length array of length n, and needs to call a procedure with every possible length n array of items where the first is chosen from the...
I try to refactor such XAML by introducing new user control:
<Window ...>
<ComboBox ItemsSource="{Binding Greetings}" />
</Window>
After adding a control I have
ControlA XAML:
<UserControl ...>
<ComboBox ItemsSource="{Binding Items}" />
</UserControl>
ControlA C#:
public static readonly DependencyProperty ItemsProperty =
Wp...
I now have to refactor some code, it's basically one method(its around 1000 lines of code) that does a lot of calculations and have a lot of variables. I'm not sure how to refactor it.
Does code like
...
calculateSth(param1,param2,param3,param4,param5, params6);
calculateSthElse(param1,param2,param3);
...
look good?
I could introduc...
I've been refactoring Media Browser and have started to define a proper inheritance model for our domain objects
so I have
BaseItem
-> Video
--> <Need a name for this>
---> Episode
---> Movie
-> Folder
--> Season
Essentially tv show episodes and movies have some attributes in common (like actor or director listings) so I need a name...
Hello all,
I have heard that you can run an ASP.NET application and ASP.NET mvc application side by side so that you can port existing code over one piece at a time. I was wondering if you could do this with a java framework?
I have a legacy servlet application that I am currently in the process of refactoring. I am thinking about turn...
I have a large Eclipse project in which there exist several classes which, although they ceased to be used anywhere, were never marked @Deprecated.
How can I easily find all of these?
...
I have a database in which the main table has a really badly named primary key field which I want to rename. This primary key field is referenced by about 20 other tables and about 15 stored procedures.
What is the easiest way to rename this field everywhere it is referenced throughout the database?
...
Hello.
Recently, I have identified very strong code smell in one of the project, I'm working for.
Especially, in its cost counting feature. To count the total cost for some operation, we have to pass many kind of information to the "parser class".
For example:
phone numbers
selected campaigns
selected templates
selected contac...
The current project I inherited mainly revolves around one unnormalized table. There are some attempts at normalization but the necessary constraints weren't put in place.
Example: In the Project table, there is a client name (among other values) and there is also a clients table which just contains client names [no keys anywhere]. T...
I'm interested mostly in C++ and method/class name/signature automatic changes.
...
I have two interrupt service routines (ISR) which basically do the exact same
thing but each handles an interrupt from a different device (although the same type of device). Therefore, the logic is the same but they access different CPU registers and memory locations.
As a simple example consider the following code:
extern volatile uns...