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
pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Bruegels Fuckbooks posted:

The pattern for shared pointer is "oh wait, this class is owned by multiple other classes, how do I deal with that?" That's OOP as gently caress, storing unnecessary poo poo as members.

I'm saying there's a veritable cornucopia of ways to misuse shared pointers, no need to limit yourself to classes.

Adbot
ADBOT LOVES YOU

Macichne Leainig
Jul 26, 2012

by VG

DoomTrainPhD posted:

Just lol if valgrind isn't part of your CI/CD.
Double lol if you don't have CI/CD

I proudly continuously integrate and continuously deliver bad code.

QuarkJets
Sep 8, 2008

DoomTrainPhD posted:

Just lol if valgrind isn't part of your CI/CD.
Double lol if you don't have CI/CD

Of course we have CD! We have a cabinet full of burnable discs

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Bruegels Fuckbooks posted:

once you get to the point where reference counting and shared_ptr seem like a good solution for the problem you're having, you've hosed.

pretty sure that caring about any of this nerd bullshit is actually negatively correlated with having hosed, op!!!

Presto
Nov 22, 2002

Keep calm and Harry on.

more falafel please posted:

You still have to think about it, you just think about it differently. If you use smart pointers wrong, they can still leak, dangle, use-after-free, double-free, etc. There's no strategy for resource management that just means you don't have to think about resource management anymore.
How does one use smart pointers wrong, without deliberately going well out of your way to do it?

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
Smart pointer often smarter than programmer.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Presto posted:

I'm a battle-scarred old C programmer, and I will happily take smart pointers, because then the memory gets released automatically and that's one less thing I have to think about.

A C programmer who doesn't like memory allocation? What in the world

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

ynohtna posted:

Smart pointer often smarter than programmer.

Beef
Jul 26, 2004
Wait, you don't -fsanitize=address everything always?

Beef
Jul 26, 2004
And not working on MSVC has the benefit of being able to use `__attribute__(cleanup)` in C, which is nice.

Absurd Alhazred
Mar 27, 2010

by Athanatos

Presto posted:

How does one use smart pointers wrong, without deliberately going well out of your way to do it?

Multithreading + std::shared_ptr = :smithicide:.

Volte
Oct 4, 2004

woosh woosh

Absurd Alhazred posted:

Multithreading + std::shared_ptr = :smithicide:.
That's just a corollary of the Multithreading + State = :smithicide: theorem

Presto
Nov 22, 2002

Keep calm and Harry on.

Absurd Alhazred posted:

Multithreading + std::shared_ptr = :smithicide:.
Well, that's not safe to start with, so don't do that. :colbert:

more falafel please
Feb 26, 2005

forums poster

Presto posted:

How does one use smart pointers wrong, without deliberately going well out of your way to do it?


Absurd Alhazred posted:

Multithreading + std::shared_ptr = :smithicide:.

This, also circular references, which are easier to come by than you might think, especially if you're updating existing code to use smart pointers. If you're not going whole Herb Sutter and never using a bare T* anywhere, at some point you're going to have to pass a T* to some other code, that could do something stupid with it.

This isn't an anti-smart pointer rant, it's the same rant I've gone on a thousand times that "automatic memory management" is a lie, or at best a massive oversimplification. You aren't managing memory, now you're managing reference counting. There's a lot of situations (maybe even most situations) where that's preferable! Smart pointers are good, actually. But they don't eliminate classes of bugs, they make classes of bugs easier to avoid, and come with a runtime CPU/cache/memory cost.

It's almost the core design principle of C++ is to give you as many tools as humanly possible so that you can decide which ones to shoot yourself in the foot with.

Jazerus
May 24, 2011


BigPaddy posted:

COBOL for web applications

thread title

more falafel please
Feb 26, 2005

forums poster

http://www.coboloncogs.org/

Absurd Alhazred
Mar 27, 2010

by Athanatos

more falafel please posted:

It's almost the core design principle of C++ is to give you as many tools as humanly possible so that you can decide which ones to shoot yourself in the foot with.

We're all Bugs Bunny to C++'s Yosemite Sam.

1337JiveTurkey
Feb 17, 2005

