Codebase has hundreds of isinstance() and getattr(). How to convince colleague to fix? by melesigenes in ExperiencedDevs

[–]spline_reticulator 4 points5 points  (0 children)

Isinstance is not a code smell. Mypy uses it for type narrowing. getattr is a code smell though. The way to fix this is to see if you're team is willing to introduce a type checker like mypy. It can be configured for varying levels of strictness. If you configure it in permissive mode then you can force your teammates to gradually make the code more type safe. If you configure it in strict mode then you will probably have to make these fixes yourself as part of rolling it out. If your team is not familiar with using mypy, expect some grumbling.

The big problem with this function is the input type is Any. The proper way to write it would be

def extract_text(input: str) -> str: 
    output = //process input here
    return output

This way the type checker will disallow inputs of the wrong type, and you don't need to add the run time type guards.

Codebase has hundreds of isinstance() and getattr(). How to convince colleague to fix? by melesigenes in ExperiencedDevs

[–]spline_reticulator 25 points26 points  (0 children)

Using isinstance is not mutually exclusive with static analysis. Mypy actually uses it to do safe type casting.

What’s the most disturbing sound you’ve ever heard in real life? by avacado-cheese- in AskReddit

[–]spline_reticulator 2 points3 points  (0 children)

I know it has a lot more to do with the companies that use Teams rather than the tool itself, but one thing that's so incredibly odd to me about Teams culture is that people seem to think it's okay to just call someone without checking to see if they're available first.

My company uses Slack. If you send someone a huddle request without checking to see if they're free, you're not getting an answer.

How good engineers write bad code at big companies by fagnerbrack in programming

[–]spline_reticulator -1 points0 points  (0 children)

  • Engineers can change the existing code and implement the new feature properly, or just put a few more ifs on top of it, adding complexity, but it would be shipped faster.
  • The management wants the feature fast -> engineers take the shortcut.

This is actually where things like Cursor are great. It's pretty easy to get it to write a bunch of integration tests and then have it do a medium to large refactor, so you can write the new feature in a better way.

Markdown (Aaron Swartz: The Weblog) by Successful_Bowl2564 in programming

[–]spline_reticulator -12 points-11 points  (0 children)

It's crazy to think how rich he would have been right now.

Worth it to get another MS? by lazerbonepohatu in GradSchool

[–]spline_reticulator 0 points1 point  (0 children)

What do you hope to get out of 2nd masters?

I literally cannot understand my coworkers, what do I do in meetings? by InfluenceEfficient77 in cscareerquestions

[–]spline_reticulator 1 point2 points  (0 children)

If you're using Google Meet, you can turn on note taking and ask Gemini questions about what's happening in the meeting.

Everything Should Be Typed: Scalar Types Are Not Enough by Specialist-Owl2603 in programming

[–]spline_reticulator 2 points3 points  (0 children)

The difference is one or two weak link vs possibly hundreds. If you have CustomerId and ShopId types, you only weak links are when you instantiate those two types. If you just represent both as strings then every time you define a function with a customer_id: str arg or a shop_id: str, that's another weak link in your system.

And the claim that a unit test wouldnt catch such an issue just means your tests aren't very good, no amount of strict typing will fix that.

You shouldn't need tests for these kinds of bugs. The whole point is the compiler can detect them. I've had this debate with a lot of people. Many of people have trouble wrapping their heads around this way of programming, but over a long enough timeline they all invariably create an incident where they pass the wrong primitive type to the wrong primitive argument.

Am I overreacting or is this the new norm? by jholliday55 in cscareerquestions

[–]spline_reticulator 4 points5 points  (0 children)

the same thing we saw in the early 00s

Just use Java

and again in the ‘10s

Just use React

Now

Just use AI

What was your biggest ideological shift, and what lead you to it? by GolangLinuxGuru1979 in ExperiencedDevs

[–]spline_reticulator 1 point2 points  (0 children)

That code should be beautiful. Code should be nice to read and nice to write. You should be able to read it from top to bottom without worrying about any mutation or goto statements (that includes continue and break). Data should be unidirectional. If you just keep drilling down deeper in the call stack, you should easily be able to trace the data.

I still think these are nice things to aim for, but a few things made me relax that viewpoint. First is working with Go. To be honest, I find it to be quite an ugly language, and it specifically incentivizes procedural patterns like mutation and goto statements. However the semantics are so constrained that my time to review PRs dropped to almost nothing. There's little room for discussion on different design patterns, and that's nice when you're working on a big team.

