Using the 5S Principle in Coding
santhoshsundar.medium.com
santhoshsundar.medium.com
Joking aside, I think this article does a decent job of translating Lean manufacturing principles to coding, but the "Set in Order" section grinds my gears a little bit. I have worked on many projects of various sizes, and I think my fellow web devs tend to lean too hard into an overly nested directory structure. In manufacturing terms, imagine if you needed to open a cabinet that contains a toolbox with a plastic organizer in one of the drawers that contains a box that you had to open to get access to some rivets. It doesn't take much for that level of organization to kneecap efficiency. I would much rather have a single directory with 20 files than try to chase down a component file that's eight directories deep. Give me a big list of long descriptive file names, not short names that rely on the directory name to give context.
Relatedly and at the same time, I sometimes have a hard time figuring out when the right time to 'solve' the problem is. Speaking generally, if left unchecked for too long, it seems like more effort to go through and find instances of the problem and create a valid solution and then apply the solution, then if I am able to spot the reoccurring problem after only a few instances. This is particularly worse when I go back and solve the problem in a few areas, but there are more areas that I've missed (and now I have some spots with the solution, some without, and everything is messy). I suppose I need to spend more time after creating a solution to see if it's applicable apply anywhere else (but then that's more time refactoring than actually working on the problem at hand).
This does go back to topic focus though. Regarding programming specifically, I generally will have a topic (such as a feature enhancement). If I implement a new solution to a problem, it's not clear-cut to me if I should go and implement that solution everywhere relevant during the current topic, or if I should wait until a more tech-debt rework to clean things up a bit. My inclination is to focus on rework only during those tech-debt reducing stints. I really should figure out a clear and well-defined process for this.
Personally I am very focused on refactoring. When in doubt, if I can improve the code, I will! I don't know that that's "right", but it's how I live.
> Flat
> Style 04-04
> Do keep a flat folder structure as long as possible. >
> Consider creating sub-folders when a folder reaches seven or more files.
It goes more into the why on the actual guide https://angular.io/guide/styleguide
This sums up the broad concept of Compliance and security in general. The people who pretend to care about compliance (i.e. management) don't have the technical know-how to grok the implementations by those who pretend to implement said compliant systems. There isn't remotely enough QA/red-teaming (expensive to do in a bias-free manner), most of the time all you need to do is scribble in the box and everyone is going to squint and pretend it's checked.
The part I found interesting is that the premiums vary based on their assessment of your practices. This strongly aligns their incentives with actual best practices when evaluating your systems, as they are on the hook financially for any breach.
Flat lists let you see the entire thing at once. As long as there is some sort of natural sort order, it’s still a “neat” way to organise things.
E.g.:
SomeApp-PRD-Web
SomeApp-PRD-DB
OtherApp-PRD-Web
OtherApp-PRD-DB
OtherApp-PRD-API
Is roughly how I organise cloud resources. You can instantly see that there are two apps, and that both are web+db but the second one also has an API.If you had folders you’d just see this:
SomeApp
OtherApp
That just tells you that there are two apps, and nothing else. You have to navigate several times to get to the detail you could see at a glance with the flat structure.Similar concepts apply to code at every level. I avoid overly abstract functions that do their job through seven levels of trivial abstractions for the same reason. A one-page “flat” function can be more readable and maintainable.
By contrast my own systems are often just one giant folder. Conceptually I'm just not bothered by large directories with 20000 files. And I'm happy to mix files of different types in one folder (OMG .c files and .ico files in the same folder like a barbarian!!!)
I find the system is simple, and everything I need is in one place. But it freaks people out.
I guess we're all just wired differently.
(Obviously there is organisation, I have different projects in different folders etc, but there's no "extra" organisation. I don't make more folders just because this one is "full".)
This is the even more crucial difference and the reason for all the time estimation arguments.
If a manager can’t estimate a car production run schedule they’re a bad manager.
No manager can schedule — to the day — when fusion powered cars will be ready for shipping.
Yet, this is expected from people trying something entirely new in software.
“Integrate these two things that no human has put together before. Now that you’ve heard this single sentence, tell me: will it be ready Tuesday or Wednesday… a year from now?”
Imagine if compiling/deploying involved teams on the daily hand writing assembly/machine code from code base?
Even the person who coined "lean manufacturing" says, "Don't try to bring lean manufacturing upstream to product development. The application of Lean in product development and manufacturing are different. Some aspects may look similar, but they are not! Be weary of an expert with experience in lean manufacturing that claims to know product development."[1]
There are a couple of books that have tried to capture the design process from Toyota. [1] is the Wikipedia page for [2]. [3] is an alternative take. Unfortunately I haven't read these books, so can't provide anything beyond the table of contents.
[1] https://en.wikipedia.org/wiki/Lean_product_development
[2] the table of contents needs to be downloaded from https://www.lean.org/store/book/lean-product-and-process-dev...
[2] https://www.routledge.com/The-Toyota-Product-Development-Sys...
The compromise is to tidy the workplace as well as possible, call it "5S", fill the dumpster with stuff that's really junk, and let each engineer stash their Undecidable Things under their desk.
As for software, maybe the best thing is to just not let hardware concepts such as "designing" and "manufacturing" creep in. Especially when those things imply a social hierarchy.
It's not clear this article is empowering in that sense.
Instead of tracking/pleasing your boss, quality principles were stated and your job was to implement those principles, halting work as needed. This leads to problems being dealt with in time and in context, instead of being ignored or concealed. (Remind you of PG's distinction between being persistent vs. obstinate?) The difference lay not really in the major premise (the principles) but in how and when the minor premise of fault-correction was applied.
To me in software that's all about scheduling: scheduling infrastructure work and cross-training early, doing post-mortem's immediately, building design consensus iteratively with discussion and prototyping, etc. Scheduling and objectivity: not who's saying it, but what's being said. Both should empower IC's by giving them actual time and actual say.
In particular, clean code is often not the best, but can empower those otherwise bereft of natural authority. Sometimes duplication is better than dependencies, a little pile is better than a lot of structure, a complex PR is easier to review all at once, etc.
Empowering people makes selecting and orienting them quite important - but that's a separate issue.
The first four S's are all in the same semantic neighborhood: they all have to do with neatness, cleanliness and order. Basically they collapse into one. The last S, shitsuke, is just discipline.
"Be clean/neat/tidy, and have discipline".
Yay ...
All the math, software, and mechanical folks had to "5S their work area". Our manager gave us rolls of tape and a label printer so we could mark off where everything on our desk was supposed to be put away. The instructions we were handed showed marking off staplers and tape dispensers for desk jobs. It really was absurd!
They furloughed everyone in the company a few weeks later and I decided it really wasn't the place for me.
But I have to imagine this creates a lot of friction within a team, all trying to adhere to rules under the guise of efficiency, at great opportunity cost. And what's the ultimate impact to the customer? Do they care how elegant the codebase is?
It's worth noting what The Toyota Way is. It's a way to ensure high production quality. It is also slow. This is why Toyota effectively abandoned The Toyota Way in the mid 2000s, and why they were raked through the coals over recall issues in 2013. Growth.
If deadlines are involved, I struggle to see the argument for making view files beautifully atomic vs. say, making an improvement that adds customers / reduces churn.
That and doing I/O and async stuff in getters :vomit-face:
Because of this, the more people writing these practices down from a different viewpoint, the more likely another person is influenced and improves their craft.
Optimization is in >80% of all Software unnecessary, it is a nice to have feature.
I didn't see anything listed that isn't already considered a best practice (at least the headings, the specifics could be debated). Now, whether it's a normal practice or not is another matter, but when you have a huge number of novices joining every year and companies happily laying off senior people who could mentor them you get exactly what we have today.
What?
I propose going back to line numbers. Start with 1000, 2000, 3000. Sub-divide as needed.