Create a superclass from multiple classes that have common members [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 9 years ago.
Improve this question
I've had this a number of times now. In longer running software projects two or three classes are totally different at the outset. However, as time goes by requirements change, users get a bit smarter, on rare occasions I even get a bit smarter and two seemingly different processes turn out to be very similar. As a consequence, code needs to be modified and these two or three classes end up looking too similar for comfort. They're just screaming to be inherited from a common superclass.
Now I'm an innate lazy guy (reason why I'm making software in the first place) and I'd love to have a tool that does the merging into a superclass for me. With Resharper I can create a superclass from one type.
Does anyone know of a tool that can do this trick with multiple classes, or otherwise some kind of comparison tool that presents commonalities between a number of classes?

There is no tool I know of that can take two or more classes and simply define commonalities.
The closest I have seen in refactoring tools would only operate on a single class and still require input from a programmer.
This is a complex thing to do automatically, so in my opinion a programmer is the best tool...

Related

ORM framework to legacy database without SQL support [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're going to start writing C# programs against a old legacy database from the early 1980s. There is no support for SQL or relationships, and communication with it is through Telnet commands.
I'm thinking of using some sort of ORM framework, or write my own. My question is if there is any good framework that is possible to easily adapt to these special conditions?
I want to be able to map the classes in my program against tables in the database and work with the database in a modern way, without having to think about the complex telnet commands and the translation of the returned information into something meaningful.
I find it hard to believe that such datasources have any usable adapters today. Think of what kind of operations you will need and construct an ORM with any commands you may require. Depending on structure and data this may vary in a lot of different ways. Some questions you may take along in this project are
Can we standardize CRUD operations or do we have to build a DTO api
Shall we be able to handle any binary data
What pattern shall we use in our C# code and will C# suffice
When it comes to DTO-Api's I like to implement CQRS (Command Query Responsibility Segregation, read this http://msdn.microsoft.com/en-us/library/jj591573.aspx). If you are constructing an ordinary CRUD-Api you will most likely have to separate your code differently and resolve each command type dynamically (if possible).
Feel free to e-mail me, you should be able to reach me in the corp-ad.

Tool determining class and method importance [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
When facing new code I often spend time to figure out which classes and methods constitute core functionality in contrary to just ambient stuff. If code adheres to well known architectural design, have visible structure, descriptive names, documentation, unit tests etc. then the task is easier. However that is not always the case. Sometimes the code is just a pasta and God knows what is going on there.
I believe that there are some algorithms that could be use in order to roughly categorize code parts so that the developer can see important things in a glance without manual processing.
For example:
In case of views and view models the tool could highlight bindings in the later so that the developer could see entry points.
Using of methods and classes occurs at some level of invocation chain. Some methods have the opportunity to be invoked only deeply in logic (low priority). Others are invoked directly from user action handlers (high priority).
Is there a tool that will be able to filter or highlight classes and methods in Visual Studio depenging on the code importance?
It could look like the follows:
Under importance I understand here that for example the Main method has high importance because it's a root of everything else. You can go from Main method to any other method in the code. MethodL2 has low importance because it is just a leaf. Calculation of leaves importance should be also derived from they parents importance. I mean that an importance in this meaning is not only about the level of depth or occurencies.

A good and complete tutorial about reflection in .NET? [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
the question almost says it all. I think all of you know about the visual studio designer, and how it can show any property of an object, regardless of its type, provided that the property is allowed to be shown in the designer.
I am working on a function that could achieve the same thing, but for this, I need a complete tutorial about reflection, so that this function can treat every type of property.
Any suggestions?
Here are some good links :
http://csharp.net-tutorials.com/reflection/introduction/
http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial
http://www.codeguru.com/csharp/csharp/cs_misc/reflection/article.php/c4257
http://www.youtube.com/watch?v=C-G7fobbBP0
Here some info:
http://www.codeproject.com/Articles/55710/Reflection-in-NET
CLR via C# by Jeffrey Richter has a good chapter on Reflection
However, I'd recommend a bit different although harder approach. If you really want to completely understand the topic, that's what you need.
Read Standard ECMA-335 Partition II: Metadata Definition and Semantics which explains how .NET uses its metadata
Then read and understand some code that reads this metadata. Mono.Cecil would be a good candidate.
That will completely cover the Reflection topic

Optimal language to develop with Unity? [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 would like to ask you all about the Unity framework and programming. Unity supports three different languages; Boo, C# and Unityscript. Say you were new to programming and developing on OS X.
What is the best language to learn and use alongside Unity to create games?
First of all, it's a matter of taste. All 3 languages are fully capable. It's also worth mentioning that performance-wise there is no significant difference.
So, which one? You'll have to choose for yourself.
Perhaps this would help:
C#:
pros:
well known, easy to find people who know it
strict (find mistakes during compile time)
usable code bits may be found online, even outside Unity's context
cons:
why so serious?
UnityScript (not really JavaScript):
pros:
easy to learn quickly
cons:
not strict (find mistakes late - only during run-time)
Boo:
pros:
beautiful syntax (pythonesquely clean)
strict (find mistakes during compile time)
cons:
not many people use it (so if you're hiring...)
For me, a web developer, Javascript was easiest to use. I use C# when I need to, but Javascript is fastest for me and I don't notice any performance hits.
You can check out this thread on the Unity forums for choosing a language to work with:
http://forum.unity3d.com/threads/18507-Boo-C-and-JavaScript-in-Unity-Experiences-and-Opinions

Aspect Oriented Programming in 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
Are there any good resources to wrap my head around Aspect Oriented Programming?
PS: I need to understand AO programming, not the libraries or frameworks available for .NET or C# :)
Just to get your head around it: It is the ability to hook events such as: creation of objects, setting of properties, etc, and attach general functions to them, that will be populated with relevant context.
Because C# doesn't have an inbuilt facility for this, you need a framework, like PostSharp, to do 'bytecode weaving' (i.e. just writing code to actually make the calls, directly to your classes) to simulate it.
check this out, it is describing how to implement AOP ( log, timing, tracing, exception handling...) using postsharp
http://www.codeproject.com/Articles/337564/Aspect-Oriented-Programming-Using-Csharp-and-PostS
Aspect Oriented Programming means having a meta level where yo can define logging or security/access control features to interweave with your code instead of implementing these feature very time in your code. So instead of beeing one-dimensional, you have to program two-dimensional.
I know this may sound very esotheric but it is easy once you understood it.
AOP often works with proxy classes which intercept calls and do things in the background.
A good link below, shows you how to code up an AOP framework of your own. Unfortunately, all of your consuming classes have to inherit from the MarshalByRefObject (through ContextBoundObject).
http://www.developerfusion.com/article/5307/aspect-oriented-programming-using-net/3/

Categories

Resources