A few years ago I read an article about a neat way to analyze a large code-base.
The idea was to zoom out so far that patterns of indentation and block length are all that is really visible.
The author wrote about printing out code with very small fonts and looking at the results from 10 feet back. I believe the author also had some to...
You've worked somewhere for 3 years.
At the beginning of the second year you were involved in what you thought would be a small project.
You foolishly decided to take some risks with the choice of tools, you got slightly out of your depth, you ended up writing some nasty hacky code in the end as delays kicked in.
The client loved it, y...
function one(R) {
# do some thing..
$.ajax({
'url': '/one?search=' + R.val(),
#some thing common here
}
function two(R) {
# do some thing..
$.ajax({
'url': '/two?search=' + R.val(),
#some thing common here
}
well, since I'm just doing jQuery, but I guess this can get improve, refactor?
...
I have two windows in my WPF app: a login window and an options window. Both have the same form with a user name and password field, as well as some other fields for providing credentials. I want some code that knows there will be a txt_userName TextBox available, for example, and can do things based on that. I was thinking I could m...
I have a very large website that I need to refactor the front-end of due to maintainabilty concerns and performance issues:
Whats tricky:
Lots of overcomplicated scripts
Over-complicated CSS with a whopping filesize
No selenium tests in place
No js tests in place
Back end developers concerned anything breaking
The site has been live f...
I am using IKVM to compile a large Java library project to a .NET DLL. In so doing, however, the method names are staying according to the Java convention of method names NOT being capitalized - but I want the .NET dll to be used in .NET projects and so would like the method names to be capitalized.
The only exception would be methods w...
I have implemented a very simple method:
private String getProfileName(String path) {
String testPath = null;
for (int i = 0; i < path.length(); i++) {
testPath = path.substring(0, i);
if ( testPath.endsWith("1") || testPath.endsWith("2") || testPath.endsWith("3") || testPath.endsWith("4") || testPath.endsWith("...
I defined this simple method:
public static boolean isBorder(int x, int y) throws CollisionDetectionException {
try {
if ( (levelItems[x][y] instanceof StaticGameObject && levelItems[x][y].isVisible()) ||
(levelItems[x-1][y] instanceof StaticGameObject && levelItems[x-1][y].isVisible()) ||
...
I'm not thinking too clearly right now and possibly overlooking something simple. I've been thinking about this for a while and been searching, but can't really think of any sensible search queries anymore that would lead me to what i seek.
In short, I'm wondering how to do module inheritance, in the way base.pm/parent.pm do it for obje...
(I develop using JAVA and want to implement plugin in eclipse which can detect code smell and automate refactoring)
1) Initialy, I would like to find a smell detector library in order to get the smell existing in the class. I installed PMD plugin in Eclipse and try using it.
I want to get all information which is represented in a views ...
Hi,
I have a function which is processing rows from an excel file.In this function,I have a for loop.Now,once a row is extracted,we check for various conditions.If any condition is false,we continue with next row.Can this code be made more structured using a pattern?
foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
...
Ok, I'm not trying to start a flame war here, and I know the argument between static and dynamic languages has been hashed out many times, including here. But I have a very practical question that hopefully someone here can shed some light on. Sorry for the length, but this is not a simple question with probably not a simple answer.
Rub...
I have an old untyped class pre Java1.5 and need to refactor it using Java Generics to get more type security in the code.
Old Code looks like this:
class Foo {
void setInput(Object input) {...}
}
Now this input could be some object but it may also be an array, nasty stuff. Making a generic version of it seems not to be trivial, I...
I have to build a query based on certain conditions. Is there a better way of doing it than the way I have done below? It works fine but I can see it getting out of hand fairly quickly if there were more conditions since I check if any previous conditions had been met every time I check a new one.
$sql = "SELECT DISTINCT fkRespond...
I currently have a cache implementation (using arrays) for the heavy computations performed during the simulation. The structure of the cache is as follows:
The way it works:
CalculationsAbstract calculationsCache = new CalculationsCache();
// Constructor of CalculationsCache
public CalculationsCache()
{
this.Proxy = new Calculat...
It is possible to implement the refactoring by using Eclipse library (JDT,LTK) without involving of the wizards. I would like to get benefit from refactoring feature of eclipse but I wan't to provide input for refactoring by other ways (that is not entering in the wizard) such as reading from file, etc.
If possible , Please suggest me h...
Hi all,
Considering a hypothetical situation where an old, legacy presentation library has been maintained over the years, and has gradually had more and more business logic coded into it through a process of hasty corrections and lack of proper architectural oversight. Alternatively, consider a business class or namespace that is not s...
I have a class that looks like this:
class Base < Library
prelude "some-value" # from Library
def foo; ...; end
prelude "some-other-value" # from Library
def bar; ...; end
# ... others
end
I'd like to refactor it into something like the following:
class Base < Library
# what goes here to bring FooSupport and Bar...
Sorry I dont know how to add a comment with the format, so I post another question with code here, as I am new to python, seems that there are many better ways to reorgnize the codes to make it better:
def min_qvalue(self):
s = 0
q = 1
for i in range(len(self.results)):
if self.results[i].score > s:
s = s...
I have a data structure like this:
items = [
['Schools', '', '', '32'],
['Schools', 'Primary schools', '', '16'],
['Schools', 'Secondary schools', '', '16'],
['Schools', 'Secondary schools', 'Special ed', '8'],
['Schools', 'Secondary schools', 'Non-special ed', '8'],
]
It's a list of spending items. Some are aggreg...