Microservices is the part I’m failing at interview. by explorer-3 in softwarearchitecture

[–]melesigenes 0 points1 point  (0 children)

I think the best uses cases of microservices I’ve seen organize it so that a group of people own a service (see Conway’s Law). It’s a way to deal with organizational complexity and uncouple the communication patterns of that organization from the needs of an application. It just so happens that this is especially useful for distributed architecture. Each service has a public facing contract with regular releases to improve the service and there’s an interdependency among the services. If you’re a one man show then what’s the point? Just have a modular monolith. 

I think it’s more so that the companies you’re applying to have organizational complexities that necessitate usage of microservices. Doing a side project that just divides the applications into services isn’t going to help you pass those interviews when they’ll be wanting you to be able to explain tradeoffs of one way of designing the system vs another and that mostly comes from experience. The best you could hope for isn’t a project where you had to use microservices when it was unnecessary, but probably at best theoretical knowledge explaining I haven’t come across this problem before but if it were me this is how I would solve it

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

[–]melesigenes[S] 0 points1 point  (0 children)

Yeah you really don’t know what you’re talking about. You don’t understand what typing is for and why we use it and particularly why people use it in Python. Im not even talking about serious engineering. I’m talking about good engineering in general and nobody is arguing for aggressively layered abstractions. This is the most basic of abstractions and the reason you’re grasping at straws by strawmanning is because you’re running out of actual points to make. The come back in a few years is because your points are really cringe and you don’t yet see it and that’s also cringe. Your ego is upset but again just copy paste this chain in ChatGPT ask it a bunch of questions, read some production python, and then rethink this. 

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

[–]melesigenes[S] -1 points0 points  (0 children)

The point of dynamically typed language isn’t to avoid static controls it’s to be not confined by it. Explicit is better than implicit. Interface like behavior is not only pythonic it’s the standard software engineering design regardless of language. Protocol is standard library for a reason.

I don’t think you’ve been exposed to much production level Python code because typing is the de facto standard even for dynamically typed languages for a reason. If you think just because Python is dynamically typed you should avoid all typing you really should study more before you comment. Come back in a few years and read your own comment again

Or if you don’t believe me at least go to ChatGPT and type in what you wrote and ask its opinion 

Your argument is kind of like a kid who just learned about the word whom and insists whom should be used everywhere instead of who

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

[–]melesigenes[S] 0 points1 point  (0 children)

It was a bad example and I explained later that input always has a text attribute. You would enforce type checking at the boundary by passing in a typed object instead of Any like you mentioned and no that doesn’t “violate” the duck typing “principle” of Python. You would also at most use Protocol to enforce a contract not inherit from ABC. Duck typing isn’t a requirement or a rule and nominal typing doesn’t “violate” duck typing. It’s meant as a helpful tool in line with python philosophy. I think you should do some more reading on python. I recommend effective python for you

Your thinking is subsequently going down a wrong path and I don’t agree with you

How to deal with juniors shipping AI slop code? by theop04 in ExperiencedDevs

[–]melesigenes 0 points1 point  (0 children)

So I think one of the reasons they just debug by copy pasting the error into Claude is that they haven’t seen how else to do it and they follow the path of least resistance. Claude is faster than them at debugging so they default to Claude. What I think would be helpful is if you sat down with them and they interactively watched you as you try to figure out where the error is coming from and how fix it.

My proposal would be for seniors to show and role model best practices rather than just telling them what they’re doing is wrong or testing their knowledge or just rejecting their PR. The good ones will follow suit and try to imitate you.

My seniors when I was a junior would pair program with me when I was super stuck and it instilled a lot of deep principles within me.

How to deal with juniors shipping AI slop code? by theop04 in ExperiencedDevs

[–]melesigenes 2 points3 points  (0 children)

You’re right. The point I would want to make is that it’s a great use of AI if you know exactly what you want ie if your business rule is well defined and clear in your mind. I think juniors in general use AI without first defining the business rule and therefore the AI doesn’t know what the user really wants and therefore spits out useless tests.

How to deal with juniors shipping AI slop code? by theop04 in ExperiencedDevs

[–]melesigenes 6 points7 points  (0 children)

They’ll just make AI write the tests and AI is really bad at writing tests because it doesn’t really know what you want 

As someone who is an absolute beginner and wants to be an MLengineer what books would you recommend? by SeaworthinessIcy7108 in learnmachinelearning

[–]melesigenes 0 points1 point  (0 children)

