Skip to main content
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 ...
candied_orange's user avatar
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 ...
Doc Brown's user avatar
  • 214k
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 ...
Martin Maat's user avatar
  • 18.5k
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 ...
candied_orange's user avatar
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 ...
Vector Zita's user avatar
  • 2,482
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 ...
jk.'s user avatar
  • 10.3k
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 ...
Doc Brown's user avatar
  • 214k
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 ...
Flater's user avatar
  • 56.3k
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 ...
Paul92's user avatar
  • 2,601
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. ...
amon's user avatar
  • 135k
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 ...
Jerry Coffin's user avatar
  • 44.7k
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 ...
Ewan's user avatar
  • 79.8k
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 ...
Robert Bräutigam's user avatar
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 ...
G. Kashtanov's user avatar
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 ...
Jörg W Mittag's user avatar
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 ...
Doc Brown's user avatar
  • 214k
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 ...
Robert Bräutigam's user avatar
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 ...
Flater's user avatar
  • 56.3k
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 ...
Robert Bräutigam's user avatar
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" ...
Robert Bräutigam's user avatar
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 ...
jurez's user avatar
  • 111
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 ...
Arseni Mourzenko's user avatar
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 ...
Alex's user avatar
  • 3,922
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 ...
Christophe's user avatar
  • 80.6k
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 ...
Bogdan's user avatar
  • 3,640
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 ...
fdreger's user avatar
  • 266

Only top scored, non community-wiki answers of a minimum length are eligible