27
dmonkey
7d

1 - when I actually got the point of OOP

2 - When I got that I could check if a number was odd or even by doing & 1

3 - (in the future) when I will understand lifetimes in rust.

Comments
  • 3
    What's the number even thing? Do me a learn, brother πŸ€”πŸ€­
  • 5
    When you'll get the redundancy of OOP 😏
  • 1
    @dmonkey You mean you can check that number is even by it's remainder with two? Otherwise I'd also like to learn the other way.
  • 4
  • 4
  • 4
    @JoshBent Ooh... The first bit is only set on odd numbers. Yeah. That's neat. Thanks!
  • 2
    int x = 2;
    If(x % 2 == 0)
    //Even!!!
    Else
    // yea not so even πŸ˜‰

    Nothing complicated about that part.
  • 1
    @C0D4 bit operation would be quicker probably
  • 3
    @irene i found a comparison and unless your using it a billion times I doubt the difference will matter at the end of the time.

    http://mziccard.me/2015/05/...
  • 4
    @C0D4 you might not care, that's why we have electron, but some applications need any bit of optimization, especially on thousands of ops a second and for faster processing if run on a client machine.

    Edit: then there's also resource restricted development environments like embed, where u really don't want to be wasting another division on what could be a simple bitmask.
  • 3
    @JoshBent πŸ˜‘electron, just add x100 to all results -> and that's just getting it started for the first iteration.

    Like I said, unless your running through thousands of ops/second the performance is mostly not going to kill your product either way.

    There's a difference between not caring about performance and throwing electron at the problem πŸ˜…
  • 1
    @C0D4 it's synonymous
  • 1
    @JoshBent not really, that's a bit like dropping an A-Bomb (electron) on a fly to kill it, you and I both wouldn't do it - there's more efficient ways.

    Having a 1.5second difference (on avg) for... 10 billion iterations if I saw that right... won't be the worst thing in the world, keep reading, unless your running this thing 24/7 on an endless supply of data.

    Then yea let's take the care to get more data through the hole or just spin up another process.
  • 0
    @C0D4 you've missed the point I made I believe and focused too deeply on it.
  • 3
    @C0D4 but there is a definitive difference anyway 🀷
  • 2
    @C0D4 Honestly,

    bool isOdd = x & 1

    Is much nicer to see according to me...

    Ps: I always get confused with even and odd in english
  • 1
    @irene what do you mean? Why is it redundant? In my small experience I enjoy that Platon-like thinking
  • 1
    @irene preach!
  • 3
    @dmonkey because in most cases OOP is redundant overengineering.
  • 1
    @irene Mine was a joke on the parallelism between Plato's philosophy and OOP paradigm. Idea-matter ~ Class-object
  • 0
    @dmonkey o can't relate to that. I don't know Plato way.
  • 1
  • 1
    @dmonkey no, God, please no 🀣 I've had one lecturer who reminded us about the "three worlds" almost every lecture.
  • 0
    @C0D4 really everyone should be using their language's standard function for checking this. It will almost certainly be implemented with AND op, because mod gets expanded to many instructions whereas AND is 1:1. You can also do (num & 1) == 0 which is just as short as mod, but only works with integers.
  • 0
    @dmonkey does this work in all languages though? Boolean is usually a byte or larger on most
  • 0
    @beegC0de to be honest I don't know. I used it only with C, python and Java. I can suppose it works everywhere, but never tested decently. Oh and MIPS asm too, but on 32 bit arch, where everything is 32 bit long
Your Job Suck?
Get a Better Job
Add Comment