I'm extracting an interface that I would like to retain the original name. The actual class will get a "Impl" suffix, in accordance with our naming conventions. I want to know how to best reflect that in subversion so that the history "AppPropertiesImpl.java" covers its life as "AppProperties.java". As for the new "AppProperties.java", I...
I am trying to understand if I really have any case for using git/mercurial.
The projects I work are java and c# projects, usually with 5-20 people working towards
a common goal (the "release"). Most of the developers are professional developers who
refactor code all of the time. So where the typical linux kernel has a large number of
...
Hi,
I want to refactor this mumbo jumbo of a method to make it more readible, it has way to many nested IF's for my liking.
How would you refactor this?
public static void HandleUploadedFile(string filename)
{
try
{
if(IsValidFileFormat(filename)
{
int folderID = GetFolderIDFromFilename(filename);
if(folderID >...
I am trying to combine some of my CSS and it is kind of an easy questions but I am kind of having some trouble, i have this code:
h2.post-title, h2.post-title a{
display:block;
background-color:#000;
padding:3px;
color:#ffffff;
text-decoration:none;
text-transform:uppercase;
font:lighter 130% Georgia, Arial;
...
When do you know it's time to refactor/review some piece of code ? And better yet, when do you do it?
Probably like others, I've found myself knowing that something needs a refactor/review but deadlines and management left no time for that. I'd also like to hear how you include code review in the general development process.
Lately I'v...
I'm refactoring some client-server code and it uses the terms Response, Result & Reply for the same thing (an answer from the server). And although its not really that important it's become hard to guess which word to use while writing new code, so I'd like to unify the three terms into one and do the appropriate refactoring, but I'm not...
I know there is re-sharper for Visual Studio, but is there a really good refactoring tool for Eclipse that is better than the small amount of built in refactors?
Preferably something free.
(Update)
Looking to do things like take all string literals in a file and make them constants.
Solve lots of PMD errors in some automated fashion.
...
I've got an application that just shipped. Since I wrote it, I've learned about amfphp and propel. Both would be 'nice' to be used in the application but I can't say that it would be required at this point.
What types of things do you consider before you refactor code?
G-Man
...
One for the mathematicians. This has gone around the office and we want to see who can come up with a better optimised version.
(((a+p) <= b) && (a == 0 || a > 1) && (b >= p)) &&
((b - (a + p) == 0) || (b - (a + p) > 1))
Edit: all data is positive int's
Edit: Better == refactored for simplicity
...
We have a web application that takes user inputs or database lookups to form some operations against some physical resources. The design can be simply presented as following diagram:
user input <=> model object <=> database storage
validations are needed with request coming from user input but NOT when coming from database lookup hits ...
Is there a way to tidy-up the following code, rather than a series of nested try/except statements?
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
try:
from django.utils import simplejson as json
except:
raise "Requires either simplejson...
I just refactored some code that was in a different section of the class I was working on because it was a series of nested conditional operators (?:) that was made a ton clearer by a fairly simple switch statement (C#).
When will you touch code that isn't directly what you are working on to make it more clear?
...
I wanted to see what folks thought were the best way to help junior members gain confidence in their ability to refactor code. I find that often junior developers simply follow the existing patterns and sense an aversion to break anything due to the perceived risk. I am trying to get them to look at the requirements (new and existing) ...
I have worked a bit with Django and I quite like its project/applications model : you can build a Django project by assembling one or more Django applications. These applications can be autonomous, or some applications can be built on top of other applications. An application can easily rely on another application's models, as well as ...
I have the current basic structure for each domain object that I need to create:
class Model_Company extends LP_Model
{
protected static $_gatewayName = 'Model_Table_Company';
protected static $_gateway;
protected static $_class;
public static function init()
{
if(self::$_gateway == null)
{
self::...
I have been used to do some refactorings by introducing compilation errors. For example, if I want to remove a field from my class and make it a parameter to some methods, I usually remove the field first, which causes a compilation error for the class. Then I would introduce the parameter to my methods, which would break callers. And so...
Sometimes its necessary to code in AS2 to target Flash Player 8, so we're forced to write within the Flash IDE.
Any refactoring tools / plugins available for Actionscript?...
Within or without the Flash IDE, that's no problem, as long as it builds for Flash Player 8, AS2.
...
Hi, I haven't used a statically typed language in many years and have set myself the task of getting up to speed with C#. I'm using my usual trick of following the fifteen exercises here http://www.jobsnake.com/seek/articles/index.cgi?openarticle&8533 as my first task.
I've just finished the second Fibonacci task which didn't take t...
Hi, I'm trying to learn some C# over the weekend and am following the 15 exercises found here: http://www.jobsnake.com/seek/articles/index.cgi?openarticle&8533
Yesterday I asked a similar question for the Fibonacci sequence and received some great responses which introduced me to elements of C# which I'd not encountered before:
htt...
I have inherited a project that has some huge switch statement blocks, some with 20 cases, what is a good way to rewrite these?
...