5 ms·
You first need to divide the programmers into two bins based on whether or not they even understand the question and could reason out the answer on their own. W
by caymanjim 7y ago
You first need to divide the programmers into two bins based on whether or not they even understand the question and could reason out the answer on their own. What world do you live in where programmers know linear algebra and understand what inverting a matrix is?
- enriquto 7y agoI work in a department of applied math. Hard to conceive anybody around here who does not know how to solve a 2x2 linear system.
- zamadatix 7y agoSure in your individual case that may be but the scissor statement was presented generally as if one could walk up to any programmer. It only being immediately understood by a smaller subset makes it not very helpful. I can't think of a similar scissor the majority of programmers both already have a solid understanding of and would be likely to be divided on - but I'd love to be out thought!
- cle 7y agoI didn’t see it as trying I be helpful in the way you’re thinking, just illustrative. IMO, the best way to write the code (pulling in a lib vs doing it yourself) is to consider the context in which it’s going to be read, maintained, and used. If that’s by a bunch of applied scientists or linalg experts who can read a formula more easily than debugging and maintaining integrated libraries, then roll it yourself.
- zamadatix 7y agoIn the actual case of just needing to invert a single 2x2 matrix in one spot of the program it takes more to understand what the library is being asked to do, how to format the ask, and what it should be giving back than it does to understand the 3 commented steps to do it. Maybe put a comment that if the needs change in the future it might be worth pulling in <linear algebra library of choice>. On the flipside if you expect the needs to increase in the future might as well do it now. In the general case look at complexity of the options and then look at context of who has to maintain that complexity don't just assume 3rd party means it'll be easier for others to grok while bug hunting.
- jschwartzi 7y agoThe "scissor statement" ignores the very real fact that every individual system must be constructed with different tradeoffs and in a different context each time. You will find that engineers in one environment might include LAPACK, but then the same engineer given a different context would roll their own algorithm. Unless they're not really an engineer. Engineering is pragmatic, not dogmatic. Your job is to do the good thing for your system, not to apply first principles to everything. Approaching it from a position of dogma is not engineering.
- Someone 7y agoI have a M.Sc in maths. I can derive the algorithm to solve a 2x2 linear system in the reals or the complex numbers, but I’m not sure I know how to do that properly in IEEE floats or doubles. In particular, I wonder whether ill-conditioned edge cases (https://en.wikipedia.org/wiki/Condition_number https://en.wikipedia.org/wiki/Condition_number) might need special-casing. Having said that, I’m not convinced I could easily judge the quality of a third party solution, find a library that favors accuracy over speed, if I needed one, or whether existing libraries properly document how much overhead calling a routine taking nxn matrices for 2x2 matrices takes, if I needed a fast implementation.
- wbl 7y agoNumerical Recipies belongs next to your K&R and Stevens TCP/IP.
- gwright 7y agoI worked for Richard and comments like this always make me smile. RIP Richard.
- hcarvalhoalves 7y agoLinear algebra is high school math, no? It is in my country at least.
- buzzerbetrayed 7y agoAnd for how many years after high school do you confidently remember how to invert a matrix? For me personally, that number is smaller than the number of years I’ve been out of high school.
- karatestomp 7y agoI get a thrill when I get to do a math-class math thing in programming. It’s rare. It’s happened with linear algebra once. That one time was about ten years ago, was very simple, and occupied perhaps an hour total of my time, at most. At this point I’d have to google to be 100% sure I even know what it means to invert a matrix. ... but I remember it being super simple and I’d probably be in the “just write it” camp.
- astrobe_ 7y agoNot even one year, if it is about niche knowledge that require accuracy. Schools don't teach formulas. That's the misunderstanding of a student that only sees the next exam. Schools teach you where to look when you don't have the answer.
- hcarvalhoalves 7y agoYeah, but at least I heard about it, a quick refresher should be enough, it’s not an alien concept. And a good programmer should be able to learn a new domain if they want to excel in the craft, otherwise we’re back to software factories and code monkeys.
- lilgreenland 7y agoIt's not taught at most high schools schools in California.
- m463 7y agoIs there a JQuery Linear Algebra routine?
- username90 7y agoIt still applies even if you don't know what matrices are. One kind of programmer will look up what it is and how the algorithm to invert it works, then implement that. The other kind of programmer will search for libraries implementing these features. The end result is that the first kind of programmer will know how a lot of things work, while the second kind of programmer will know a lot of libraries.
- smichel17 7y agoWhat about the third type of programmer, who looks up libraries and then reads their source to learn how they work?
- dahfizz 7y agoDealing with matrices is often taught in university (although there is probably a very high correlation between self-taught programmers and library users). But this is really another version of the same question: When faced with a task you don't understand, do you Google "How to do X", or do you search "library to do X in Y language".