deal with oop.

because they made it waaaaay more complicated than it needs to be.

  • 1
    edit: clarification
    i mean oop style of programming ie using an object with all it implies instead of a primitive value and a comparison for instance.
    dealing with oop style and philosophy can be so frustrating at times:(
  • 0
    Any specific example? Curious
  • 0
    @Maer oop encapsulation:

    lets say i build a rudimentary game.
    lets say its fps.

    lets say i have my actor classes,
    classes to do the rendering,
    and classes for internal game logic.

    now lets say i shoot an enemy.
    following encapsulation principles i should either

    a)scrap my nice classes and put all my methods and all my data within a "main" class.

    b) have spaghetti code of the "main.enemy.gethitscan" sort with practically duplicated methods, and more difficult, less efficient code (because hitscanning an enemy during rendering makes things so much easier)

    c) just ignore encapsulation for readability and performance sake.

    oop just adds philosophical fluff to a subject thats hard enough already.
    and like with encapsulation, said fluff sometimes even gets in the way of getting a job done.
  • 0
    @Maer oh, i just read again what i typed above:

    it was something that popped up recently: phone numbers.

    and want to check whether the first number is bigger than 5.

    looks like i have to do
    const string = "123456"
    const check = "5"

    if (string.charCodeAt(0) > check.charCodeAt(0))

  • 0
    and if it turns out that charCodeAt method is anything more than one single dereferencing, ima start insulting the people who made JS
Add Comment