Maybe one reason for writing bad code is that one has not enough time and the chess engine must be alive. So you take the shortest path.
So keep the system dead and come back if you have more time. Or do we have customers ?
Keep the system dead
Moderators: hgm, Rebel, chrisw
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Keep the system dead
There is no reason to write bad code (I wrote a lot of bad code in the past). Because in the end it only costs you invaluable time.Henk wrote:Maybe one reason for writing bad code is that one has not enough time and the chess engine must be alive. So you take the shortest path.
At some point you realize that bad code is no longer maintainable and the only way is to restart from scratch => writing bad code is waste of time.
-
- Posts: 7220
- Joined: Mon May 27, 2013 10:31 am
Re: Keep the system dead
Did you use the latest improvements in your programming language, advanced generics, design patterns, updated all documentation, run all tests, all tests covering each branch ? Changing any representation of a datatype is never any problem ?
Even C# language is changing all the time.
Even C# language is changing all the time.
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Keep the system dead
No, I use common sense All this stuff is really just fancy names for something you already use or just adds new layers of complexity, distracting you from really important things.
I'm not using C# and I'm not happy where C++ is heading (who needs user defined literals?).
I would rather see them remove some silly undefined/unspecified/implementation defined behaviors.
An example: I recently wrote a sample mixer. Relying on implementation defined >> on negative integers (behaving as artithmetic shift) gave me a 50% performance improvement. I really cannot neglect that as using divisions by constant is so much slower. Of course sar rounds towards negative infinity so the result is not the same (-1>>1 = -1 but -1/2 = 0), but you simply cannot tell the difference using 16-bit samples.
This works well for x86/x64 and for ARM, in 4 different compilers I tried, I'm willing to accept that some future compilers/platforms may break my code (actually I have a compile time assert that would prevent that and I doubt this ever happens).
Consider this, you bake a cake and use some rotten ingredients inside. No matter how much cream put add on top of that, it remains rotten.
Last note: bad code is not necessarily broken, it may actually work well, but it's very hard to maintain and/or build on top of that.
I'm not using C# and I'm not happy where C++ is heading (who needs user defined literals?).
I would rather see them remove some silly undefined/unspecified/implementation defined behaviors.
An example: I recently wrote a sample mixer. Relying on implementation defined >> on negative integers (behaving as artithmetic shift) gave me a 50% performance improvement. I really cannot neglect that as using divisions by constant is so much slower. Of course sar rounds towards negative infinity so the result is not the same (-1>>1 = -1 but -1/2 = 0), but you simply cannot tell the difference using 16-bit samples.
This works well for x86/x64 and for ARM, in 4 different compilers I tried, I'm willing to accept that some future compilers/platforms may break my code (actually I have a compile time assert that would prevent that and I doubt this ever happens).
Consider this, you bake a cake and use some rotten ingredients inside. No matter how much cream put add on top of that, it remains rotten.
Last note: bad code is not necessarily broken, it may actually work well, but it's very hard to maintain and/or build on top of that.
-
- Posts: 7220
- Joined: Mon May 27, 2013 10:31 am
Re: Keep the system dead
No bugs no fun. I think if I would change my representation of a chessboard I would have to change a lot. So it's probably another design error.