Best way in C# to reuse class-level code between abstract base classes
Actually, I could also ask this question for Java, D or C++. I remember, I found this to be an artificial limitation in Java already 10 years ago. I am currently working with C# and appreciate advices here.
How to avoid init methods when 2 objects need the reference of each other?
According to https://softwareengineering.stackexchange.com/a/334972/432039, I know init is a code smell and should be avoided, and one of the solutions is to use a builder to hold the state first instead of create the object first and then set the state, like https://softwareengineering.stackexchange.com/a/452495/432039 mentions, eg:
Which language should I study, c++ or java?
I’m a freshman in computer science at university and I learned procedure-oriented programming in C language. Now I’m going to learn object-oriented programming. Which language do you recommend, java or c++? And why? I’d really appreciate it if you could elaborate.
What is the correct way of implementing state machine design pattern via composition?
I am trying to implement a VendingMachine
which has multiple states (Idle, ProductSelected, ReceivedMoney, ProductDispatched
). Each state implements method in VendingMachineState
(for simplicity consider just collectMoney(int amount)
). Methods like collectMoney()
do their job and then change the state to the next state as per the state machine.
OOP: How to call containing class methods inside contained class methods
I am trying to implement a state (of type A
) machine which have multiple states (A1, A2, ..
so on). Each state implements method in A
(for simplicity consider just foo()
). Methods like foo()
do their job and then change the state to the next state as per the state machine.
Child structure depends on parent property
I have some interconnected entities:
Defining functions inside vs outside a class
Say I have a class with a function do_thing
that is comprised of multiple steps, which themselves segregate into functions (first_process
and second_process
). At what point would this be considered bad practice, particularly if you have several composite do_thing
functions?
Software between invention and discovery
Since years ago, I was asking myself if someone made a good software program should we say that:
If an entity is composed, is it still a god object?
I am working on a system to configure hardware. Unfortunately, there is tons of variety in the hardware, which means there’s a wide variety of capabilities and configurations depending on what specific hardware the software connects to.
If an entity is composed, is it still a god object?
I am working on a system to configure hardware. Unfortunately, there is tons of variety in the hardware, which means there’s a wide variety of capabilities and configurations depending on what specific hardware the software connects to.