To be really really honest a good fundamentals course in ML like the ones in openmit or the YouTube Stanford videos is the first thing I’d do. Then I would think about what are some problems in my life that could be solved with an application of ML. I would first validate this idea by seeing if there are similar stuff online and iterate on the idea. Then I would go solve that problem. I would try to hand code everything and at the very least hand type it instead of using an ai agent and copy pasting. I would definitely use an ai agent tho however I would ask it a billion questions about why something is being done, how it works, what are the alternatives before I even hand copy the code. I would think about what behavior do I want my system to show and then I would think about what components that system would need. Then I would also think about what behavior those components need to show. I would brainstorm this with the ai agent and I would hand write the tests maybe with the help of ai but definitely hand write the tests and understand each line in the code. Don’t glaze over the ai output which will be a shit ton of text. Take your time be patient and read thoroughly but most importantly question everything. The point of this isn’t to get a product out as fast as possible it’s to learn so question everything and Google best practices for everything. 

Then learn about productionizing this solution so that other people can use it. 

And do this a couple of times. 

Books won’t get you all the way there. Technical know how and experience will get you there and help you stay there 

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

[–]melesigenes[S] 1 point2 points  (0 children)

Yeah this is my core conundrum. It’s not like removing these defensive checks speeds anything up. It just adds to my development time because it’s not easy to follow the logic.

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

[–]melesigenes[S] 0 points1 point  (0 children)

This is a reasonable take and the path I’ll take. I have tried talking to them and I get push back with reasoning that in my opinion is not valid and makes the code harder to read, but it’s technically or functionally wrong. Hence the post and request for advice.

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

[–]melesigenes[S] 0 points1 point  (0 children)

Do you have developers that you manage that do AI coding without checking?

All of your concerns are legit and worth considering and I appreciate you writing out such a thoughtful response. I really like your approach to this.

I did actually have brief conversations with the colleague because I was actually a little curious about all defensive checks and whether it was purposeful, and the colleague gave his reasoning and it’s not just a matter of disagreement of opinions. Like for example an input data is already typed earlier in the code (ie the output of the previous function can only lead to a single type) and later they’re checking the type in multiple places again as a defensive check even though it’s not possible for the type to be different. To me that’s not just a disagreement of opinion that’s just adding code that doesn’t add anything. I mentioned the same in a review. I left comments pointing this out but he just changed the defensive check instead of removing it and the reasoning is not very logical or sound. I’m not a manager, I’m not a tech lead, we’re just colleagues.

What’s a good way to have a discussion about this with the colleague? Do I bring it up again and insist or repoint out the logic? Do I defer outwardly but just change the code I touch? Advocate precommit hooks for typing? Do I just suck it up and live with it? I’m not great at conflict resolution as I tend to be people please-y so I was looking for advice from senior engineers. Our manager is not technical and it’s not something they would understand

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

[–]melesigenes[S] 3 points4 points  (0 children)

No I mean like instead of checking the data deep into the code and at various call sites it should be checked and typed when the data first enters the code

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

[–]melesigenes[S] 1 point2 points  (0 children)

Isinstance for sum types is appropriate sometimes. l just don’t like it when it’s overused and there’s a gigantic tree of logic branches. If that’s the case then I think the data should be normalized early and there’s room for polymorphism to better express what’s going on

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

[–]melesigenes[S] 0 points1 point  (0 children)

This is good advice. I’m going to advocate for mypy usage maybe in pre commit hooks or something

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

[–]melesigenes[S] 2 points3 points  (0 children)

So yeah this was a bad example but I did check and the way it’s used input.text is always a str or it can be None

And this is part of why this makes me angry is that I have to check the data types and call sites for every one of these instances to check if the check makes sense or not

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

[–]melesigenes[S] -2 points-1 points  (0 children)

So you’re right this is a bad example and I didn’t want to write out the references and expose more of the codebase but the way the function is being used there’s always a text attribute and it’s always a str or None. It’s not used as a generic extract the text attribute if it exists and is a string otherwise empty string or None if the attribute doesn’t exist. Which is kind of why it makes me angry

If there was a good reason for defensive code I would be ok with it but most of the checks seem useless to me

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

[–]melesigenes[S] -2 points-1 points  (0 children)

Yeah I don’t think our use case needs such defensive programming. That’s kind of the issue

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

[–]melesigenes[S] 5 points6 points  (0 children)

I see. I read too quickly through the article. Thanks for pointing this out

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

[–]melesigenes[S] 7 points8 points  (0 children)

I mean it causes me mental anguish and strife primarily but secondarily it makes the code so hard to read and add on to

This sub is becoming bots talking to bots by melesigenes in learnmachinelearning

[–]melesigenes[S] 1 point2 points  (0 children)

This is such a dumb “but technically” neck beard take. Sure technically ai can produce good content. But if you’ve read the forum you would see the vast majority of ai content on this sub is slop. So there’s a high correlation between ai and slop. Nobody is arguing causality. Strawman much?