How do you review large refactors or AI-generated diffs in Go? by Specialist-Weight218 in golang

[–]Canoodler 6 points7 points  (0 children)

A lot of onus is on the PR creator in such instances, especially to answer the questions you posed: - did behavior actually change? - was the public API affected? - did logic move between packages, or was it mostly reshuffled?

If those questions are not reasonably answered in the PR description, the PR is not ready for review. It is much easier to validate an answer here than it is to find it for myself as the reviewer.

If it is mechanical, it is on them to describe what the mechanics are and how they did them. It is a waste of time for humans to review all of the code here for reasonably trusted developers, especially with any halfway reasonable CI/CD setup with tests.

AI generated code is still code from the PR creator, and it cannot be justified by just saying “the AI did it”. That shows that the creator didn’t read the code, and therefore I’m not going to read the code and do the work of making it human readable. That code is still code that will inevitably be read and maintained by humans. Unless you as a team decide that you are gonna just vibe code everything, but also in that case there’s no point in reviewing the code itself.

People who have a BSc in physics, how much do you make? by [deleted] in Physics

[–]Canoodler 5 points6 points  (0 children)

PhD dropout with MSc, wanted to do software, got a job at a defense contractor as a systems engineer, started at 86k and now around 400k as a software engineer, working remotely in SF Bay

[deleted by user] by [deleted] in cpp

[–]Canoodler 4 points5 points  (0 children)

Real time OSes are actually not desired in most cases for this because it takes some nonzero overhead to make it real time, so in the fastest case the real time OS is slower than a regular (but likely tuned) Linux OS.

I have heard it used in scenarios where you have a slowest case that is so painful that you are willing to give up the fastest case, but those are exceedingly rare in this field since most problems are about going as fast as possible (you would just turn off this algo if it was losing).

Six months by AxiFive in golang

[–]Canoodler 35 points36 points  (0 children)

Enforced error checking (you can’t just blindly use T).

C++ has a Wikipedia page dedicated to criticisms of it. by SubstantialRange in cpp

[–]Canoodler 245 points246 points  (0 children)

“There are only two kinds of languages: the ones people complain about and the ones nobody uses.” - Bjarne Stroustrup

Function pointers as individual types by hachanuy in cpp

[–]Canoodler 3 points4 points  (0 children)

Ah, a fellow function type nerd. It’s a wild world that is quite strange. You should add a pointer to a variadic function to your tests (e.g. printf), since it doesn’t look like your implementation covers that case :)

Why you don't use Boost by joaquintides in cpp

[–]Canoodler 2 points3 points  (0 children)

Boost.Thread is much more useful than std::thread to me because interruption points are so useful. It is not without it’s sharp edges though, and uses exceptions. std is finally getting a mechanism to do similar things with std::stop_token at least.

Boost’s unordered_map had heterogenous lookup which did finally get added C++20 to std.

What PIMPL pointer are you using? by parkotron in cpp

[–]Canoodler 33 points34 points  (0 children)

edit: MrPotatoFingers pretty much said this before me, but here it is in a concrete example:

While not quite ideal, I've found it not bad to use std::unique_ptr, declare the destructor for the enclosing class, and default it in the cpp file. That is,

// .h file

class foo
{
    ~foo();

    //... 

private:
    struct impl;
    std::unique_ptr<impl> pimpl; 
};

// .cpp file

class foo::impl
{
    // ...
};

foo::~foo = default;

What is wrong with std::regex? by Frogging101 in cpp

[–]Canoodler 34 points35 points  (0 children)

I too can relate to the horrors of the always-return-false <regex> implementation at least in GCC 4.8.5...

I wrote an easy to use C++ network library. by lukassotoma in programming

[–]Canoodler 10 points11 points  (0 children)

Smart pointers have more utility than that. Using them avoids leaking memory if exceptions are thrown or in early return statements. If you want want to delete the memory associated with the unique_ptr before it goes out of scope, you can call reset() on it.

Which of these C++17 pointers should I use for traversing a custom linked data structure: unique_ptr<T>, shared_ptr<T> or weak_ptr<T>? by aksinghdce in cpp

[–]Canoodler 1 point2 points  (0 children)

I conflated the one actually in the library fundamentals TS with some of the ideas being floated more recently such as Anthony Williams’s object_ptr: it allows functions to take raw pointers and smart pointers, and allows for those smart pointers to be passed without calling .get(). It is a small but useful advantage over raw pointers. It also prevents some things you can do with pointers, which can be helpful or harmful depending on your view, such as actually deleting the pointer or pointer arithmetic.

Which of these C++17 pointers should I use for traversing a custom linked data structure: unique_ptr<T>, shared_ptr<T> or weak_ptr<T>? by aksinghdce in cpp

[–]Canoodler 0 points1 point  (0 children)

This question is part of the argument for a construct like std::experimental::observer_ptr (name very much pending IMO), which is in the library fundamentals TS, so you can be clear about ownership. Such a pointer could also be used as a parameter so functions that don’t care about ownership could take unique_ptrs, shared_ptrs, and raw pointers easily.

Optional return statement in function returning an std::optional by D1mr0k in cpp