I worked for a startup years ago that believed the secret to high quality C/C++ code was using AI to find and fix bugs based on automated test cases. Imagine if you will a codebase with literally hundreds to thousands of test cases necessary to assure the correctness of the codebase without anybody ever running the software. Yet not all is well because for some reason all the developers who created these tests are incapable of fixing bugs that the tests exposed. They may malloc but forget to free memory but fail to understand the error messages that valgrind produces in spite of integrating that into the automated tests.

How about we use AI to randomly change the software in hundreds of different ways and then see which ones pass all the test cases? (Hence the need for all the test cases) Developers will clearly love some tool trying to do their jobs and won't call it glorified shotgun debugging. There were minor issues with integrating with everyone's build scripts that I was supposed to fix while our AI expert worked on uh, parsing C source code using neural networks. He figured teaching a network to parse English would be a good start. I'd suggested clang repeatedly but had no success. I'm forgetting a ton but that was a year of my life I'll never get back.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
That’s a great story.

I particularly love the implication that there’s a fountain of sweet cash-out money waiting for anyone who can make a better static analysis and bugfinding tool.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


The Something Awful Forums > Discussion > Serious Hardware/Software Crap > The Cavern of COBOL > Coding Horrors: parsing C source code using neural networks

:wtc:

redleader
Aug 18, 2005

Engage according to operational parameters

ultrafilter posted:

The Something Awful Forums > Discussion > Serious Hardware/Software Crap > The Cavern of COBOL > Coding Horrors: parsing C source code using neural networks

:wtc:

when you think about it, that's what we all do every day :2bong:

wolfman101
Feb 8, 2004

PCXL Fanboy

smackfu posted:

Most of the testing that people complain about is automated integration testing and I don’t know how stateless applies there.

Minimize the pain by first minimizing the amount of state, and second by performing the logic on a lower layer than interacting with the database.

Xarn
Jun 26, 2015

1337JiveTurkey posted:

I worked for a startup years ago that believed the secret to high quality C/C++ code was using AI to find and fix bugs based on automated test cases. Imagine if you will a codebase with literally hundreds to thousands of test cases necessary to assure the correctness of the codebase without anybody ever running the software. Yet not all is well because for some reason all the developers who created these tests are incapable of fixing bugs that the tests exposed. They may malloc but forget to free memory but fail to understand the error messages that valgrind produces in spite of integrating that into the automated tests.

How about we use AI to randomly change the software in hundreds of different ways and then see which ones pass all the test cases? (Hence the need for all the test cases) Developers will clearly love some tool trying to do their jobs and won't call it glorified shotgun debugging. There were minor issues with integrating with everyone's build scripts that I was supposed to fix while our AI expert worked on uh, parsing C source code using neural networks. He figured teaching a network to parse English would be a good start. I'd suggested clang repeatedly but had no success. I'm forgetting a ton but that was a year of my life I'll never get back.

wat

MarxCarl
Jul 18, 2003

1337JiveTurkey posted:

I worked for a startup years ago that believed the secret to high quality C/C++ code was using AI to find and fix bugs based on automated test cases. Imagine if you will a codebase with literally hundreds to thousands of test cases necessary to assure the correctness of the codebase without anybody ever running the software. Yet not all is well because for some reason all the developers who created these tests are incapable of fixing bugs that the tests exposed. They may malloc but forget to free memory but fail to understand the error messages that valgrind produces in spite of integrating that into the automated tests.

How about we use AI to randomly change the software in hundreds of different ways and then see which ones pass all the test cases? (Hence the need for all the test cases) Developers will clearly love some tool trying to do their jobs and won't call it glorified shotgun debugging. There were minor issues with integrating with everyone's build scripts that I was supposed to fix while our AI expert worked on uh, parsing C source code using neural networks. He figured teaching a network to parse English would be a good start. I'd suggested clang repeatedly but had no success. I'm forgetting a ton but that was a year of my life I'll never get back.

Looks like they turned that AI testing stuff and made a product to sell - https://www.functionize.com

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

1337JiveTurkey posted:

How about we use AI to randomly change the software in hundreds of different ways and then see which ones pass all the test cases? (Hence the need for all the test cases)

this is called mutation testing

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

MarxCarl posted:

Looks like they turned that AI testing stuff and made a product to sell - https://www.functionize.com

