Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
VikingofRock
Aug 24, 2008





An assert with side effects definitely belongs in this thread.

Adbot
ADBOT LOVES YOU

Absurd Alhazred
Mar 27, 2010

by Athanatos

VikingofRock posted:

An assert with side effects definitely belongs in this thread.

I've done that. :smith:

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Assert(Elon Musk is a dumb rear end in a top hat)

CPColin
Sep 9, 2003

Big ol' smile.
Warning: Assert is trivial

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
WHILE TRUE COMMIT CRIMES;

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
huawei bad, but not for the reasons everyone thought

https://www.theregister.co.uk/2019/03/28/hcsec_huawei_oversight_board_savaging_annual_report/

quote:

Analysis of relevant source code worryingly identified a number pre-processor directives of the form "#define SAFE_LIBRARY_memcpy(dest, destMax, src, count) memcpy(dest, src, count)", which redefine a safe function to an unsafe one, effectively removing any benefit of the work done to remove the unsafe functions.

Jazerus
May 24, 2011



"It is difficult to be confident that vulnerabilities discovered in one build are remediated in another build through the normal operation of a sustained engineering process."

CPColin
Sep 9, 2003

Big ol' smile.

Jazerus posted:

"It is difficult to be confident that vulnerabilities discovered in one build are remediated in another build through the normal operation of a sustained engineering process."

That's basically what I said when my coworkers started talking about giving a terrible vendor yet another chance to fix all their dumb bugs. They'd had a conference call where a new director made all sorts of promises and, bizarrely, trusted them.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

CPColin posted:

That's basically what I said when my coworkers started talking about giving a terrible vendor yet another chance to fix all their dumb bugs. They'd had a conference call where a new director made all sorts of promises and, bizarrely, trusted them.

You scoundrel. You knew full well that 3/4ths of the goons reading your post would wonder which of their customers you are, didn't you?

iospace
Jan 19, 2038


Today in things you always wanted to know but were too afraid to ask:

Are random paint splotches valid perl code?

The answer is... YES!

dick traceroute
Feb 24, 2010

Open the pod bay doors, Hal.
Grimey Drawer
I posted that on work slack... No response lol
Bitches
No hate

flatluigi
Apr 23, 2008

here come the planes

iospace posted:

Today in things you always wanted to know but were too afraid to ask:

Are random paint splotches valid perl code?

The answer is... YES!

I feel like a sample size of 100 is pretty limited even for a joke

iospace
Jan 19, 2038


flatluigi posted:

I feel like a sample size of 100 is pretty limited even for a joke

shush you

Dylan16807
May 12, 2010

flatluigi posted:

I feel like a sample size of 100 is pretty limited even for a joke
For an answer of "most but not all", 100 is plenty.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


The margin of error on a sample of 100 is 5%. With an observed probability of 93%, we can be pretty confident that the true proportion is over 80%.

Jazerus
May 24, 2011


flatluigi posted:

I feel like a sample size of 100 is pretty limited even for a joke

some would say much the same about perl

Tad Naff
Jul 8, 2004

I told you you'd be sorry buying an emoticon, but no, you were hung over. Well look at you now. It's not catching on at all!
:backtowork:
One of my junior programmers made the mistake of using Perl openly yesterday, so a bunch of us unloaded our bookshelves of O'Reillys on her. It was quite a pile.

Soricidus
Oct 21, 2010
freedom-hating statist shill
Perl is fine in moderation

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


You say that, but lerzfijglpFiji-j is apparently Perl in moderation, and that's not fine.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
If you get enough monkeys at enough typewriters, they will eventually not create a Perl script.

iospace
Jan 19, 2038


Rocko Bonaparte posted:

If you get enough monkeys at enough typewriters, they will eventually not create a Perl script.

So 1 monkey and 1 typewriter?

Happy Thread
Jul 10, 2005

by Fluffdaddy
Plaster Town Cop

iospace posted:

So 1 monkey and 1 typewriter?

DSYP

Doom Mathematic
Sep 2, 2008
Perl code:
ASDFGHJKL:@~
Yep, my home row is a legal Perl program.

Soricidus
Oct 21, 2010
freedom-hating statist shill

ultrafilter posted:

You say that, but lerzfijglpFiji-j is apparently Perl in moderation, and that's not fine.

Pretty much all those “valid Perl” examples are only valid in non-strict mode, which should never be used. If you see a Perl script that does not begin “use strict”, by all means run away screaming. Otherwise it’s fine.