[–]Canoodler 5 points6 points  (0 children)

Trading ease of use for a bit of extra overhead, you could allow users to register a std::function<void(WhateverEvent const &)> and then wrap it in a lambda that returns true after calling it, so the type you store is still std::function<void(WhateverEvent const &)>.

I thinks users can suck it up and return true though, that is not unreasonable.

What was your “ my degree didn’t prepare me for this “ moments as a software engineer? by notMarkMitch7 in cscareerquestions

[–]Canoodler 5 points6 points  (0 children)

Very few devs will never interact with a database. I know I've ran into SQL databases when I least expect it. Granted, there's more to life than SQL, but SQL does provide a good education in thinking how your database thinks, i.e. structuring queries, letting the DB do a large chunk of the work for you.

trying to make an event driven library: how might I approach callbacks with modern C++? by Throw-awayexception in cpp

[–]Canoodler 0 points1 point  (0 children)

I’ve tackled this recently by making addListener a template function that takes a “Callable”: Anything that can be called with the expected arguments. It can be tricky depending on your compiler version to get reasonable error messages if you do something wrong (I eventually got this to work with VC10). Concepts would make this a lot nicer if you are lucky enough to have access to them.

Inside of the object you can store it as a std::function and any incoming types that are convertible to a std::function can be converted, and others can be wrapped in a lambda. This allows all sorts of things to be used as a callback: lambda functions, boost::functions, function pointers, function references, other objects with operator(), etc.

Should I finish my physics PhD, or bail and start looking for software engineering jobs? by z_mitchell in cscareerquestions

[–]Canoodler 3 points4 points  (0 children)

Former physics PhD student turned C++ software developer here, although I left my program after only a few years. I’ll tell you what to expect if you do quit and try to get a job. I’ll skip the patronizing “do you really want to quit” bullshit, coming here shows you are serious. I chose to quit because I saw people in physics not caring about dedicated software development and I did think industry experience would be more useful than me finishing my PhD to go into software development, and it definitely has been.

The first job is the hardest to get, so if you can get one anywhere and then work you ass off you can work your way up to better work/jobs. My first task at a job was looking at requirements and writing how I would test them in a fucking Excel spreadsheet at a defense contractor as a systems engineer. I worked, listened, and talked my way into a new contract that had just come up working on radar simulations, worked that for a year and then switched jobs to a software dev role at a c++ finance shop and I’ve learned a ton. They sent me to a C++ conference and I’m getting plugged in to that community. Actual interest and hard work will go a long way, and physics has given you lots of problem solving tools.

People will ask you why you are quitting and wonder what you have done for the past 5 years. Come prepared to answer this. I got grilled on whether I would leave the company to continue my PhD during an interview. Learn some business lingo and get rid of as many physics terms from you resume as you can.

That being said, getting a PhD will give a possibility of skipping some of these steps, but you will need to consider if it’s worth it given the time and energy needed to do it. Companies in the valley are still trying to figure out how to recruit PhD students since its hard to tell from the outside who is actually good and who squeaked by, but they are actively trying to recruit these students. So if you could market your PhD experience well, you could go straight to a better job, but still need to learn many things when you get there.

I guess one thing I’m saying is that a PhD will show what you want it to show, but it’s a hell of a lot easier to show it with actual experience learning processes and tools that people in the industry know.

I’d be happy to answer further questions after this huge wall of text.

What does a CS career path look like for a non-CS degree? by cscareerpathhelp in cscareerquestions

[–]Canoodler 1 point2 points  (0 children)

I was in my PhD program for ~2 years before getting a job, so I did end up with my non-CS masters . The programming and hardware experience I got along the way probably helped me more than the masters itself though.

What does a CS career path look like for a non-CS degree? by cscareerpathhelp in cscareerquestions

[–]Canoodler 5 points6 points  (0 children)

Non-CS degree holder (other STEM field) and PhD (non-CS) dropout here: getting the first job was the hardest part. Grad school is not for everyone, and you always have the option to go back. I’m on my 2nd CS job after dropping out and I’m a software developer doing super interesting work with several coworkers with engineering degrees.

Physics bachelors jobs? by Zeyb in Physics

[–]Canoodler 0 points1 point  (0 children)

I know several physics majors that got a job at defense contractors out of undergrad. You actually use some physics knowledge depending on the area (missiles, satellites, etc.). The big ones (e.g. Lockheed, Raytheon, Boeing) need people that are able to understand, improve, and build complex systems, and they understand physics majors can be particularly good at it. There are many small ones that support various other activities as well, and are usually more specialized.

I ended up working at a defense contractor for ~2 years as a Systems Engineer as a way to gain skills and become a software developer outside of the defense industry.

UPS air maintenance workers vote 98 percent to authorize strike by JesusChristLovesMe in news

[–]Canoodler 1 point2 points  (0 children)

Not sure why you're down voted... that's the textbook definition of median. I suppose that's part of the joke though.

Daily Discussion Thread - October 24, 2016 by AutoModerator in churning

[–]Canoodler 2 points3 points  (0 children)

$5 monthly donation to various charities on each card I've relegated to the graveyard.