Live data from Hacker News

Rust language is too hard to learn and use, says user survey

infoworld.com

11–12 of 12 posts

Re: Rust language is too hard to learn and use, says user survey

#11
post #10
post #9

Earlier quoted context omitted.

I’m probably not as good a programmer as you are, but isn’t using OOP great for making certain types of programs? Think about making a chess game or something.

GUI programming is used as an example every time someone is praising OOP. And it seems the only time where there is some merit behind using OOP. Chess game would be a good example of what to never do with OOP. If you start with `class Pawn inherits from Piece`, then you going to find yourself in deep shit, really fast. Low performance, high complexity. If you use an 8 by 8 array of integers that mark the pieces, than…

Even better, a chess board has 64 squares, so you can use a single 64-bit integer to store, say, the position of all white pawns, and repeat this for all the kinds of pieces. Then, you have a compact and fast data representation for your chess engine.

Re: Rust language is too hard to learn and use, says user survey

#12
post #10

Earlier quoted context omitted.

GUI programming is used as an example every time someone is praising OOP. And it seems the only time where there is some merit behind using OOP. Chess game would be a good example of what to never do with OOP. If you start with `class Pawn inherits from Piece`, then you going to find yourself in deep shit, really fast. Low performance, high complexity. If you use an 8 by 8 array of integers that mark the pieces, than…

Even better, a chess board has 64 squares, so you can use a single 64-bit integer to store, say, the position of all white pawns, and repeat this for all the kinds of pieces. Then, you have a compact and fast data representation for your chess engine.

The important part is - the way you represent the data matters a lot, and almost any representation will make more sense than bunch of "objects" scattered around.
Post reply on HN