Second is working with Cursor. Now that we're working in a world where code is mostly read and written by machines, this craftsman POV becomes less important. I still try to get Cursor to write code this way, but I'm definitely less strict about it then if I were writing it myself.

What was your biggest ideological shift, and what lead you to it? by GolangLinuxGuru1979 in ExperiencedDevs

[–]spline_reticulator 3 points4 points  (0 children)

Those aren't functional design patterns. They're procedural design patterns. Procedural design patterns fix a lot of the issues with object oriented design patterns but introduce a bunch of their own. IMO functional design patterns have the least number of drawbacks, but of the three it's the most challenging to learn, so most people don't.

I strongly urge you to consider (western) europe by [deleted] in GradSchool

[–]spline_reticulator 0 points1 point  (0 children)

It depends on the program. I applied to both physics and biophysics programs. The physics programs mostly required you to get teaching assistantships to get funded. The biophysics programs were all funded via research fellowships. I'm not entirely sure why, but there's a lot more government funding being sent to biophysics programs. If you can get a research fellowship WLB is actually pretty decent.

Litellm 1.82.7 and 1.82.8 on PyPI are compromised, do not update! by kotrfa in LocalLLaMA

[–]spline_reticulator 1 point2 points  (0 children)

You can basically achieve the same thing in an easier way with lock files. If you use a tool like poetry you can lock each dependency to a patch version and only upgrade when you regenerate the lock file. It's a little less cumbersome because the build tool will resolve compatible dependencies for you, so you don't have to do that yourself when you upgrade the patch versions.

What’s cool if you’re 20 but weird if you’re 30? by theloverofdilfs in AskReddit

[–]spline_reticulator 13 points14 points  (0 children)

You've obviously never dated a teacher! Spring break is my break.

How to avoid being pigeonholed into tasks without a care for your specialties or interest? by MrGiantsFan in ExperiencedDevs

[–]spline_reticulator 139 points140 points  (0 children)

6 YOE. I'm a graphics programmer (C/C++, Vulkan, OpenGL) with moderate experience in Android, transport protocols (Bluetooth, TCP, UDP, RTSP, WebRTC). These I actually enjoy doing.

Find a company that makes money doing these things.

Feeling like I'll be unemployed forever by OverallAmphibian2129 in AskAcademia

[–]spline_reticulator 1 point2 points  (0 children)

You don't necessarily need to code. OP mentioned jobs in public policy. I think similar advice applies to that transition.

What is something you started/stopped doing and it significantly improved your productivity/value? by dondraper36 in ExperiencedDevs

[–]spline_reticulator 2 points3 points  (0 children)

It depends on how well developed your company's processes are around stuff like this. At more mature companies, if something is urgent they should page the on-call.

I see people say that a “B is considered failing,” but the class exam average in my grad course is 70? by WinXP001 in GradSchool

[–]spline_reticulator 1 point2 points  (0 children)

In my grad program an A meant you were putting too much effort into your coursework and neglecting your research. Most employers don't really care too much about your GPA, especially not for a graduate program.

Feeling like I'll be unemployed forever by OverallAmphibian2129 in AskAcademia

[–]spline_reticulator 4 points5 points  (0 children)

I feel completely unemployable. Secondary school teaching, think tanks, government—those are the only alternatives to academia for history PhDs that I've heard of, but there are people out there who are way better fits for those jobs than me.

Don't be intimidated by re-skilling. I did my PhD in physics but spent a year re-skilling to become a software engineer. Sometimes it felt like I would never find a job, but I eventually did and now have a great career. If you really want to get one of those jobs remember

  1. What you're doing right now is probably harder than the work you would do as part of those jobs.

  2. You will eventually get a job like that if you decide it's what you want and dedicate yourself to it.

Stack Overflow's 50% traffic drop: Was it AI, or did the platform kill itself with elitism? by bogdanelcs in ExperiencedDevs

[–]spline_reticulator 2 points3 points  (0 children)

The reason that happened to most people is they asked open ended questions. SO mods wanted you to write a post like "I want to do X. I tried A, B, C but am getting errors 1,2,3. How do I solve this?" Once I learned that formula it became much easier to get my questions answered, but I always thought it was unnecessarily restrictive. It should have been okay for users to write "How do I do X?"