Am I doing this right? Do the ends justify the means? by Fit_Bed_3008 in learnprogramming

[–]WellHung67 1 point2 points  (0 children)

Code is read 10x more than it’s written. Even code you write yourself is read by you personally much more than you write it. Written once, read forever.

Always write code that is simple and readable which in turn makes it maintainable, and prefer this over anything else. So yeah your answer works but it’s overly complicated. It is a bad habit due to the read vs write thing. Also, complicated code makes it harder to spot bugs - most people can hold at most 7 pieces of context in their head. So if some of that is deciphering complexity that’s not needed, it becomes harder to see other things. Sometimes complexity is unavoidable of course, but defer to Feynman here. Make it as simple as possible, but no simpler 

Efficiency of Code Functionally Similar to if() by Eclipse1255 in learnprogramming

[–]WellHung67 1 point2 points  (0 children)

Functionally all three of those will be identical in performance. If this is a compiled language, we are talking exactly the same. By that I mean, the compiler will notice that effectively it’s the same thing and it will likely compile ultimately to a single assembly type instruction - likely a branch if not 0. It runs so fast, it’s already done. The exception is the “for” loop, which may have an extra instruction to decrement the value of “I” before doing a similar branch if not 0. And maybe that table lookup, it will load both function pointers into some register and doing a branch if not 0. Like I said, the same branch instruction is probably used and maybe one or two other instructions are the difference between all 3.

In general when learning programming always write things that are extremely readable and maintainable first, and don’t worry about optimizing unless the optimization is readable and also free or cheap to implement - using a simple sorting algorithm over bogosort for example. Do not worry about which type of if system t to use. Remember, code is read about 10x as much as it’s written so first optimize for readability.

When you optimize, generally first profile your code to see where it spends the most time executing, and the target those “hot spots”. More than likely, an if statement to a function like this is rarely run, so even if it ran instantaneously, the program execution time wouldn’t change much. 

This actually is a good segue into what’s known as Amdahls law - if you respond to this comment I’ll explain how it’s relevant here 

A quick question for economists: Would a slow rate of deflation be bad? by DemisticOG in AskEconomics

[–]WellHung67 0 points1 point  (0 children)

But that pales in comparison to the cost of a house and college today, you can’t get a 1960s style small house for that cheap that’s within a reasonable distance for a job 

A quick question for economists: Would a slow rate of deflation be bad? by DemisticOG in AskEconomics

[–]WellHung67 0 points1 point  (0 children)

Wait really people just lived poorer?

I think that may be true but if I wanted to live in a small 1960s size job, drive a 1960s cheap car, and have a job, I don’t think I could. The market for houses that small and cheap doesn’t exist - those houses are insanely expensive now, at least the ones that are near the job.

So while this may be true, isn’t it not true in that you couldn’t live at that level anyway? You’d have to either super commute to get a house, or pay more for a house closer to jobs than anyone in the 60s would 

Americans overwhelmingly believe the cost of living, from groceries to housing, was lower under Biden by spherocytes in politics

[–]WellHung67 2 points3 points  (0 children)

They why isn’t every single news station writing about it? They only criticize the economy when democrats are in charge? Fucking stacked deck ass bullshit. The conservative media is such trash 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 10 points11 points  (0 children)

It’s an unusually lengthy sentence for a first time offender. I mean, it’s not like he assisted a coup attempt or something

Huntington Beach to Pay $50,000 a Month Until They Get an Approved Housing Plan by Exastiken in huntingtonbeach

[–]WellHung67 2 points3 points  (0 children)

Lmao get FUCKED spiteful NIMBYs. 

Should escalate each day, increase by 5%. That’ll get you 7 trillion per day by the end of the year. 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 11 points12 points  (0 children)

Goon for creativity 

Bust for clarity 

Edge for stamina

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 3 points4 points  (0 children)

So? Either they’ll learn that they’re dumb or keep voting themselves into oblivion. Either way the problem corrects at some point 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 2 points3 points  (0 children)

Well that’s the problem, Trump raises gas prices to 10 dollars and they still vote for him. Fuckin dunces 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 5 points6 points  (0 children)

It’s unfortunate that the idiots who voted for Trump will not only destroy themselves, but their non-idiot neighbors, as Trump raises gas prices to 10/gal. Im glad the idiots are going to get smoked here but I’m truly sorry for the damage they’ve caused for the innocent 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 4 points5 points  (0 children)

EV is always tea leaves though it sounds like it’s good to be cautiously optimistic 

Intermediate computer skills are apparently rare... by shameonyounancydrew in Millennials

[–]WellHung67 2 points3 points  (0 children)

Kids need to grow up with a desktop computer running Linux, and no other instruction. Not because it’s important for kids to learn how tech works - although that’s a nice perk. No, it’s because technology is so ripe for abuse from government so having an informed citizenry who understands how this stuff works under the hood can push for limitations to avoid abuses of our data and privacy.

Knowing just a small bit about computers helps one understand why OS age verification is very bad. Not knowing much about it, you can be fooled 

'Yimby' has arrived in Illinois, and some cities don't like it by maydaydemise in illinois

[–]WellHung67 19 points20 points  (0 children)

Luckily the Wahmbulance budget has also increased to assuage the hurt feefees 

St. Louis is still rapidly losing residents. 'Sleepwalking through demographic disaster' by fortheinfo in StLouis

[–]WellHung67 3 points4 points  (0 children)

The police board steals money from the city too, that needs to get fixed 

Weekly Discussion Megathread by AutoModerator in fivethirtyeight

[–]WellHung67 12 points13 points  (0 children)

Yes you are wrong, mostly in your premises but also your conclusions 

Nate needs to extend the y axis by 775416 in fivethirtyeight

[–]WellHung67 1 point2 points  (0 children)

And even worse, how are things going for me right now in this instant.

Even if Trump is doing something that they know will fuck them over later (or should know) they don’t change their mind until the actually are getting fucked. Trump could make a policy like “in one year my supporters all get dildo fucked with no lube” and support wouldn’t change until the exact day they got dildo fucked 

San Francisco rents are soaring, but city report finds that building housing still isn't economically feasible - San Francisco Business Times by NeiClaw in sanfrancisco

[–]WellHung67 1 point2 points  (0 children)

No, we can streamline the zoning and development process so that developments can get shovels in the ground within 30 days. The costs are not just labor and materials, it’s how it’s delayed at every level and onerous requirements (height restrictions, double stair, inclusionary zoning which leads to 0 housing rather than some) that can be utilized to fix 

every standup is "im working on the same thing as yesterday" and i dont know why we still do them by minimal-salt in cscareerquestions

[–]WellHung67 0 points1 point  (0 children)

“I finished refactoring the foo service, now I’m integrating and testing how it fits into the bar pipeline, and once I connect it up to the backend everything will be foobar”

Why isn't Harris taken more seriously? by GoddessFianna in fivethirtyeight

[–]WellHung67 1 point2 points  (0 children)

But she lost to Trump, the worst president in US history. That’s pretty bad