i drink with a couple of software qa managers and i imagine they will be very pissed off when i load this website on my cellphone at the bar and ask them why they're not doing this yet. (yes, i know this product is horseshit, all products aimed at qa test automation are horseshit, it's just fun to watch the light in their eyes die out slowly)

MarxCarl
Jul 18, 2003

Bruegels Fuckbooks posted:

i drink with a couple of software qa managers and i imagine they will be very pissed off when i load this website on my cellphone at the bar and ask them why they're not doing this yet. (yes, i know this product is horseshit, all products aimed at qa test automation are horseshit, it's just fun to watch the light in their eyes die out slowly)

I'm DevOps, and I found out about this when one of the QA guys was asking me if I knew where he could host it. The answer to that was, your department paid for this, they can get that for you,

I went out and found it and just started laughing at it. This is poo poo they sell upper management as, "Hey look anyone can write a test case even you, just point and click, it's good forever, and tests more than a human." It's the same line of poo poo they all say, but now with "AI" and "Machine Learning" tacked on.

This is a bunch of sane looking people: https://www.functionize.com/company

Volguus
Mar 3, 2009

Absurd Alhazred posted:

Multithreading + std::shared_ptr = :smithicide:.

And how do you do that? Well, just use strands. Well, one strand to be exact. And allocate 20 threads while your program is essentially single threaded. And then wonder why it's slow.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Hammerite posted:

this is called mutation testing

No, it's sorta the opposite of mutation testing. The goal of mutation testing is to find things not covered by tests by discovering what changes you can make without making any tests fail. They're trying to make changes to the code to make failing tests pass.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

MarxCarl posted:

I'm DevOps, and I found out about this when one of the QA guys was asking me if I knew where he could host it. The answer to that was, your department paid for this, they can get that for you,

I went out and found it and just started laughing at it. This is poo poo they sell upper management as, "Hey look anyone can write a test case even you, just point and click, it's good forever, and tests more than a human." It's the same line of poo poo they all say, but now with "AI" and "Machine Learning" tacked on.

This is a bunch of sane looking people: https://www.functionize.com/company


quote:

THEY DON'T BITE
Management Team

At least a few of these people need an asterisk next to that

FlapYoJacks
Feb 12, 2009
Styling horror from work.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Plorkyeran posted:

No, it's sorta the opposite of mutation testing. The goal of mutation testing is to find things not covered by tests by discovering what changes you can make without making any tests fail. They're trying to make changes to the code to make failing tests pass.

Rereading it you're right. I made the mistake of reading it and applying a charitable interpretation of what was being described.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

DoomTrainPhD posted:

Styling horror from work.



Feels like Borat function declarations.

Heating, Ventilation, Keep Alive...
NOT

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Plorkyeran posted:

No, it's sorta the opposite of mutation testing. The goal of mutation testing is to find things not covered by tests by discovering what changes you can make without making any tests fail. They're trying to make changes to the code to make failing tests pass.

Basically teaching the computer how to succumb to confirmation bias.

Absurd Alhazred
Mar 27, 2010

by Athanatos

LOOK I AM A TURTLE posted:

Basically teaching the computer how to succumb to confirmation bias.

New thread title?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

LOOK I AM A TURTLE posted:

Basically teaching the computer how to succumb to confirmation bias.

Sounds more like test driven development

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

MarxCarl posted:

This is a bunch of sane looking people: https://www.functionize.com/company

I'll have some of what Head of Marketing is having.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Hammerite posted:

Rereading it you're right. I made the mistake of reading it and applying a charitable interpretation of what was being described.

I did the exact same thing but reread it before actually posting my reply saying that it's mutation testing.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The next step would be to write a tool which automatically generates tests by calling your function, seeing what happens, and asserting that that should happen. Add coverage-guided input generation and bam instant 100% code coverage without all the pesky work needed for things like property testing.

Adbot
ADBOT LOVES YOU

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty

Plorkyeran posted:

The next step would be to write a tool which automatically generates tests by calling your function, seeing what happens, and asserting that that should happen. Add coverage-guided input generation and bam instant 100% code coverage without all the pesky work needed for things like property testing.

While that's probably not what you'd start with on a green field project, yeah that kind of "what happens should happen" is absolutely a good approach if you're working on a legacy system either for a refactor or just maintenance.

If it does something different, a test will fail. You get to decide if that's good or bad but at least no changed behavior will slip through without being interrogated.

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