• 0 Posts
  • 32 Comments
Joined 10 months ago
cake
Cake day: November 25th, 2023

help-circle


  • (however, I don’t get why more loops and ifs makes a function harder to test, I’m just going to trust you and that I’ll find out later.

    Well, it’s fairly easy to explain - each branching statement in your function doubles the number of discrete paths through the code. If there’s one if statement, there’s two paths through the code. (The one where the if predicate is True, and the one where it isn’t.) If there’s two if statements, there’s four paths through the code. If there’s three if statements, there’s eight paths through the code.

    In order to test a function completely, you have to test every possible path through the code. If you used three if statements, that means you have to devise and write eight tests just for the different code paths, plus testing various exceptional cases of the function’s input (“what if all inputs are 0”, “what if all inputs are null”, “what if the integer is a string”, etc.) That’s a lot of tests! You might even have to write tests for exceptional cases combined with different code paths, so now you’re writing eight times the number of tests you otherwise would have had to.

    Whereas if your function doesn’t branch at all, there’s only one path through the code to have to test. That’s a lot fewer tests which means you’ll probably actually write them instead of saying “well, it looks like it works, I won’t spend the time on tests right now.” Which is how bugs make it all the way through to the end of the project.


  • I suspect “you’ll fail the test if you use break” is more of a joke by your teacher than an actual grading rubric, although if you used it more than twice in the same test I wouldn’t award you better than a B.

    Is there a benefit to not using breaks or continues?

    The benefit is that you learn to write non-branching code. That’s important for beginners, who tend to write very complicated and complex code with lots of branching, which they then discover they’re not able to test and debug. Barring you from using break and continue forces you to write more abstract code to achieve the same level of function with less complexity, and that’s how programmers advance in skill - simpler, more abstract code.

    Ultimately it’s an effort to kick a crutch out from under you. Whether you think that’s appropriate for a teacher is up to you, I guess - I’m inclined to think it is, but many students don’t respond well to being challenged.





  • crashfrog@lemm.eetoLemmy Shitpost@lemmy.worldBrand X
    link
    fedilink
    arrow-up
    2
    arrow-down
    5
    ·
    edit-2
    10 months ago

    One of the things I think is really unusual about Twitter is how bifurcated the user base used to be. I don’t think we understood exactly how until the verification thing.

    On the one side, you’ve got people like me, the regular Twitter users; I followed a mix of people I knew professionally, people who were media figures, and then just random-ass accounts who were doing tweets I liked. I don’t pay for Blue, I don’t really care who’s “verified”, since that just meant “I work for a blog or a corporation” and advertising content is irritating and I avoid it if I can. Overall when Musk took over it didn’t change my experience at all, except that all of the media accounts I followed started complaining nonstop and it just got tedious and now I follow a lot fewer of them. One thing that’s changed is that “For You” is a lot better than “Following” since Musk re-did the algorithm (used to be the other way) and now I’m on the “For You” tab about 100% of the time. It’s more fun and more interesting.

    On the other side you’ve got media Twitter users. The people for whom verification was a free perk of the job, people for whom the algorithm just showed them their peers affirming their content rather than any critical perspective, and who really have experienced a sea change in their Twitter experience. But largely what they’re complaining about is that their Twitter experience is now more like how mine always was. I think this is what people are talking about when they say “TPOT”, or “This Part of Twitter.”

    So I guess what I’m getting at is that there used to be two Twitter “brands”; there was the one I knew, which hasn’t changed and probably won’t; and there was the one you knew if you were employed in the media in some capacity, where that experience probably has substantially degraded since now they’re forced to have interactions outside of TPOT. I think when people in the media say “Musk ruined Twitter”, or “X destroyed the Twitter brand”, that’s what they’re talking about because Twitter as they knew it is gone.

    But for most people, people like me, Twitter is the same as its ever been. Little mini-posts from people who have interesting things to say.



  • crashfrog@lemm.eetoLemmy Shitpost@lemmy.worldBrand X
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    10 months ago

    I think the point you are missing in both cases is that the so-called customer is not who they are advertising to. In Coca-Cola’s case, they are advertising to investors.

    You just keep saying different things and then acting like that’s what you’ve been saying “the whole time”, but this is literally the first time you’ve introduced “investors” into it.

    But that’s also nonsense. Coca-Cola doesn’t need to buy ads during the Superbowl to talk to their investors; they already have a mailing address for literally every Coca-Cola shareholder. Every publicly-traded company does. When Coca-Cola wants to tell you, the shareholder, something, they just host a phone call and, like, tell you with their mouths. They do this once a quarter, in fact, if not more frequently.

    Aren’t you embarrassed about being wrong all the time?


  • crashfrog@lemm.eetoLemmy Shitpost@lemmy.worldBrand X
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    10 months ago

    My point, which I though was obvious, was why does Coca-Cola advertise their main product that they never change except for one ill-advised try in the 1980s?

    So that they can sell you all of the 20-odd other flavors, based on your favorable impressions of the Coca-Cola brand as a whole. Have you just not been fucking listening at all?


  • crashfrog@lemm.eetoLemmy Shitpost@lemmy.worldBrand X
    link
    fedilink
    arrow-up
    2
    arrow-down
    3
    ·
    10 months ago

    They don’t have any new products to sell you

    What? No, Coca-cola has new products every fucking year. Several times a year. Literally two months ago they launched “Coca-Cola Y3000 Zero Sugar”, a flavor supposedly created by “AI”. And just knowing that Coca-Cola launched it, you probably have an idea what it tastes like. That’s what branding does. But Twitter doesn’t do any of that, because again, they don’t launch new products. They have one product and they’ll always have one product.


  • crashfrog@lemm.eetoLemmy Shitpost@lemmy.worldBrand X
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    10 months ago

    They do it so that you’ll carry over your positive impressions with the products you’ve used, to the new products they want to sell you. You like the Apple Mac, so you think you’ll like the Apple iPhone.

    But Twitter just has the one product and it’ll always have just the one product. They’re not making a second product, ever. There’s nothing to transfer a favorable impression to. So what’s the “value” of Twitter as a brand, distinct from Twitter as an app? All Twitter is is an app.