The illusionist mirage wrote: |
---|
Can you please explain why? All this while I thought OOP is better. I'd like to know more elaborately. |
Because different programming paradigms, like object-oriented or procedural, are simply different approaches to solving problems in computer science. I like OOP for things that can be easily conceptualised as multiple objects interacting (hence "object-oriented"), but that's not always suitable. Procedural programming is more suitable for tasks that lend themselves to being conceptualised as a series of steps, something which OOP would be less suitable for. I do think OOP lends itself to a larger number of projects than procedural programming does, because most programs model the real world in some way and the real world consists of interacting objects and not a series of states or steps, but that isn't always the case. Sometimes you really just have to tell the computer "do these things in this order" and that's exactly what procedural programming is. Also, don't ignore that all other paradigms are essentially abstractions of procedural programming. The computer is only reading symbols in the order they're presented to it.
[edit] That being said, I do agree that SFML is better than SDL (better than SDL 1.2, at least) but that's not because SFML is object-oriented and SDL is not. SDL
is object-oriented: it manipulates objects like SDL_Surface, SDL_Color, etc.
SFML is better because it's a unified library (everything comes with one distribution with one interface), yet modular (e.g. you don't link the audio/networking/graphics module if you don't need audio/networking/graphics); while SDL is a fragmented library (there are different distributions with different interfaces, e.g. SDL_Image/Mixer/TTF), yet not modular (the video, audio, input, etc. subsystems are all in one piece). With SDL, the parts that are not included are things you will almost certainly need if you're using any of the things that SDL actually does provide, and yet you can't get rid of the things you don't need. It's a stupid design. I can't speak for the performance difference but in terms of design SFML is clearly better.