News for hackers. Stuff that matters.
Re:Ask HN: How to get good at separation of concerns? by dtagames on Sunday September 04, 2022 @02:49PM (#32716378)
Sure. I'd say be aware of code smell as you write and read your own code. Look out for functions that have too many parameters.as they're probably doing too much. Avoid passing data to a function that it doesn't absolutely need. Be careful about returning complex variables. Don't write functions that do more than one thing. Avoid globals and closures. In general, functional style programming will naturally lead to better separation of concerns.
Re:Ask HN: How to get good at separation of concerns? by aristofun on Sunday September 04, 2022 @09:06PM (#32719410)
You can not get good at an abstract matter.

It just doesn’t work this way.

You get good at some specific activities and then maybe generalize the experience to the point where you’re able tov extrapolate it to something else.

In other words — first you need to answer what do ypu need this abstract skill for, what exact goal and then go get good at that specific thing.

Re:Ask HN: How to get good at separation of concerns? by vivegi on Sunday September 04, 2022 @05:29PM (#32717886)
If you are using a class based programming language, determining what must be a class member function versus a pure function helps with separation of concerns at the interface design stage.

An example of the above with C# might be determining what is a class member function versus an extension method.

Re:Ask HN: How to get good at separation of concerns? by NicoJuicy on Sunday September 04, 2022 @04:02PM (#32717128)
Perhaps a different perspective that could help.

The parameters that are used in the method are the only ones that are logical.

Eg. Looking up a car owner by license plate in a SaaS.

Yes for: license plate number, on ( datetime) and country code.

No for tenant ( eg. should be injected by Tenancy service).

Re:Ask HN: How to get good at separation of concerns? by inphovore on Sunday September 04, 2022 @03:15PM (#32716660)
Due to the critical nature of our minds, it is often easier to critique the code of others.

Take time to do some refactoring if you can.

Gradually you will impress upon yourself to take the initiative and do things right the first time (aka “the hard way”.)

Re:Ask HN: How to get good at separation of concerns? by tomohawk on Sunday September 04, 2022 @05:13PM (#32717781)
Tell others that you are particularly insterested in growing in this area before they review your code when you submit it, or ask someone to review code you have already written with this in mind.
Re:Ask HN: How to get good at separation of concerns? by arunnanda on Monday September 05, 2022 @01:13AM (#32720799)
Mentally summarize the old context in 1-2 mins and then completely forget the old topic and focus 100% on the new one.
Re:Ask HN: How to get good at separation of concerns? by bot41 on Sunday September 04, 2022 @05:20PM (#32717829)
Think in extremes and then dial it back to what is reasonable