Tagged Questions
0
votes
5answers
325 views
Liskov Substitution and SRP Principle violation - how best to structure this scenario?
While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe ...
2
votes
1answer
186 views
Any OOP design pattern that is somewhat representative of all of the SOLID OOP design principles at play?
I'm trying to teach an object oriented design principles course (on SOLID) at a training institute. I also want to teach the students a few OOP design patterns such as factory, singleton and one ...
19
votes
12answers
5k views
Why does void in C mean not void?
In strongly-typed languages like Java and C#, void (or Void) as a return type for a method seem to mean:
This method doesn't return anything. Nothing. No return. You will not receive anything from ...
2
votes
3answers
208 views
Decoupling software components via naming convention
I'm currently evaluating alternatives to refactor a drivermanagement.
In my multitier architecture I have
Baseclass
DAL.Device //my entity
Interfaces
BL.IDriver //handles the dataprocessing ...
1
vote
1answer
210 views
Implementation of instance testing in Java, C++, C#
For curiosity purposes as well as understanding what they entail in a program, I'm curious as to how instance testing (instanceof/is/using dynamic_cast in c++) works. I've tried to google it ...
36
votes
7answers
4k views
Why do people nowadays use factory classes so often? [closed]
I've seen the history of several С#/Java class library projects on GitHub and CodePlex, and it seems like a trend.
Why do people nowadays use factory classes so often for almost everything? I.e. We ...
0
votes
3answers
116 views
Assigning responsibility for cancelling an Order
During a conversation with our Domain Expert we can across this feature:
A Customer service agent can cancel an Order by decreasing its quantity. To cancel an Order we decrease its quantity by the ...
2
votes
3answers
241 views
Duck typing in statically-typed languages
Is it a fair assumption to say that an overloaded constructor for a class can be thought of as a 'duck' for duck typing? Let's say that ClassA has an overloaded constructor, it would stand to reason ...
-2
votes
1answer
109 views
Should I as a junior-programmer pursuit a course in C#, even though I did Java? [closed]
I'm a junior-programmer, and at present I am pursuing a course in I.T. which involves getting to know Java and JavaScript. Should I pursuit a course in C# also?
I really like programming, but I had a ...
0
votes
2answers
243 views
how to approach pharmacy software project [closed]
I would like to complete a pharmacy software proof concept. But I have a few questions I do not know.
Physician information
In order to refill or dispense a new RX the software needs to have access ...
3
votes
2answers
758 views
Why does C# have much more features than Java? [closed]
Please note that this isn't meant to be a Java vs. C# argument. I'm a Java programmer with no C# experience, asking just out of curiosity.
I did some reading on C#, and it seems it has much more ...
40
votes
5answers
6k views
Why was C# made with “new” and “virtual+override” keywords unlike Java?
In Java there are no virtual, new, override keywords for method definition. So the working of a method is easy to understand. Cause if DerivedClass extends BaseClass and has a method with same name ...
1
vote
1answer
94 views
Reference wind directions to texture space?
I have a 2D array filled with a simple class:
class Tile
{
boolean N,E,S,W;
}
I also have a tilesheet representing all possible outcomes except all false (12 + crossroad). Now i need to ...
-1
votes
4answers
298 views
Advice for beginner programmer [closed]
I am beginner in software development. I noticed when I try to learn one technology let's say .NET I lose my grip over other for example Java. I thought it would be better to concentrate on one ...
-1
votes
3answers
164 views
Condition to use polymorphism
is polymorphism only possible when there is a scenario of inheritance or is the implementation of polymorphism not dependent on inheritance.
Or is polymorphism mainly usefull when there is ...
2
votes
1answer
596 views
Why are interfaces called interfaces? [closed]
From what I understand so far, an interface is a list of methods that need to be implemented by whoever wishes to use that interface.
If so, would it make any difference to call it a specification ...
2
votes
1answer
113 views
Separate Action from Assertion in Unit Tests
Setup
Many years ago I took to a style of unit testing that I have come to like a lot. In short, it uses a base class to separate out the Arrangement, Action and Assertion of the test into separate ...
3
votes
1answer
100 views
Managing resource paths in source code
I suspect this is something that many of you guys have dealt with, and I'm certain there's articles on how to do it, but I cant seem to find them.
My problem is that my various constant classes in ...
1
vote
1answer
139 views
Accessing a remote server from desktop application
Web applications (.jsp / Java) have the advantage that they can be run from any client browser by putting a single URL into the address bar, and off you go.
However, the average web application is ...
1
vote
2answers
395 views
How to set up something like an integration server that measures the quality of code and reject the code if the score is below a certain number?
Even if I don't like enforcing people to do things (and I believe that it may decline the productivity and cause anger), I really want to enforce good coding style.
Is there a way to set up ...
0
votes
4answers
1k views
Why do C# developers newline opening brackets? [closed]
I've spent most of the last several years working mainly with C# and SQL. Every programmer I've worked with over that time was in the habit of placing the opening brace of a function or control flow ...
14
votes
5answers
916 views
Why isn't java used as a build language?
If Java is a general purpose language, and building a program is something that can be described using the Java language, why isn't this the best way to write build files and instead we use tools like ...
6
votes
4answers
2k views
Reason for (post/pre) increment operator in Java or C#
Recently, I've stumbled across question about predicting the output of code which heavily uses post/pre increment operators on integers. I am experienced C programmer, so I felt like at home, but ...
0
votes
2answers
224 views
Algorithm to order array
Take for example this input array:
[2,7,1,4,9]
For this input, I need to produce an array of total 23 elements which contains two elements of 2, seven elements of 7, one element of 1, four elements ...
5
votes
2answers
198 views
What are the advantages of next-iterator over this-iterator?
I don't work too often with Java/C# iterators directly but when I do I always wonder what was the reason to design iterators in "next" fashion.
In order to start you have to move iterator, in order ...
0
votes
1answer
193 views
Can we say that Java or C# have unified inheritance trees?
Can we say that Java or C# are OO languages with a unified inheritance tree/unified type system?
By unified inheritance tree/unified type system I mean that every class derives implicitly or ...
1
vote
3answers
3k views
C++ Performance vs. Java/C# [closed]
My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native ...
4
votes
1answer
336 views
State pattern vs Inheritance
In the following image for the State Pattern from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
I'm trying to persist the SalesOrder entity into the database. Normally I ...
0
votes
1answer
129 views
What's a similar functionality in JavaScript that insures the object has X data before any actions are taken?
If java/C#/etc one might do something like create a constructor with a parameter, the parameter being the thing the rest of the object may act upon. How is this done in JavaScript? I'm trying to ...
1
vote
1answer
112 views
Loading data for ShoppingCart item
I'm currently trying to cover our shopping cart with unit tests.
Class ShoppingCartItem has property Term. It also loads available terms for this item upon object creation. Currently this is done ...
33
votes
3answers
1k views
Does Java development typically involve more subclassing than C#/.NET?
I've recently started looking at Android development. This has brought me back into the world of Java software development. The last time I worked with Java, I'll admit, I didn't understand OOP nearly ...
4
votes
5answers
553 views
How to model an address type in DDD?
I have an User entity that has a Set of Address where Address is a value object:
class User{
...
private Set<Address> addresses;
...
public setAddresses(Set<Address> ...
5
votes
4answers
675 views
What's the reason exceptions are heavily used in managed (C# and Java) languages but not in C++? [closed]
AFAIK, a lot of C++ projects don't allow exceptions and deny them in coding guidelines. I have a lot of reasons, for example, exception is hard to handle correctly if your binary needs to be compiled ...
20
votes
5answers
2k views
Why can't Java/C# implement RAII?
Question:
Why can't Java/C# implement RAII?
Clarification:
I am aware the garbage collector is not deterministic. So with the current language features it is not possible for an object's Dispose() ...
0
votes
3answers
269 views
When should method overloads be refactored?
When should code that looks like:
DoThing(string foo, string bar);
DoThing(string foo, string bar, int baz, bool qux);
...
DoThing(string foo, string bar, int baz, bool qux, string more, string ...
62
votes
16answers
6k views
How much freedom should a programmer have in choosing a language and framework?
I started working at a company that is primarily C# oriented. We have a few people who like Java and JRuby, but a majority of programmers here like C#. I was hired because I have a lot of experience ...
0
votes
1answer
7k views
Why would one prefer C# (ASP.NET MVC) or Java (JSP) instead of PHP for web applications/projects [closed]
I'm wondering, why would one (consider it not just a single developer, but a company) prefer C# or Java for web applications? What's their considerations regarding the question. I mean, a company, has ...
22
votes
4answers
2k views
How many days is it normal for a new hire programmer to take to get up to speed? [duplicate]
I have just landed a role as a C#/Asp.Net developer at a large software house. I have previously worked at a much smaller software house for about two years but it was a varied/mixed role there, and ...
13
votes
9answers
4k views
Are too many if-else statements for validation bad? [duplicate]
From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can ...
3
votes
2answers
681 views
Collection interfaces in C#, coming from Java
In Java, I'm used to declaring collections using the most-abstract interface possible and then constructing them using the concrete implementation that makes sense at the time. It usually looks ...
1
vote
2answers
167 views
Determining the aggregates in this domain
I'm working on an ordering system where we receive tab delimited files that look like this (I removed most of the columns for clarity):
OrderId OrderLineId BuyerName BuyerAdress ...
1
vote
1answer
348 views
Refactoring the shipping application code to use DDD factories
I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book.
However when I checked the BookingService the code to create a Cargo had this ...
4
votes
2answers
382 views
Hide or Show singleton?
Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such:
C#: MyClass.Instance
Java: MyClass.getInstance()
The question is: when writing APIs, ...
-1
votes
2answers
228 views
c#/java or c++ (Personal question) [closed]
First of all this is not a comparison between the languages.
So I've asked a question before telling that I am a beginner programmer (hardest thing done is a chat server/client when I was reading ...
23
votes
4answers
2k views
Why do C# and Java use reference equality as the default for '=='?
I've been pondering for a while why Java and C# (and I'm sure other languages) default to reference equality for ==.
In the programming I do (which certainly is only a small subset of programming ...
1
vote
1answer
130 views
How do you distinguish your public API interfaces from the interfaces you use for testing/mocking?
Mocking frameworks are useful for creating mock objects that isolate the code under test from its surrounding software environment. Some mocking frameworks cannot mock non-virtual methods, so they ...
46
votes
11answers
3k views
I don't understand how TDD helps me get a good design if I need a design to start testing it
I'm trying to wrap my head around TDD, specifically the development part. I've looked at some books, but the ones I found mainly tackle the testing part - the History of NUnit, why testing is good, ...
20
votes
6answers
2k views
A programming language that allows you to define new limits for simple types
Many languages like C++, C#, and Java allow you to create objects that represent simple types like integer or float. Using a class interface you can override operators and perform logic like checking ...
-5
votes
3answers
477 views
How is an IDE compiled? [closed]
I'd like to know the general procedure of how an IDE is built/compiled/created.
Additionally, what are some tools/scripts used to create an IDE?
I don't mean to say that compiling IDE needs an IDE. ...
7
votes
2answers
668 views
Domain Services as facades
I read .NET Domain-Driven Design with C#: Problem - Design - Solution and I noticed that the author created a domain service for each aggregate root.
However, the domain services were only facades to ...