5 ms·
Good programmers worry about data structures and their relationships
- OutOfHere 2y agoI'd argue that when your entire approach is experimental, there is no need to fret over structures. If you are convinced that your approach can work, that's the time to design well.
- kipple 2y ago> The actionable tip here is to start with the data. Try to reduce code complexity through stricter types on your interfaces or databases. Spend extra time thinking through the data structures ahead of time. This is why I love TS over JS. At first it feels like more work up front, more hurdles to jump through. But over time it changed how I approached code: define the data (& their types) first, then write the logic. Type Driven Development! Coming into TS from JS, it might feel like an unnecessary burden. But years into the codebase, it's so nice to have clear structures being passed around, instead of mystery objects mutated with random props through long processing chains. Once the mindset changes, to seeing data definition as a new first step, the pains of getting-started friction are replaced by the joys of easy future additions and refactors.
- _heimdall 2y agoType-driven development has been a big win for me as well, specifically when writing web front ends. Whether its client side rendering (sometimes a necessary evil) or on the server with a tool like Astro, I try really hard to start by defining types and UI components totally separately. I'll actually build out the full data flow and UI components in complete isolation, leaving the glue code for the final step. Its kind of a weird pattern from what I've seen, I have gotten some interesting code reviews over the years, but it really is nice focusing on one concern at a time. At the end its also fun watching a bit of glue code wire up the entire app.
- robertlagrant 2y agoI think this is definitely the best way. It feels like you're violating DRY, but you're not.
- umvi 2y ago(tangential) In theory I like TS. But in practice, unless I'm the one writing it and can KISS, it can quickly turn into an unmaintainable nightmare that nobody understands. TS astronauts, left unchecked, can make extremely complex types using generics, conditionals, and all the esoteric features of TS, resulting in extremely obtuse code. For example, I doubt anyone could explain this "type" without studying it for several hours: https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/src/index.d.ts#L168 https://github.com/openapi-ts/openapi-typescript/blob/main/p... In this case, the "type" is really an entire program.
- RangerScience 2y agoNot defending that code - and I agree with you that wild TS code gets nightmarish (I usually call it a “type explosion”) but Waaaay back when in my C++ days, starting to get into template metaprogramming, the “aha!” moment that made it all much easier was that the type definition could be thought of as a function, with types as input parameters and types as output parameters Recentlyish, this same perspective really helped with some TS typing problems I ran into (around something like middleware wrapping Axios calls). It’s definitely a “sharp knife” if you overuse it, you screw yourself, but when you use it carefully and in the right places it’s a super power.
- oakejp12 2y agoI'd be interested in reading that Axios-wrapper if it's openly available.
- RangerScience 2y agoIt isn’t :/ I’d be down to recreate it if you can point me at an open-source project to do it in! :) Basically - we had some custom framework-ish code to do things like general error handling, reference/relationship/ORM stuff, and turning things into a React hook. I rewrote what we had to use function passing, so that you could define your API endpoint as the simple Axios call (making it much easier to pass in options, like caching config, on a per-endpoint basis). So you’d define your resource nice and simple, then under the hood it’d wrap in the middleware, and you’d get back a function to make the request (or a React hooks doohickey, if you wanted). But typescript doesn’t really play nice with function currying, so it took some doing to wrap my head around enough of the type system to allow the template type to itself be a template-typed function. That nut cracked when I remembered that experience with C++ typing; in the end it actually came out pretty clean, although I definitely got Clever(TM) in some of the guts.
- RangerScience 2y agoAgree overall (yay data structures, and that types prompt thinking about them) but I don’t think you need types to make good data structures, and, just because you have types doesn’t mean you end up with good data structures. But yes, definitely - working in a typed language encourages that mindset, and it’s the application of that mindset that yields the benefits (imo).
- shreddit 2y agoThat’s why I really like to write some c++ in my free time after a week of javascript at work
- superfist 2y agoFrom js to c++?! Come on... For sure there is at least one thing js and c++ have in common - crappy standard library
- 0xbadcafebee 2y agoStrict types are a great way to paint yourself into a corner. Good design should only impose strict types within a single module, with very loose coupling outside the module (meaning loose types) Having a well defined data model is important, but you often can't really know what that data model should be until you've banged on a prototype. So the faster (in the long run), "better" way is to first prototype with very loose types and find what works, and then lock it down, within the scope of the above paragraph
- wtetzner 2y ago> Strict types are a great way to paint yourself into a corner. I've never really understood this stance. It's all code. It's not like you can't change it later. > So the faster (in the long run), "better" way is to first prototype with very loose types and find what works, and then lock it down, within the scope of the above paragraph I think this depends on the programmer, and what they're experienced with, how they like to think, etc. For example, as counterintuitive as it might seem, I find prototyping in Rust to be much quicker than in Python.
- pphysch 2y ago>> Strict types are a great way to paint yourself into a corner. > I've never really understood this stance. It's all code. It's not like you can't change it later. Try maintaining a poorly designed relational database. For example, I am dealing with a legacy database where someone tacked on an innocent "boolean" column to classify two different types of records. Then years later they decided that it wasn't actually boolean and now that column is 9-valued. And that's how you get nonsense like "is_red=6 means is_green". Good luck tearing the entire system apart to refactor that (foreseeable) typing/modeling error. The economical path is usually to add to the existing mess, "is_red=10 means is_pink".
- marcosdumay 2y agoThe stuff you are complaining about is caused exactly by lack of type strictness. Nobody fixes it because nobody has any idea on what code depends on that column. With strict types you just ask the computer what code depends on it, and get a list a few minutes later.
- rewgs 2y agoI totally agree, though this process isn't without its faults. One thing I've had to learn to be mindfull of is "type-crastination" -- if I'm not careful, I can really overdo it and spend way too much time and energy on defining types.
- tonetegeatinst 2y agoIv started with learning python and java during highschool but python really stuck. Now as I work on my degree iv started to try to learn C for reverse engineering and low level development. While I do understand some things its a big leap in terms of skill in python. I love how flexible it is and how fast it is. Recently I started a new challenge based on shodfycast's most recent video. ( https://www.youtube.com/watch?v=M8C8dHQE2Ro https://www.youtube.com/watch?v=M8C8dHQE2Ro ) and currently am just focusing on single thread performance, and using array structures. Then I realized my random number isn't true random and debating if my prg is sufficient enough. I also debated generating all the numbers at once into an array, throwing it into CPU cache, then doing the logic for rolls using the faster memory so I'm not waiting for numbers to generate. Single core laptop time is like 56 minutes using wsl. I'm tempted to try this on my dual socket system using tinycore Linux, so I can shave off some time from useless overhead and use some debug tools to find the slow spots. Unsure how much time I should sink into this though.
- constantcrying 2y ago>Unsure how much time I should sink into this though. You should stop immediately once you start learning less and are fixating on hyper specific problems. >I also debated generating all the numbers at once into an array, throwing it into CPU cache You don't control the cache. I recommend that you treat the CPU as a black box, strictly until you can no longer so so. If you are learning C and aren't even writing multi threaded code, you should not fixate on the specifics of how the CPU handles memory. Please pretend that is true. Manipulating cache is difficult. And you should worry about other things. This will become important when you are doing multi threading.
- constantcrying 2y agoYou can think about data structures in a fully dynamic language like JS or python. But you have to write software in a way, which utilizes these types and acknowledges that they exist. Thinking about what your data structures are is important in any language. Strict typing helps you in pinning them down and communicating them, but the approach is not exclusive to strict typing. Once your software is about passing anything objects around, you have already lost and proper thinking about data structures becomes impossible. I agree that stricter typing helps you to avoid that trap.
- brightball 2y agoThe funny thing is that...this is why I like dynamic languages. Because I do all of this with the database and when I'm using something like Rails, ActiveRecord handles all of the types automatically based on what I've already defined in the database. For web apps at least, about 90% of the data coming into and out of the application is just being stored or retrieved from the database. Converted from string to datatype in the DB and then converted back to string as it's being returned back. Enforcing types strictly in this layer that is largely pass-through can create so much additional boilerplate with minimum benefit since it's already handled where it matters. For a NoSQL DB, sure, I get it. You NEED the application to define your types because your database isn't. And then there are people who feel very strongly about having it everywhere, all the time and can't imagine working without it. I like that we work in a field where we can have options.
- bunderbunder 2y agoWhen you've really got your data structures and the rules for manipulating them pinned down, and you've built a good interface on top of it, the result is usually something that's so simple and easy to understand that it kind of doesn't matter anymore whether you're working in a static or dynamically typed language. IOW, I think that the value in static typing (speaking only about this specific issue!) isn't that it makes you do things well; it's that it puts a limit on how poorly you can do them. But I also sometimes worry that it puts a limit on how well people can do, too. I've met way too many people who tacitly believe that all statically typed domain modeling is automatically good domain modeling.
- throwanem 2y agoTo a decent first approximation, and especially given TypeScript's erasure and generally very opt-in design approach, types are just tests the compiler doesn't allow you to not run. That's not a good way to think about them forever. But it might be a good way to start thinking about them, for those as yet unfamiliar or who've only had bad experiences. (I've had bad early experiences with a lot of good tools, too, when learning to use them fluently required broadening my perspective and unlearning some leaky prior intuitions. TypeScript was one such tool. I don't say that's the only reason someone would bounce, but if that's the reason you-the-reader did so, you should consider giving it a more leisurely and open-minded try. You may find it rewards your interest more generously than you expected it might.)
- hamandcheese 2y agoI feel similarly about FP. It can be more work up front, but what a gift it is to your future self when f(x) == f(x).
- deleted 2y ago[deleted]
- kyledrake 2y agoWhen I make a web application, the first step in that process for me is designing the relational database model with a pencil, eraser and piece of paper. It makes the code a lot less messy when you have all the data sorted out before you get into it. I also find that it really helps me to understand what I'm building and how I need to build it. And it's a hell of a lot easier to change code than how data is being stored, so it's something I really try to get right and properly normalized the first time. I don't even attempt to do types at this point. It's really just about how the structure is going to look.
- klysm 2y agoEven in the code I always figure out the types/schema first. If you get the shape wrong, everything that follows is also wrong
- deleted 2y ago[deleted]
- et-al 2y agoLooks like that substack just copied a bunch of quotes from this Stack Exchange post: https://softwareengineering.stackexchange.com/questions/163185/torvalds-quote-about-good-programmer https://softwareengineering.stackexchange.com/questions/1631...
- kjs3 2y agoDidn't even bother to change the order of the quotes. That's bold.
- mrkeen 2y agoAnd that paragraph at the end came out of nowhere: > It’s why one of the Senior Engineer (L5) requirements (at least for FAANG) generally involves writing higher-level design docs for more complex systems (which includes driving team planning and building good roadmaps for medium-to-large features).
- kjs3 2y agoI wonder if he'll file a bug report with whatever AI ghostwriter he's using.
- dang 2y ago
- makeramen 2y agoSo basically [engineering] design is more important than implementation details. I would say the "engineering" part of the design is also optional, as product design is also another lever of higher influence than code optimization.
- deleted 2y ago[deleted]
- antipaul 2y agoCan a "class", eg in Python or Java, be considered an example of the "data structure" Linus and others are talking about here? Or are they only talking about tables in databases and such?
- layer8 2y agoThe class interface (interface contract) falls under the general point being made, but not the class implementation (implementation details).
- RangerScience 2y agoIMO, “wrong question”, but thanks for asking. IMHO - “class” definitions are really just a data structure (abstractly, a possibly-nested hash) with associated functions, and that’s it. This is extremely apparent in Perl, where that’s literally what a “class” is - a hash data structure “blessed” with a class name. JS is almost identical (a class is a hash where some of the values are functions), and “under the hood” both Ruby and Python are similar (although in very different ways - consider that the first arg in a member function in Python is the instance). Database schema is (usually/mostly) just that structure without those functions; then you maybe use an ORM to provide them again. So, IMO, on a theory and design level, both the database table and the data part of a class definition are “data structures” (note that you should include in considerations the relationships between data structures)
- jghn 2y agoTo take this a step further, IMO a big issue with how OOP is taught & practiced is that people approach it from the wrong direction. As classes provide both data and functionality, it's better to first model your data and then think about the functionality to provide on those data. But people tend to think about relationships & actions (i.e. functionality) first and model their data to that. The two approaches will tend to produce very different data structures. I'd agree with the sentiment from the OP that being data-first is ideal.
- 0xbadcafebee 2y agoYes, classes are data structures. A data structure is the construct by which you organize, process, retrieve, store, etc data. A traditional "struct" or "table" is how people think of a data structure, as a sort of dumb layout of 1s and 0s in a file or memory somewhere. But how that data is separated, accessed, what constitutes "valid" data, how it is presented to you, what you can do with it, etc is all part of what constitutes the "structure" of the data, because the "structure" enforces what that data looks like, how it behaves, etc. A class fits that purpose aptly. If water is data, then a straw, a vase, a kettle, a pool, a water pump, even a hydroelectric dam, are all data structures. They enforce the form of the water, what goes in, how you access it, how it comes out, etc. You might say "but doesn't a function do the same thing?", and, well.... yes. A data structure is kind of like a tightly-bound collection of functions that take in data and put out data in particular ways. A data structure in memory or on disk, without program logic attached to it to enforce the structure, is a "data format". The hope is that a program will do the right thing with the data according to its intended structure.
- deleted 2y ago[deleted]
- swyx 2y agoA conclusion I reached a while ago: all the work we do in code is far more likely to be shorter lived than a single good decision that we have in data. https://www.swyx.io/data-outlasts-code-but https://www.swyx.io/data-outlasts-code-but
- delichon 2y agoThe good decisions are invisible. The bad decisions just seem to live forever.
- cpeterso 2y ago“Show me your flowcharts [code] and conceal your tables [data structures], and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious.” -- Fred Brooks
- polygotdomain 2y agoI think this quote misses that there can (and arguably should) be differences between your persistence model and your actual data structures. I'd argue that keeping things 1:1 with your underlying tables is incredibly restrictive and leads to models that miss out on the expressiveness that's available in modern languages.
- wtetzner 2y agoI think the brackets were simply suggesting that flow charts are analogous to code and tables are analogous to data structures in that quote. Not that your tables and data structures in a concrete system will be the same.
- quantum_state 2y agoWould like to be clarified to: information + relationship among it components, including how they get transformed by computation.
- krooj 2y agoLinus always has a great way of summarizing what others might be thinking (nebulously). What's being said in the article is really mirrored in the lost art of DDD, and when I say "lost" I mean that most developers I encounter these days are far more concerned with algorithms and shuttling JSON around than figuring out the domain they're working within and modelling entities and interactions. In modern, AWS-based, designs, this looks like a bunch of poorly reasoned GSIs in DDB, anemic objects, and script-like "service" layers that end up being hack upon hack. Maybe there was an implicit acknowledgement that the domain's context would be well defined enough within the boundaries of a service? A poor assumption, if you ask me. I don't know where our industry lost design rigor, but it happened; was it in the schools, the interviewing pipeline, lowering of the bar, or all of the above?
- bell-cot 2y agoWith decades of exponential growth in CPU power, and memory size, and disk space, and network speed, and etc. - the penalties for shit design mostly went away, so you could usually get away with code monkeys writing crap as fast as they could bang on the keyboards.
- mattgreenrocks 2y agoI’d argue software design has never been taken seriously by industry. It’s always cast in negative terms, associated with individuals seen as politically wrong/irrelevant and brings out ton of commenters who can’t wait to tell us about this one time somebody did something wrong, therefore it’s all bad. Worse, design commits the cardinal sin of not being easily automated. Because of this, people cargo cult designs that tools impose on them, and chafe at the idea that they should think further on what they’re doing. People really want to outsource this thinking to The Experts. It doesn’t help that isn’t really taught, but is something you self-teach over years, it is seen as less real than code (ergo, not as important). All of these beliefs are ultimately self-limiting and keep you at advanced beginner stage in terms of what you can build, however. Basically, programmers collectively choose to keep the bar as low as possible and almost have a crab-like mentality on this subject.
- 2y ago
- mcny 2y agoSpeaking of data structures, I am curious what you guys think of the Entity Attribute Value model. I worked on an e-commerce "platform" that used EAV and I always struggled to write queries to find anything I needed. https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80...
- hipadev23 2y agoIt’s basically the standard. How else do you add arbitrary key/values to entities? You either normalize into EAV, Map column, or a pair of Array columns.
- hipadev23 2y agoArgued this for a long time yet so many devs insist on MongoDB and other similar schemaless data stores
- carlmr 2y agoI've found that a lot of junior developers are so scared of making a wrong database schema in SQL that they rather pick a schemaless database. Which of course if you're not careful leads to multiple conflicting ad-hoc implicit schemas in your NoSQL database. I.e. maintenance headaches. Ideally do a meaningful MVP schema and then iterate on it. Schema migrations can be done. And it saves you so many headaches later on to have a reliable schema for your data.
- pmarreck 2y ago> When I read this quote, I actually was able to recognize countless examples in the past of this. I once worked on a project where we spent quite a while optimizing complex algorithms, only to realize that by restructuring our data, we could eliminate entire classes of problems. We replaced a 500-line function with a 50-line function and a well-designed data structure. Not only was the new code faster, but it was also much easier to understand and maintain. (Of course, then the problem also shifted “down the stack” to where the majority of toil was in restructuring existing data.) This is really a preference, then. I encountered almost this exact sort of problem in my last project. I wanted a simpler database design and more complex querying/code, they wanted a significantly more complex database design that was harder to understand (for everyone but the guy who spent all of one weekend designing it) but simpler querying/code (that was also more plentiful as a result). The question really is, where do you prefer your complexity to go? Do you want to lean on the database, or your code? Simple example, you have a portfolio of stock that constantly changes in composition and value over time. Do you: 1) only store the current model of the portfolio in a "portfolios" table and the current prices of stocks in a "stock_prices" table and use a separate history table for both (with stored procedure triggers to automatically copy all changes to it) to store all previous versions that can then be queried separately if needed, OR 2) store each change in both quantity and price across multiple tables, no separation of what is "current" vs. what is "historical" other than the relationships that are (properly, hypothetically) set up via an "intent_versions" table at the top level, requiring a bunch of joins to actually determine the state of the portfolio both now and at any point in the past? I opted for the former because I have no fear of complex queries, the center of thought-mass of the team leaned towards the latter. WWYD?
- deleted 2y ago[deleted]
- throwaway984393 2y ago[dead]
- deleted 2y ago[deleted]
- ashton314 2y agoThis is the principle behind “How to Design Programms” [1]: Bild your data structures, then the form of your functions on those structures should correspond more or less exactly to it. [1]: https://htdp.org/2023-8-14/Book/index.html https://htdp.org/2023-8-14/Book/index.html
- dswilkerson 2y ago"Show me your flowcharts [code], and conceal your tables [schema], and I shall continue to be mystified; show me your tables [schema] and I won't usually need your flowcharts [code]: they'll be obvious." -- Fred Brooks, "The Mythical Man Month", ch 9.
- datadrivenangel 2y agoI came here to share this quote because it's so true. Except when the effort to change the database schema becomes significantly greater than the effort to change the code, and then application developers start abusing the database because it's faster and they have things to do.
- sjm 2y agoI once wrote to John Carmack as a Quake-obsessed kid, asking for any advice he has for an aspiring programmer and if he had any favourite books. To my surprise he wrote back a really thoughtful response, including the following: "Read The Mythical Man Month. I remember thinking that a book that old can't say anything relevant about software development today, but I was wrong."
- slowhadoken 2y agoRDBMS bored me to tears when I first studied it but it’s an invaluable way to view at data and structures.
- jdeaton 2y agoI dont understand what it means to “move complexity into data”
- gowld 2y agoComplicated algorithm over an array vs simple algorithm over trees and tables and sets and records.
- breadchris 2y agoI think of code vs types analogous to the function vs form argument in design. If a website needs to be shipped ASAP, I should prioritize types less. If hundreds of engineers rely on some code, I care about types. Language also influences how important types are, regardless of function. Haskell is strict, LISP is less so. Python, being closer to LISP in syntax, but surfacing powerful C (closer to Haskell) primitives has proven valuing function over form can be empowering. Premature modeling of a domain in verbose types (ex. struct vs any) can slow down rapid iteration in comprehending what is valuable from data or how users may actually use code. Someone might need not just one, but infinite cat pictures in their file upload, but the code _and the types_ treat this as a single value. Another example is using JSONB columns in their RDS initially and normalizing fields into columns when needed. A more flexible type system saves time in early iteration cycles.
- constantcrying 2y agoCorrect, nothing improves code quality and performance more than having the right data structures. This is also something which I learned far too late, my programming education focused very much on algorithmic thinking. That is important, but only helpful if you have already chosen the right data structures. Many times I have had the situation that the code I was writing was confusing and only a small part of it had to do with solving the actual problem. If this ever happens to you, you should rethink your data structures and consider whether they were chosen correctly. Also, when reading code for the first time you should be looking at the data structures before anything else.
- fungiblecog 2y agoThis principle also applies at the business level. I’m constantly dealing with business analysts who obsess with processes (code) but don’t first take time to understand the entities and their relationships (data). The result is that when it comes time to build something they cannot communicate with the developers about what the data model should look like. The processes get implemented and the data model is put together on-the-fly rather than being carefully designed.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- taeric 2y agoA major caveat for folks in this line of thinking, though, is to avoid falling into the "one true schema" trap. Data can and will be duplicated in your system. A large part of the "consistency" battle people should be having is how long before a lot of that duplication is as expected. Not making sure it is never inconsistent. That is, it is easy to see many junior efforts stall out during schema design thinking that you can solve all issues with a fancy method of storing the data. It isn't the schema that is important about your data, so much, but where different updates to it are known first and what they will need to go with it.
- packetlost 2y agoThere are two types of applications: one where you know your data model from the beginning and one where you don't. Static types work exceptionally well when you're modeling something you understand pretty well; especially to the point where it is not expected to change significantly. On the other hand, a lot of programs find their data model while being made. This is fine too, what is expected from a program can change, sometimes a lot. I've built both types of applications in both types static and dynamically typed languages. What your team knows matters more than either of these.
- giovannibonetti 2y agoThat's why modern languages that encourage type-driven development like Rust and Gleam are a godsend. Just look at the things of things you can encode in the type system. It can prevent issues like mixing up numbers in different units: https://blog.hayleigh.dev/phantom-types-in-gleam https://blog.hayleigh.dev/phantom-types-in-gleam
- thesnide 2y agoTIL that it was named phantom types. I use them in C via struct/union. It is a little more verbose to use, but offers type safety when needed without any runtime penalty. That, and a good naming scheme : always encode the unit in the variable name. Always. timeout_ms is much better than timeout, unless timeout is a human readable string. Same for any config file parameter.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- alphazard 2y agoData structures are not the same thing as types. Data structures are bit patterns and references to other bit patterns (pointers or relationships). Types (as they are used in programming languages) place some constraints on those bit patterns, but can also encode many other language features. Creating an elaborate type hierarchy with unnecessary abstractions is not what is meant by "worrying about data structures", and that tendency is one of the most common failure modes for otherwise smart engineers.
- phkahler 2y agoTypes are data structures that the language is aware of. This allows the tooling to do checks that they can't do on plain old data structures.
- Arelius 2y agoI think this is a subtle and important point. Types are a potential useful tool to restrain and and specify the schema of data structures. But concern for types is very different then concern for the data structures.
- atomicnature 2y agoGood catch. Equating data structures to types is an over simplification that misses the core point. I think the original call here is to simply think harder about the problem and avoid picking structures that'll burn you later. For example, take Unix pipes, see how far they've traveled, how many domains, how many use cases. It's a brilliant way to visualize system building while respecting the constraints of minds and machines. And it took Ken and others quite a while to realize something like pipes could make sense in Unix. It was not an insight easily obtained but required a bit of hustle and followup and obsession with finding the right building blocks for a system.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- skywhopper 2y agoThis is how I think about most of my coding, so it must be true.
- deleted 2y ago[deleted]
- ants_everywhere 2y agoThis is essentially the point of view of functional programming and category theory. You have some data object whose structure provides constraints on how it can be transformed. And then the program logic is all about the structure-preserving transformations. The transformations become simpler and easier to reason about, and you're basically left with a graph where the transformations are edges and the structures are nodes. And that's generally easier to reason about than an arbitrary imperative program.
- constantcrying 2y ago>This is essentially the point of view of functional programming and category theory. No, it isn't. This is the point of every language philosophy, you will find OOP and procedural people arguing exactly this. Correctly defining your data types is important and applicable in every language and every paradigm. The view of functional programming is that objects shouldn't be transformed and that mutation should be avoided. That is unrelated. The point of category theory is that different patterns of relationships are common across mathematical fields. Which is totally unrelated and has nothing to do with anything discussed here. Maybe you meant type theory? But that also has no relation.
- ants_everywhere 2y agoNope I meant category theory > Maybe you meant type theory? But that also has no relation. Hmm? Category theory and type theory have a lot of close ties. For example see the Nlab page on their connections https://ncatlab.org/nlab/show/relation+between+type+theory+and+category+theory https://ncatlab.org/nlab/show/relation+between+type+theory+a...
- robertlagrant 2y agoOP is saying neither of those relate to the problem. Not that they don't relate to each other.
- AndrewKemendo 2y agoIt’s so interesting because I started doing professional engineering AFTER doing day to day data and statistical analysis in statistical systems like matlab, R and early Python. So my view of engineering has always been based on managing two things: functional state and data workflows After doing software engineering professionally for a decade now I can tell you that: 1. Most “scientific” engineers back to Minsky, Shannon etc… describe the world of computing in terms of state management, data transformation and computing overhead management. All of the big figures and pioneers in software cared A LOT about data and state basically that’s all computing was at the beginning and was expected to be the pattern moving forward 2. There’s absolutely no consistency in what are the foundationally important assumptions in engineering system design that are always true such that everyone does them - and the ones that do are fads at best 3. Business timelines dictate engineering priorities and structures much more than robustness, antifragility, state management etc… in the vast majority of production software 4. Professional organizations like guilds, unions, etc… are almost universally rejected by software engineers. Nobody actually takes IEEE seriously because there’s no downside if you don’t. This ensures there’s no enforcement or self-regulation in engineering practices the same way there are in eg Civil and biomedical engineering. Even then those are barely utilized. Overall the state of software development is totally divorced from its exceptionally high minded and philosophical roots, and is effectively led by corporations that are priorizing systems that make money for people with money. So what is “good” has very little to do with what is incentivized
- ramesh31 2y agoThe best code is no code. Which is why the best programming language (Lisp) expresses code as data.
- Avshalom 2y ago"you should actively seek ways to shift complexity from code to data." but also somehow we're supposed to write everything to read write flat text... Thanks UNIX!
- pphysch 2y ago"flat text" meaning ASCII/UTF encoded streams of bits/bytes... It's all 0s and 1s under the hood, and encodings make that much nicer to deal with without excessive abstraction. Give me UNIX everything-is-a-file / byte-stream paradigm over PowerShell's complicated object ontology.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- austin-cheney 2y agoThere are some grave problems with this article. I agree with the basic premise 100% but the article over simplifies the idea to focus on data. It isn't just about data, data structures, or even relationships. It is about organization in general, and most people cannot perform at that level. To be clear: Good programmers worry about the organization and cleanliness of their code. They worry that their code is reduced to the smallest of forms, consistent in expression, and exceptional in measure. The limitation here is personality and not intelligence and there is a lot of data on this. The personality metric of concern is conscientiousness, which is how a person perceives the world outside themselves. This one thing is responsible for self-discipline, concepts of organization, initiative, half of empathy, and much more. People at the extreme high end of this lean more towards things like authoritarianism, obligation, duty, healthy living, and social alignment. These people find joy in putting things into order and discerning relational structures. People on the low end tend to be free spirits, are more likely to experiment with drug use, can't clean their rooms or pick up trash even if you put a gun to their heads. Concepts of work effort and self-reliance are almost entirely unimaginable. These people cannot organize anything and they require absurd rewards to accomplish the smallest tasks, and even still the output of their efforts is fleeting and temporary. They simply cannot see abstract relational concepts and cannot be compelled so. Strangely, low scoring people struggle to discern value from a thing as they cannot perceive separations of vanity from functionality. Yet, they have no problem selling things in full awareness that if they cannot perceive value then neither can most other people. High scoring people don't do this and thus tend to make less effective merchandisers. High scoring people tend to perceive low scoring people as slobs, sloths, and an anchor on social progress. Low scoring people tend to perceive high scoring people as perfectionists, prudes, and unnecessarily distracted on trivialities far outside their imagination. The common assumption is that people who are brilliant at abstract organization and industriousness must be more intelligent. This makes sense because these people tend to be more successful in all aspects of life other than careers in entertainment. That assumption is completely wrong, though. Conscientiousness is negatively correlated to intelligence at -0.27, according to various studies.
- spratzt 2y agoFor those interested in escaping the Hacker Prison where ‘Weeks of coding can save hours of thinking’ I strongly recommend William Kent’s book “Data and Reality’.
- latte1226 2y ago[flagged]
- divbzero 2y agoLinus Torvalds’ git is the perfect case in point: wonderful data structure wrapped with adequate tooling.
- aryehof 2y agoSuch advice is dangerous in the assumption that there is only one type of problem in programming. One type of domain - applications related to the computer and data sciences and computing infrastructure. While GIT might be particularly about data structures at it’s core, might I suggest you don't try to model into code your next complex payroll, insurance quotation, supply-chain or billing system as a composable set of lists, stacks, queues and trees, modified by code that grows over time to increasingly looking like a big ball of mud.