by usrbinbash · 4y ago · 0 comments
While I agree with this in general, I find that to reall fully understand a problem, I need to attempt to code, or at least formulate, a solution to it.
a) because when I break down a problem into its code-able component parts, I learn a lot about it
b) because in the process of then actually implementing these parts I often discover edge cases or undefined cases (especially in naturally grown business-logic)
c) because what the problem actually IS, is often not that clear at the start of the problem. Yes, in an ideal world, changing requirements would wait until the next version, however, sadly that's not what happens in the wild.
Not only is it more interesting to me to try three different ways to tackle a problem, but I have been burned when the two weeks of whiteboarding missed something and I'm back to having to iterate anyway.
To be sure, I do a little whiteboarding, but generally it might be about 2 hours or so of sketching out ideas, major structures, code flow ideas.
I generally was nodding along to most of the author's points though.
I definitely have grown to divorce myself from my ego and always try to not only try to shine the spotlight on my younger coworkers (new engineers) but try to give them "ownership" of key pieces to allow them not only some sense of autonomy/ownership but a sense of pride as well.
That does go slightly against some of the author's points about collaboratively working on a project. Engineers need a part of the code (let's say an image cache manager, as an example) that they can "own" though in order to grow. You don't want an engineer to always have "training wheels" on. (And frankly, I think this is one of the things I dislike about code reviews, I think it dis-incentivises autonomy.)
The team though, let me be clear, is the most important part of any project, not the individual luminaries. The "team" though, to a degree, needs to have engineers who feel an ownership stake in pieces of the product.
(FWIW, I have probably 35 years of programming experience, ha ha.)
first time to understand the problem
second time to understand the solution
third time to do it right
If I did all the beginnings first, I'd then go back to doing the middle of A and realize I did the beginning wrong and have to go back to fix the beginnings of B and C.
While it is possible to completely understand the problem before writing a solution, it takes much less time to just build a prototype, analyze it to see what mistakes you made, rinse and repeat.
Note that the third principle of the "unix philosophy" is[0]:
Design and build software, even operating systems, to be tried early, ideally within weeks. Don't hesitate to throw away the clumsy parts and rebuild them.
[0] https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s...So in that sense we could rephrase the idea as do not commit to the code you write until you have a good understanding of the problem. Use it as a learning tool.
Personally I have never 100% solved a problem before writing any code. For me it really the other way around. By writing the code I better understand the problem.
I guess what we're dealing with here is that different brains solve similar/same problems in different ways. I guess its also the reason that advice such as "Never start coding ... unless ..." doesn't work for everyone.
I think the main difference is between human brains and machines. Biological systems operate with a kind of "fuzzy logic" by default...glancing over edge cases, smoothen out discrepancies on the fly, filling in missing information with context knowledge or assumptions, etc. Being imprecise is not a problem, in fact being able to handle the imprecise, is what keeps living things going.
When we describe a problem to a human like "take that crate and put it in the next room", we know that he will fill in the gaps (hopefully) like not assuming that the cleaning closet is the "room" we meant, even tho its right next to the starting room, and its technically a room.
Describing this to a computer is different. Edge cases need to be considered. What if there is no crate? What if there are many, which one does he need to get? What does "in the room" mean? Does the orientation of the crate matter? What do I do when the room is full? "Next" on which side of the corridor? And so on, and so on.
Only in having to describe a problem in an algorithmic way, can we fully appreciate all of its parts, and the information flowing through the process.
In order to implement a good solution you need to understand the problem well. Often, the only way to reach that level of understanding is by trying and failing to implement it.
These days, with modern refactoring and incremental development, it's less throwing away a whole program and more gradually refactoring it until little of the first code remains but I think the observation still holds in many cases.
1. Start small, then extend. Whether creating a new system, or adding a feature to an existing system, I always start by making a very simple version with almost none of the required functionality. Then I extend the solution step by step, until it does what it is supposed to. I have never been able to plan everything out in detail from the beginning. Instead, I learn as I go along, and this newly discovered information gets used in the solution.
I like this quote from John Gall: “A complex system that works is invariably found to have evolved from a simple system that worked.”
From: https://henrikwarne.com/2015/04/16/lessons-learned-in-softwa...
I see this as a basic skill, that we should aim to master at some point, even if we may never truly master this art.
If we do not move carefully around assumptions, we will have to refactor things later, which means more work. Of course moving carefully can also consume time. At some point it may become a tradeoff.
This is especially bad when the prototype works, but doesn't work well. They think you just need to polish things up a bit when really, you need to take what you've learned and build the real deliverable.
Another example perhaps as to how the software engineering field still has significant maturing to do vs. e.g. mechanical engineering.
I believe people underestimate the power of a good IDE.
Definitely. And in some parts of the tech world, people actually deride the usage of an IDE! "If you're not using vim you're a newb," kinda deal.
Which, sure, vim is great! And you can get a lot of decent plugins that can make that workable. But gosh IDEs provide so much powerful functionality, why would you make your life harder on purpose by not using them.
That attitude does seem to be fading though, in my more recent experience.
So with that being said, why do I use vim in a terminal emulator, instead of a modern IDE? Here are my most important reasons. Bear in mind, these are extremely dependent on my personal taste, modus operandi and thinking.
1. Simplicity helps me focus. vim hits a perfect mark between simplicity and feature-richness. Interfacing it with more complex systems such as LSPs, Linters, etc. is almost trivially easy.
2. I like building own tools and adapting existing tools them as I see fit. vim is pretty much perfect in that regard, not just because of the power of vimscript, but because how easily I can integrate tools I wrote myself into it.
3. It's absolutely trivial to set up: I copy my ~/.vim and that's it.
4. Once I figured out jumps, markpoints and linescripts, it allows me to do absolutely crazy things in codebase navigation
5. It works over ssh
6. It runs instantly and has a negligible performance impact
7. I can seamlessly integrate it into other CLI tools that require an editor, providing my default work environment in every situation.
8. Since version 8, I can actually use it as a terminal multiplexer, which is just crazy good for my workflow...I often have several split tabs to edit/navigate the code and a terminal tab controlling deployment and testing on the remote machines...all in a single terminal emulator window.
So yeah, why do I like vim? Because its flexible, fast and extendable, works everywhere and does exactly what I want.
Sure, as long as it's not on my dime! :-)
vim et al are great and I know skilled users can get very productive in them, but I would not push it as a default environment for incoming developers. The amount of force-multiplying functionality in the stock install of IntelliJ or VSCode is very good.
I share the sentiment, but for completely other reasons.
Human mind is very limited - it can only hold so much complexity at once before it starts making mistakes and oversights. IDE's raise that bar of tolerable complexity, making it easier for people to build enterprise-level Rube Goldberg's machines just to keep the software working.
Using Vim (or any other non-IDE editor) forces me to keep the software simple, because otherwise I can't understand it. And in my experience, keeping software simple (long term) is much more important than keeping software working (short term).
Of course, sometimes we have no choice but to meet the deadline. That's where all those bells and whistles really come in handy.
> For macOS, switch on the VoiceOver and install and set up IntelliJ IDEA. However, for a full screen readers' support, we recommend Windows.
I've never tried the Windows version, but the VoiceOver version is unusable.
[0]: https://www.jetbrains.com/help/idea/accessibility.html#scree...
What do you mean, "sometimes"?
Well not so fast, first you'd have to answer 100 questions to configure the IDE for a 'project'. Only then could you edit your file. Slowly. One. Single. Character. At. A. Time. Waiting for the IDE to become responsive again after each character.
Nowadays, however, the hardware has caught up and some IDEs are actually usable most of the time. And they're indispensable on the big convoluted projects we now deal with, that have tons of dependencies and convoluted ravioli code from OOP hierarchies.
I do kinda miss working on projects that were simple and clean enough to not need an IDE. But it would be terrible to go back to not using one with the code we wrangle these days.
> You need to progressively go through the code-test-improve cycle and explore the problem space till you reach the end.
So the author seems to agree, somewhat contradicting his own point.
Me too. Sometimes when I don't feel like I really know how to solve a problem, I'll just write some really hacky code to try to get an answer. Just anything that moves the problem forward.
Then once I understand what I want to do better, I either throw out that code and start clean. Or I just refactor the heck out of it until it is in a good state.
One: coding is a way to play around with ideas, equivalent to a back of the napkin calculation, a diagram in the sand or a pencil sketch of a part. We use code in this scenario more as a way to write down our thoughts and process. But rather than writing in just pure English and writing an essay or a set of Todos, we write more detailed "specs". "Do this three times or until this value is zero" is also written in code and perfectly understandable in code too.
Two: code is used to run by a computer to produce an outcome. In this case, the back of the napkin sketch IS the part but more thought out.
Society is so used to there being two material objects between the "plan" and the"final product" that we forget that code is different. With code, the plan and the final product are of the same form. Of the same physical space.
> While I agree with this in general, I find that to reall fully understand a problem, I need to attempt to code, or at least formulate, a solution to it.
I'd go as far as to say that programming is a good medium for expressing poorly understood and sloppily formulated ideas. Oh, wait, someone else already said that...
you also need a well-thought out outline for any larger work like a novel, or, it will be a disaster, or at least not be anywhere as good as it could have been
credentials: creative writing for decades and experienced 1sthand tradeoffs of each. my verdict? seek the Hegelian dialectic. ;-)
Hasn't been the case for me so far. Every story and essay I've written started with an idea. If there is an outline, it gets thrown away page 2 and never returns. On my second novel and this still hasn't changed.
My writing is actually better this way because I start with characters and plot emerges as they deal with the forces around them. I never know how they will react until they do.
I program the same way. Write a bit, revise, write a bit, revise. Drives some people nuts if they see the process, but the end result has been just as good or better than my coworkers throughout my career. (I'm a huge fan of tests. My revise step includes adding tests.)
related semi-tangent: with fiction I also adopted the rule to write the Ending first. because, for me at least, it then crystallizes what sorts of Middles and Beginnings might lead to it, and make the most sense or have the biggest emotional impact on the reader. which then practically paints out the character journeys for you, as the author. very helpful tactic
It's more common than you think.
In my experience they'd only relucantly agree if and only if it's "do this or die". Which then happens under time-pressure or under stress factors of other kinds.
"if it already works, why fix it?" (because it's making developer's lives much more difficult than they could be? --"but how does this increase revenue?" --errhmm... because incresaingly difficult to maintain? but they don't care about this "that's your job")
> "if it already works, why fix it?"
I suppose one attempt at a fix for this would be to make the user interface of your prototype the least prioritised part; maybe even go out of your way to make it ugly and clumsy, so the thing as a whole looks more like a prototype and less like a "solution".
Obviously it's helpful to formalize the problem! This is no different from manipulating mathematical equations on a piece of paper. =)
I usually so a vertical proof of concept where I tackle each step I understand in a unit-test. ofc it's no unit test- the test framework just serves as an quick entry point where I can test different approaches next to each other or different versions/variants of each approach.
like a repl with the benefit of an easy view of my "history" with the ability to step back in time.