I wonder if there is a way of writing a method or a class that would add to any method some code that is shared between many methods. The methods return different things and some of them are just void.
Below is a part of the code that is duplicated in the methods.
StartTimer(MethodBase.GetCurrentMethod().Name);
try
{
// Actual meth...
(the title is admittedly not that great. Please forgive my English, this is the best I could think of)
I'm writing a python script that will manage email domains and their accounts, and I'm also a newby at OOP design. My two (related?) issues are:
the Domain class must do special work to add and remove accounts, like adding/removing t...
I have to work with some code that isn't truly MVC (i.e., it doesn't use an explicit framework among other things). Right now we make do with servlets that pass data to services.
Here is my problem. I am receiving a post to a servlet that contains a whole bunch of address data that I have to save to the database. The data is (obviously)...
Hello everyone,
I have a question about DDD. I'm building a application to learn DDD and I have a question about layering. I have an application that works like this:
UI layer calls =>
Application Layer ->
Domain Layer ->
Database
Here is a small example of how the code looks:
//****************UI LAYER************************
//Us...
Hi All,
Here's an excerpt from a book I'm reading about application design with MVC:
Ideally, the view is so simple and
logic-free as to need virtually no
testing. Users (and developers before
users) can reasonably test the view by
simply looking at the pixels on the
screen. Anything else beyond pure
graphical renderin...
Hi,
In one of my projects, I have some classes that represent entities that cannot change once created, aka. immutable classes.
Example : A class RSAKey that represent a RSA key which only has const methods. There is no point changing the existing instance: if you need another one, you just create one.
My objects sometimes are heavy a...
GenoTipController must produce class according to the enum type. i have 3 class: _Company,_Muayene,_Radyoloji. Also i have CompanyView Class GetPersonel method. if you look GenoTipController my codes need refactoring. Can you understand me? i need a class according to ewnum type must me produce class. For example; case DataModelType.Rady...
Hi.
I want to do a fairly simple implementation of a chat app using rails. from a theoretical standpoint I feel that ajax streaming pattern should be the way to go. However I am not sure, how it works and what are the potential disadvantages of this pattern?
Is there anything better that I can use. My requirement is to have four people...
I am learning delegates.I am very curious to apply delegates to the following chain-of-responsibility pattern.
Kindly help me the way to apply delegates to the following piece.
Thanks in advance.Thanks for your effort.
#region Chain of Responsibility Pattern
namespace Chain
{
public class Player
{
public string Name { ...
I have this scenario in most of the WindowsForms having grids
I have a sequence of code which is similar -
AddNewRow(in grid),CreateNewEntity,notifyUser,few other steps
Now, I want to use a template kind of pattern.But,my issue is with CreateEntity method since sometimes it is passed a parameter which is different depending on the type o...
How do you handle dependencies between modules in Zend Framework to create reusable, drop-in modules?
E.g. I have Newsletter module, which allows users to subscribe, providing e-mail
address.
Next, I plan to add Blog module, which allows to subscribe to posts by e-mail (it obviously duplicates some functionality of the newsletter, but ...
Good evening everybody,
I'm currently trying to understand the intrinsics of iterators in various languages i.e. the way they are implemented.
For example, there is the following class exposing the list interface.
template<class T>
class List
{
public:
virtual void Insert( int beforeIndex, const T item ) throw( ListExceptio...
public class MyController
{
public object CreateByEnum(DataModelType modeltype)
{
string enumText = modeltype.ToString(); // will return for example "Company"
Type classType = Type.GetType(enumText); // the Type for Company class
object t = Activator.CreateInstance(classType); // ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EfTestFactory
{
public abstract class _Company
{
public abstract List<Personel> GetPersonel();
public abstract List<Prim> GetPrim();
public abstract List<Finans> GetFinans();
}
public abstract class _...
I was going through the 'Factory method' pages in SO and had come across this link.
And this comment. The example looked as a variant and thought to implement in its original way: to defer instantiation to subclasses...
Here is my attempt. Does the following code implements the Factory pattern of the example specified in the link? Pleas...
Hi all,
i have to build some financial data report, and for making the calculation, there are a lot of 'if then' situations: if it's a large client, subtract 10%, if it's postal code equals '10101', add 10%, if the day is on a saturday, make a difficult calculation etc.
so i once read about this kind of example, and what they did was (...
I've built an interpreter in C++ for a language created by me.
One main problem in the design was that I had two different types in the language: number and string. So I have to pass around a struct like:
class myInterpreterValue
{
myInterpreterType type;
int intValue;
string strValue;
}
Objects of this class are passed around mil...
Hi!
I've seen projects which use many screens each one for different layout and functionality.
I've seen projects with only one screen (like wizard workflow) where content is changed on user interaction (and this seems to be logical to use single screen in wizards).
But also I've seen projects (apps like game or messenger or phone s...
I am using Repository factory for visual studio 2008 for a personal project.
It generated a class called ProductRepository which inherits from Repository<Product>.
The ProductRepository has a constructor which gets a database name as string and passes it to its base (I mean Repository<Product> ).
When I try to debug my project step by s...
I have several Java classes which implement the strategy pattern. Each class has variable number parameters of different types:
interface Strategy {
public data execute(data);
}
class StrategyA implements Strategy {
public data execute(data);
}
class StrategyB implements Strategy {
public StrategyB(int paramA, int par...