Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
General guidelines on how to design classes with best known industry practices.
2
votes
Accepted
c# class generation/architecture for json rest service
I think you have two options here.
Best practice. Create objects which match the json returned by/sent to the API and serialize/deserialze these objects when you make calls or receive responses. Hid …
-1
votes
Is it a good idea to put in a bunch of static functions that are related to each other in te...
No it not a great idea. You have some very specific requirements and if this fits your needs then great.
But generally making a class called SomethingHelper and putting a bunch of static methods in i …
2
votes
How should an `Employee` class be designed?
First create an employee struct containing the properties of the conceptual employee.
Then create a database with matching table structure, say for example mssql
Then create a employee repository Fo …
1
vote
Accepted
Proper event driven design when a consumer subscribes to many producers
2 is the mediator pattern.
You can get around the tight coupling by:
Injecting a IMediator interface with just 'publish' and 'listen'
By using a factory method to create the buttons and wire up th …
5
votes
Accepted
How to store objects with inconsistant properties
Don't try to make objects that simulate real world equivalents
Make objects that hold data that goes with their methods
In your materials example, you don't actually say what the data is used for.
…
0
votes
Is "declaring most abstract type" suffers from the same problem as "primitive obsession"?
No.
Using Age instead of int for age makes sense because you want to have extra stuff on your age object that can be useful eg.
public class Age
{
TimeSpan AgeAsTimeSpan() ...
Validate() ... / …
0
votes
Class design for writing multiple versions of multiple files
I think the answer will depend on what you are trying to achieve other than writing files.
Lets leave out the POJOs for the moment, you read data from a DB and write it out to a specific file format …
0
votes
Should methods be part of your persisted entities?
Lets coin some terms.
If you put your methods on the same object as your data then you are doing classic Object Orientated Programming (OOP). If you have no methods on your data objects and instead p …
7
votes
Accepted
Is a callback function with `this` as an argument a bad practice?
No I think it's fairly common for events to pass the object raising the event and the event arguments to a handler.
I've seen it said that this is so events can be bubbled up through several handlers …
3
votes
Is a class with a high number of member variables bad and is there a design structure for da...
It's unusual for a single object to have 50 variables that wouldn't be better grouped into sub objects.
For example a UK address has 14 fields. You could imagine that an address class that covered ad …
1
vote
Eliminating cyclic dependency
I would remove the Dependency of IUserPublishedInfoInitializer on IDbRepository. Instead inject this as a construction parameter into the concrete UserPublishedInfoInitializer.
your dependency graph …
8
votes
Accepted
Is Abstracting your code too much a bad use of SOLID Principles?
I would side with your enemy on this one.
The 'create a database and table logic' is clearly technically a separate responsibility from the 'get data from database' logic.
You can imagine the creati …
7
votes
Why are classes named "class"?
Just did some googling and it seems the terms were invented by Ole-Johan Dahl and Kristen Nygaard for their Simula programming language
We chose the terms “class” and “objects” of classes for our …
-1
votes
How to model workflows
Security is a "Cross Cutting" requirement. You shouldn't code it into your classes with the rest of the business logic.
Map out your data model
create services with the methods you need for your bus …
17
votes
Accepted
Can renaming a method preserve encapsulation?
I think you are missing the point. Its not saying you should rename the setter and getter, but to have methods which add and remove items from the fridge. ie
public class Fridge
{
private int num …