Suppose I have the two following Linq queries I want to refactor:
var someValue1 = 0;
var someValue2= 0;
var query1 = db.TableAs.Where( a => a.TableBs.Count() > someValue1 )
.Take( 10 );
var query2 = db.TableAs.Where( a => a.TableBs.First().item1 == someValue2)
.Take( 10 );
Note that only the Where ...
My question vaguely relates to this one. However, it doesn't address the techniques or practices.
I am reading The Pragmatic Programmer and it strongly advocates refactoring code as often as you can. However, it doesn't go into detail about how to do that and how often. How do you guys go about refactoring your code, and how often do y...
Regarding the php code smell detector at http://c2.com/cgi/wiki?DetectingCodeSmellsInPhp
When I open it in my web browser, I get an error, but when I open it in my IDE, I don't.
How to correct it?
...
Read before downvoting or closing: This almost exact duplicate of a previous question of mine exists with the solely purpose to rephrase the previous question to the Linq-To-Sql scope. All answers contained in the previous question are valid for the Linq scope, but are invalid in the Linq-To-SQL scope.
Suppose I have the two following L...
I'm looking for Collaborative RegEx website or software, where one can submit several cases of "match" and "shouldn't match" then other might refactor the regex. Like refactormycode.com but with a RegEx twist. And this way it's possible to see which code performs faster and is actually correct based on the given match tests.
This can be...
The code bellow is the small starting point for a new way ( for me ) of writing and managing code. Before I loose several weeks and probably state at the end that yes it was stupid idea I thought it would be better to "stress test it" here first.
So here is the idea. Each time there are dependencies of the type when Client ( Envoker) c...
I'm going to refactor certain parts in a huge code base (18000+ Java classes). Goal is to be able to extract lower layers as independent libraries to be reused in other projects that currently use duplicate of this code base. Especially one part is of interest to be refactored into a framework independent of business logic. Ultimately I ...
Hi
i am in middle of refactoring old asp.net code (some of it is from frontpage era) and am wanting to move all the references to the "$Resources:resources, ” from aspx pages to Page_Render in code behind file of each page.
Main purpose of this excersie is to support localization, as we have grown to other internaltional regions. Ther...
These are the options we have out of the box:
I would like a more fine grained sorting when it comes to methods. I would like to:
Have all methods with a name which does not start with get, is or set first.
Then have the accessor methods (with names starting with get, is or set).
Individually the methods in [1] and [2] above could...
To learn Doxygen, I created a branch and modified the
source file comments of a slow-moving project. However,
that project has since had large changes, splitting a
large file into several smaller files:
big_file.c -> big_file.c file_a.[ch] file_b.[ch]
I want to do the same on my branch. Obviously, I can
duplicate my branch's large_...
It seems to me that the most invaluable thing about a static/strongly-typed programming language is that it helps refactoring: if/when you change any API, then the compiler will tell you what that change has broken.
I can imagine writing code in a runtime/weakly-typed language ... but I can't imagine refactoring without the compiler's h...
I have a rather large (several MLOC) application at hand that I'd like to split up into more maintainable separate parts. Currently the product is comprised of about 40 Eclipse projects, many of them having inter-dependencies. This alone makes a continuous build system unfeasible, because it would have to rebuild very much with each chec...
Suppose you have a subsystem that does some kind of work. It could be anything. Obviously, at the entry point(s) to this subsystem there will be certain restrictions on the input. Suppose this subsystem is primarily called by a GUI. The subsystem needs to check all the input it recieves to make sure it's valid. We wouldn't want to FireTh...
I have a bunch of Forms that I embed in tabpages(some are embedded two and three layers deep) that I now suspect are giving me trouble. I have been told that User Control's are the better approach.
Now I am wondering how I
canaccomplish this as quick as
possible.
Is it as simple as copy and paste?
Has anyone ever done something like...
I'm starting on a fresh new project--should I look at my spec and decide which design patterns to apply, or just come up with a general idea of organization and allow the patterns to emerge organically through refactoring?
In your experience, which technique will be most productive and have a greater chance of leading to clean elegant c...
Hi,
I'm looking for the simplest (and most complete) mechanism to move a class from one to another assembly with reference (dependency) fixing capability.I know some manual ways to do that like :
- use built-in move rename, then cutpaste, multiple save ...
- use resharper rename namespace, cutpaste , the same as above
but with the ...
In virtually every project I've ever worked on, there will be one or two classes with the following properties:
Extremely large with many many members and methods.
Many other classes inheriting from this class.
Many other classes otherwise depending on this class.
Bad design, you might say. But in all cases, this wasn't the case at ...
In a fit of unoriginality, I'm writing a blog application using Ruby on Rails. My PostsController contains some code that ensures that the logged in user can only edit or delete their own posts.
I tried factoring this code out into a private method with a single argument for the flash message to display, but when I did this and tested i...
I have a project that is currently all over the place and i'm thinking of making it MVC.
The problem is that the system is currently being used and I can not change the interface (It's in frames :s) Also there are certain things that I will need to handle myself such as password generation, login and user levels.
I already have the mod...
I'm doing a bit of coding, where I have to write this sort of code:
if( array[i]==false )
array[i]=true;
I wonder if it should be re-written as
array[i]=true;
This raises the question: are comparisions faster than assignments?
What about differences from language to language? (contrast between java & cpp, eg.)
NOTE: I've hear...