xtal
Jan 9, 2011

by Fluffdaddy
Now do Ruby

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

xtal posted:

Now do Ruby
:nws:https://twitter.com/aa_bronson/status/667214912452718592:nws:

iospace
Jan 19, 2038



Ruby, not PHP.

Ruby is at least solid poo poo, not bloody diarrhea

Happy Thread
Jul 10, 2005

by Fluffdaddy
Plaster Town Cop

iospace posted:

Ruby, not PHP.

Ruby is at least solid poo poo, not bloody diarrhea

DSYP

repiv
Aug 13, 2009

Does visual programming count as a coding horror?

https://twitter.com/andrewpprice/status/1115051537296838656

:stare:

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

repiv posted:

Does visual programming count as a coding horror?

https://twitter.com/andrewpprice/status/1115051537296838656

:stare:

That's a debugging tool.

CPColin
Sep 9, 2003

Big ol' smile.
Stumbled across all three of these today:

code:
        String un = sysUsernames?.containsKey(sys) ? sysUsernames.get(sys) : null
        un = un ?: username  // fall back to main username
  • My predecessor was extremely lazy about naming things.
  • That sysUsernames field is just a Map, meaning the first line could've just been sysUsernames?.get(sys).
  • That field was initialized two lines up, so the ?. isn't even necessary.
  • Using the conditional operator like that in the first line and following it with using the Elvis operator like that in the second line indicates that my predecessor doesn't know why you use either operator.
  • (And no, the map never contains null values.)

code:
// Simple marker interface that allows clients to clearly determine whether a value is date-only or date+time
// Eventually, this will likely be replaced with Java 8 date/time classes (or Jodatime?)
class DateTime extends java.util.Date { 
    public DateTime(Date d) {
        super.setTime(d.getTime())
    }
}
  • That's not a marker interface.
  • This is a dumb way to construct instances of this class, when Date(long) already exists.
  • I'm glad we're specifically calling super.setTime() so we don't accidentally call the overridden version that doesn't exist because the class is three lines long!

code:
if (pv instanceof DateTime || pv instanceof Date) {
God drat it, forget it. (To be overly fair, there were other spots that had instanceof DateTime and instanceof Date in different branches.)

I guess these aren't so much "coding horrors" than general proof that code reviews are a good thing and working by oneself for a decade is bad.

Fake edit: Just spotted if (s.length() <= 0). Good protection against imaginary strings.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Found a case of an object assignment passing unit tests because the attribute had the same name as another object; the other object where assignment was occurring was just nullable get; set instead of any actual logic happening.

(picture of guy pointing at his head) Can't fail unit tests if you don't emit success/fail messages

ErIog
Jul 11, 2001

:nsacloud:

Scaramouche posted:

Found a case of an object assignment passing unit tests because the attribute had the same name as another object; the other object where assignment was occurring was just nullable get; set instead of any actual logic happening.

(picture of guy pointing at his head) Can't fail unit tests if you don't emit success/fail messages

How long before we see a programming language implement first class unit test testers?

User
May 3, 2002

by FactsAreUseless
Nap Ghost
Huawei may well be a Chinese espionage front company, but that hardly matters. More to the point they're in the telco business, which is a hive of scum and villainy no matter what the other context is.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Scaramouche posted:

Found a case of an object assignment passing unit tests because the attribute had the same name as another object; the other object where assignment was occurring was just nullable get; set instead of any actual logic happening.

(picture of guy pointing at his head) Can't fail unit tests if you don't emit success/fail messages

He's not some guy, he's Lt Commander Geordi La Forge! :mad:

CPColin
Sep 9, 2003

Big ol' smile.

Janitor Prime posted:

He's not some guy, he's Lt Commander Geordi La Forge! :mad:

No he's not.

Happy Thread
Jul 10, 2005

by Fluffdaddy
Plaster Town Cop

Hammerite posted:

Assert(Elon Musk is a dumb rear end in a top hat)

Dumb Lowtax posted:

Stackoverflow.com, the coding question/answer website, just released results of a massive survey of its members about things like most popular programming language, demographics, etc. This question stood out:


Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
laffo at that "me/myself" line

Jeb Bush 2012
Apr 4, 2007

A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.
elon musk at the top and ajit pai at the bottom is very revealing

Adbot
ADBOT LOVES YOU

Ola
Jul 19, 2004

Well it's not me or Evan You.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply