Hello, I work for myself, I am a self-employed coder and as a result I don't have the luxury of code reviews or the ability to improve based upon peer programming. I am going to use this as an exercise to see if the StackOverflow community might help to review a simple method which i've written;
internal static DateTime CONVERT_To_D...
Warning: Noob here.
I know this is a trivial subject but I'm having a lot of difficulty in figuring out how exactly I can simplify my views by moving parts of them into helpers. For example, I've always read that conditionals in your views are prime candidates for extraction into helpers, but I couldn't really find examples of this, and...
Hello Folks
I have a class ImageA, and a class ImageB. The both classes represents an image in my app, but each one in a different way. Even being different, their constructors are equal, and both have the method compare.
So, what I done was creating a class Image, and ImageA and ImageB are subClasses of Image.
public abstract class I...
Hi folks,
I have the following sql statement, which works perfectly fine. I was hoping to see how this could be refactored so it doesn't require the use of RANK/PARTITION ... if possible.
SELECT LogEntryId, FileId, CreatedOn, EventTypeId
FROM (SELECT a.LogEntryId, a.FileId, a.CreatedOn, a.EventTypeId,
RANK() OVER (PARTITION B...
There are many tools that we can use to show the dependencies between modules, source code files, classes, or functions etc. But there seems no tool for analyzing the dependencies between variables. Given a dependency graph of variables would be helpful for understanding and refactoring the code.
For example, if variable b is only used ...
Hi
From Uncle Bob's book Clean Code (example was in Java, so this was my first java translation), I've been playing with the refactoring example on prime numbers.
The question is: How would you refactor the following code?
There are 4 versions here: UglyVersion :-) , BobVersion, PeteVersion, PeteVersionClassMember. I'm doing th...
I have a base collection class and a child collection class, each of which are serializable. In a test, I discovered that simply having the child class's ReadXml method call base.ReadXml resulted in an InvalidCastException later on. First, here's the class structure:
Base Class
// Collection of Row objects
[Serializable]
[XmlRoot("Ro...
Hi all,
Here's my javascript code:
<script type="text/javascript">
$(document).ready(function() {
var currentInput = '';
var currentLabel = '';
$("#userLookup").click(function() {
var url = "<%= Url.Action( "ListAll" , "User") %>";
currentInput = $("#User");
currentLabel...
Or in more specific words, is it "ok" to not be relying on setters and getters?
I'm dealing with a class that checks the availability of rooms and sets public properties of which there are more than a dozen. Things such as:
unitNumber
roomTypes ( array )
codeCorporate
codeGroup
numberKids
numberAdults
numberRooms
currency
minRate
maxR...
When I ran the Inline and Extract Local Variable refactorings, Eclipse saved my file immediately after. Also, Undoing/Redoing these refactorings resaved the file each time. How can I disable this behavior?
Secondary question: Running Extract Method didn’t automatically save the file. Why the inconsistent behavior?
...
I have some code that is written in french, that is the variables, class, function all have french names. The comments are also in french. I'd like to translate the code to english. This will be quite a challenge, since it's a 18K lines project and I'd like to know if there is any tool that could help me, especially with the variables/cl...
When a simple refactoring like “rename field” has been done on one branch it can be very hard to merge the changes into the other branches. (Extract method is much harder as the merge tools don’t seem to match the unchanged blocks well)
Now in my dreams, I am thinking of a tool that can record (or work out) what well defined refactorin...
MolhadoRef is a refactoring-aware SCM
tool that is capable of capturing and
versioning of the semantics of Java
program entities and refactoring
operations that were performed on
those entities.
Does anyone know of such a system in the .NET universe?
(Why is it that .NET always seems to be way behind java with the type of ...
Basically I have a class that sends a SOAP request for room information receives a response, it can only handle one room at a time.. eg:
class roomParser {
private $numRooms;
private $adults;
private $dailyPrice;
public function parse(){}
public function send(){}
};
$room = new roomParser( $arrival, $departue );
$...
All the refactoring tools for C# and VB.Net that I have seen only consider the source code in a single visual studio solution.
For better or worse, our large (many related programs) system is spread over many solution files, however:
All the code is below a single windows folder.
Our nAnt based build system, builds all files in a win...
We have lots of WCF services that are only used by our own code; the code that uses them is mostly in the same solutions files that contains the services.
However they do not use a shared assembly for the contracts, so each time a data contract is change the reference to the service has to be updated by hand in all projects that use the...
I'm interested in what strategies people have come up with for separating all the crufty logic that's necessary to maintain backwards compatibility from the main code of an application. In other words, strategies that let you come closer to having your code look as if there were no backwards compatibility concerns except for separate iso...
I'm re-factoring a semi-successful Rails-based event registration and pledging system for a particular fundraising event for a non-profit.
The existing data structure is rather ungainly, though it captures all necessary details and relationships. I would plan to refactor this in any case, but since I've also been asked to allow for mul...
Looking for opinions on this:
I have broken out various responsibilities into separate objects. However, many of these objects have dependencies on each other. All of these objects are adhering to interfaces so I'm not tied to an implementation. I'm concerned about the dependencies between objects and the potential for circular depen...
Ok so after reading danben's answer on this post, I guess I'm convinced of the need for writting this kind of code, atleast in a lot of cases. My managers seem to be agreeing too.
if (log.IsDebugEnabled)
log.Debug("ZDRCreatorConfig("+rootelem.ToString()+")");
if (log.IsInfoEnabled)
log.Info("Reading Configuration . . .");
T...