15
votes
What programming paradigm do you think would work best for the AI aspect of a chess engine?
I wish to write a chess AI which simulates the way I think over the board, using C++.
Awesome!
My focus is on writing the algorithms for choosing moves (decision making), not defining the board and ...
14
votes
Accepted
Why is white box testing discouraged in OOP?
You are mixing up two related, but nevertheless different things:
white box testing
unit testing by using private methods
The reasons for writing or not writing unit test only using public methods ...
13
votes
What's The Difference Between Imperative, Procedural and Structured Programming?
I am afraid none of the answers given so far capture the core of the concepts very well.
Imperative, procedural and structured are not mutually exclusive properties, they just focus on different ...
6
votes
Accepted
How does a function's purpose differ between a OOP and Procedural style?
A method is to change something within the instance
Really? So "Hello".length() is trying to change the instance? No, a method uses the instance as its context. A context that in some ...
6
votes
How to adhere to the Open Closed principle in a procedural language like C
Think about what the open-closed principle entails: You have to write your methods in a way that you don't really know what the input is exactly, but you have to do something that depends on what ...
6
votes
Why we are moving towards Mixed Programming Paradigm
I'm not sure we are, I'd argue that Lisp is a multi-paradigm language and as its the second oldest high-level lengauge we have pretty much always had multi-paradigm languages.
C++ also is arguably ...
6
votes
Procedural configuration code to object oriented code
It seems you have the idea of making code more "Object Oriented" improves a system automatically, and "more classes" = "more OO". But that's fallacy. If adding extra ...
5
votes
Anemic Models vs. Rich Models: When to Use?
The question assumes that the decision between rich/anemic models is made based on context; but in my experience developer opinion (and personal style) is often the driving factor here.
Sure, some ...
5
votes
What programming paradigm do you think would work best for the AI aspect of a chess engine?
To my knowledge, most chess programs written to date are focused on taking advantage of the computer's calculating powers (aka brute force method). My program will be different in that the focus is ...
4
votes
Object Oriented vs. Procedural Processes in Embeded System
C and C++ are closely related. Their main difference is not that one is procedural and the other object-oriented. The main difference is that C++ offers a much more expressive type system (incl. ...
3
votes
How to adhere to the Open Closed principle in a procedural language like C
To do the job in C, you'd probably want to create a struct containing a pointer to a function. In other words, you'd explicitly/manually define a vtable, and include it as the first item in a union ...
3
votes
Robins magic Chess game: Where to put/split the behaviour to full fill Law of Demeter
A game of chess is fully described by the list of moves that have taken place and the rules of the game. (8x8 board, starting positions etc)
If you want to program it in a OOP style your objects are ...
3
votes
Object Oriented vs. Procedural Processes in Embeded System
I have some limited experience in embedded programming, mostly with Arduino-compatibles, ESP8266, that kind of stuff, and only for fun.
I've started with the available libraries, all of which are ...
2
votes
Why we are moving towards Mixed Programming Paradigm
I would say that a language doesn't necessarily force you to program within a certain paradigm. A paradigm is more of a way of thinking and constructing your program, while a language is a tool which ...
2
votes
Detailed difference between Procedural Programming and Object Oriented Programming
In Procedural Programming, the primary method of abstraction, the primary unit of decomposition, the primary unit of behavior, the primary method of structuring your program (which also means the ...
2
votes
Accepted
Action objects VS handle/service-methods
Let me scetch the general situation:
you have some parameters for an object, and
there is some method m to be called after its construction, working with these parameters.
Now you are unsure which ...
2
votes
Accepted
Robins magic Chess game: Where to put/split the behaviour to full fill Law of Demeter
Of course you can have the pieces holding the necessary logic. The only problem you have, as you mentioned, is that you need all the information about the board and positions too.
There's a couple of ...
2
votes
Tell one, but ask the others?
Code is abstraction, and abstraction is, well, an abstract concept. It's all about how you reason about the problem domain and how you break down the problem into its constituent parts and how these ...
2
votes
Tell one, but ask the others?
Sometimes porting procedural code into oo is as easy as renaming things. For example ClockService. You just rename it to Clock and it works. It is a thing, it is business-relevant, etc. I would also ...
1
vote
Action objects VS handle/service-methods
Of course "it depends" :) The criteria to decide is the rest of your design and the business case.
No object exists in isolation, or put it another way: There is no "optimal" ...
1
vote
How does a function's purpose differ between a OOP and Procedural style?
Methods have an implicit parameter this while functions do not.
Therefore, methods can operate on the object to which they are attached. Functions can only operate on explicit parameters.
Apart from ...
1
vote
Why is the UNIX / FP style of smaller function composition not common?
I would disagree with your observation that function composition is not common.
There are languages which favor functions over objects. Classical JavaScript (before ES6 and TypeScript frenzy) is a ...
1
vote
OOP: centralized vs decentralized approach
As written i.e. you always need to send a reply, then the centralised approach is probably slightly neater. I can see two potential benefits:
the common workflow (receive, handle, send) is all in one ...
1
vote
How to adhere to the Open Closed principle in a procedural language like C
In Open/Close, you have two aspects:
Close: you shall not change the source code. This is common business in C; you have plenty of libraries that you are not supposed to change. And use of ...
1
vote
Detailed difference between Procedural Programming and Object Oriented Programming
Existing answers go into details about the differences, just as the OP requested. But since the question also asks for responses that even a beginner could understand, going into too much details can ...
1
vote
What programming paradigm do you think would work best for the AI aspect of a chess engine?
Paradigms are made for people, not for problems - problems don't care (and computers care even less). Compilation and execution strips your program of objects, functions, variables, modules, classes ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
procedural × 45object-oriented × 30
object-oriented-design × 7
design × 6
design-patterns × 5
c++ × 5
c × 4
c# × 3
unit-testing × 3
programming-languages × 3
functional-programming × 3
architecture × 2
php × 2
testing × 2
mvc × 2
parsing × 2
paradigms × 2
structured-programming × 2
programming-practices × 1
coding-style × 1
refactoring × 1
interfaces × 1
code-quality × 1
naming × 1
clean-code × 1