Where can I learn to refactor code? [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Where can I learn to refactor code?

Books.
See http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&s=books&qid=1279262199&sr=1-1

You can learn on the job by using a refactoring tool such as Resharper and asking yourself, why is it suggesting this change? It will show you places where you can make your code simpler as well as which code is not being used any where. One you have taken this first step, it is easier to see what your code is doing and then you can perform your manual refactoring as suggested by the other answers.

Refactoring - C# Tutorials | Dream.In.Code
http://www.dreamincode.net/forums/topic/77242-refactoring/
C# 2.0 Code Refactoring
http://www.premier-club.com/codemag/Article/20143

See Martin Fowler's material: http://www.refactoring.com/
His articles are very good, recommended to anybody who wishes to learn beyond the basics
of just writing code.
Robert Martin's blogs (Uncle Bob) are also excellent.
In practise, choose any IDE which supports common refactoring like Eclipse or IntelliJ (latter is my favorite). But it's just a tool -- it helps to learn what are the reasons why a piece of code should be refactored and how.

Fowler's book is a good place to begin, but before doing any refactoring you should make sure you have automated tests for your code. Refactoring without tests is risky at best.
Visual Studio supports the most common refactoring operations, but you may also want to take a look at Resharper, which adds additional tools.

Head over to LosTechies and have a look at the ebook 31 days of refactoring, its an easy way to start.
Then as others here have said, read Fowler's book when you have the time.

Related

Good Implementation of Aspect oriented Programming reference required [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have been reading about (AOP) Aspect Oriented Programming and I could not find any good article on internet with its implementation in C#. Everyone are talking about AOP Frameworks.
The code the described in below reference is not working at all.
http://www.codeproject.com/Articles/11387/Aspect-oriented-programming-in-NET-Part-II
Can someone share any good implementation code on aspect oriented programming?
Or Else suggest a good AOP Framework to be implemented easily?
As, we are in need to implement AOP in our Project for logging printing and sending mails on completion of specific operations.
Have a look at PostSharp. It is a framework for AOP in .NET that is widely used. In contrast to other frameworks, it uses an approach that weaves the generated code into the intermediate language which is good for performance reasons.
On the website there are also lots of resources about AOP in general and how it can be used. There also is a free edition and a trial version.
However, if you need to only decorate some small portions of your code, using the Decorator pattern or something similar might also be an option.
http://www.codeproject.com/Tips/624586/Introducing-the-KingAOP-Framework-Part-1 seems to fit your need (I've not yet tested it though)

Useful Visual Studio Extensions For New C# Developer? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm new to developing in C# in Visual Studio. While I realize that this question might be a bit subjective, still, what are the most useful extensions out there for a new C# developer using Visual Studio 2012? When I say useful, I mean tools that could guide me to writing better code, point out potential bugs, auto-correct, etc. Tools that would allow me to write better and clearer code while adhering to the style and naming conventions of C#.
As I grow as a C# developer, I feel that I would probably start getting irritated with such auto-correcting tools, but right now it would be really useful. I downloaded Resharper and that seems to be pretty cool and does what I'm talking about. I have also looked at other extensions in the Visual Studio Gallery, but there are so many and it becomes a bit overwhelming.
Any help would be greatly appreciated!
thanks,
Justin
I recently fell in love with Flow.
Apart from that some people would suggest Resharper while others don't. I belong to the first category.
First : Resharper from JetBrains, (paid) this tool totally increase coding speed and are simply comfortable. If you're familiar with InteliJ or PyCharm - you'll feel like home.
Second : I recommend using Productivity Power Tools from Microsoft.
And for manage packages and libraries NuGet

Is there a Model Checking software (like Java Path Finder) but for C#? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
<EDIT>
About this question being off-topic and too opinion-based, I'll try to be more clear. My goal was to undestand if such a tool existed, I was not interested in opinions about what was the best one. At the time I wrote this question I spent quite a good amount of time searching the internet and found just old dead projects but such a tool for java existed and I couldn't belive there were nothing for c#.
I think this question is related to programming (code verification), and it is not really asking for an opinion. Also, it's still not easy to find this information and I think my answer could help saving someone's time.
That said, I'm not an expert of stackoverflow, if you still think the question/answer does not fit the site feel free to delete it.
</EDIT>
I've found Moonwalker http://fmt.cs.utwente.nl/tools/moonwalker/ but the last update has been done in 2009 and i don't think it supports .net4.5 (and it's poorly documented).
The answer to this question propose CodeContracts as a model checking tool Model checking tool c# but I've tried using it and I don't think it really is a model checker, not in the same way Java Path Finder for Java is. Im i worng? Can it be used like JPF?
I need to be able to known if a certain part of code is designed in a way that can deadlock. Let's say it's a school thing and even if I'm sure my code is working I must model check it. (Yes we are allowed and encouraged to look on the internet).
As the user #HighCore said, and after lot of searching i can say that a mature and up-to-date tool like the one I described does not exist.
Model checking refers usually to explicit methods, however symbolic methods are equally advanced and arguably more capable for establishing properties of actual code.
For a Turing complete language, the verification problem is undecidable, so model-checking tools usually accept a less powerful language as input. This implies having to convert your problem to that language, before checking. This is why you have not come across any "C# model checking tool".
Have you looked at Boogie and the C#-like Dafny ? These are (essentially) for annotating with Hoare logic.
Alternatively, you can consider model checking your C# solution after (manually) translating it to Promela, then using SPIN.
Related tools (e.g. C-to-Promela translators) are listed here.

C# code arrangement tool recommendations [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have been looking for a great code arrangement tool for c#. It would be nice to have something that can arrange code into regions etc and put items into alphabetical order.
I have tried NArrange and while it works well it is a little clunky in the integration department and did give us issues mixing up xml comments.
Any recommendations free > paid would be fantastic.
Thanks.
Not free(sorry), but take a look to Resharper.
Have a look at regionerate
I use fxCop along with the r# plugin and find it pretty ok
What is the benefit of ordering methods alphabetically? Shouldn't they rather be ordered logically according to the problem they solve. Generally I believe that if you have so many methods in a class/file that you think it makes sense to order them alphabetically your model is wrong, and it would be more beneficial to split your code in more classes/files.
With regards to regions, I have a hard time seeing what the benefit is. I recommend that you read Jeff Atwood's (CTO of stackoverflow) blog post on regions.

Tool recommendation for converting VB to C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
We have a project with over 500,000 lines of VB.NET that we need to convert to C#. Any recommendations, based on experience, for tools to use? We are using Visual Studio 2008 and we're targeting 3.5 .
I would concur with the comment. You have 500,000 lines of tried and true VB.NET code. Why on earth would you waste any time changing that? No one says that you can't write all new components in C#.
I would consider not worrying about a tool and instead ask yourself, truly, why you are doing this?
Reflector will decompile the IL and produce C# for you, it will be rough, but a decent start.
Did this eval a while back. You will find a lot of "free" solutions that are horrible at edge cases. This commercial product http://www.tangiblesoftwaresolutions.com is by no means perfect; but, was the best we could find at the time doing real conversion tests. Note: I am speaking only as a customer. If someone has found a solution that in real-world use produces better conversions than this, please let me know.
SharpDevelop has a converter built-in IIRC.
The converter from Telerik works well.
http://converter.telerik.com/
http://converter.telerik.com/batch.aspx
There used to be an add-in to Reflector which creates a complete Visual Studio solution. However, I don't know if it's still available or working, now that Red Gate has taken over Reflector.
I've used this site for a while now for some of my smaller conversions. It has been quite reliable.
According to the site, their converter is based off an open source IDE that has the converter built in, so you might try the "source site" as well.

Categories