11 ms·
Polylith is a functional software architecture at the system scale
- tluyben2 5y agoIt is probably/definitely me but I watched the long video and did not learn anything and then read the GitHub example for a few minutes and got it. I have a hard time understanding why ‘young people’ (or maybe all people outside myself as it sometimes feels) enjoy videos; text is so much faster for everything but learning how to render a wall (stuff with your hands). Then again, I never went to lectures in uni vs reading books, papers and syllabi; the latter I found to be much faster. Anyway, congrats with the project; it seems pretty common sense idea wise so it is nice but cannot see many people jumping through the hoops and adopt it; people are too opinionated (including me).
- Rodeoclash 5y agoI couldn't agree more. I produce a bit of music and one thing I can never remember how to do without looking it up is side chain compression. I don't use it very often but when I do, I always have to Google what the controls / routing is to be able to do it. In the beginning it was forum posts, maybe with a couple of images to help illustrate where to click etc. Now it's 10 minute YouTube videos replete with needless introductions about the person creating it and hat in hand begging for likes or subscriptions. You have to go digging to find what you're looking for. I've been experimenting in this space a bit though (weirdly enough with video game tutorials). I'd be interested in how others find this format for learning or understanding concepts. Here's an example https://apex-fundamentalists.vodon.gg/videos/0e074984-f9f0-4c49-b74c-d36b24e2e4c4 https://apex-fundamentalists.vodon.gg/videos/0e074984-f9f0-4...
- staticassertion 5y agoVideo is nice for multitasking. I can't read and do anything else at the same time. I can listen to a video, glance at it, and do other things too.
- rco8786 5y agoThere’s absolutely no way you’re internalizing what’s in that video while it’s playing in the background.
- tluyben2 5y agoThat's my issue too; it is fine for tv shows and movies to register if they are worth watching 'for real', but also there, if I am working on something hard, I often notice that 4 episodes have passed and I have 0 clue what happened.
- staticassertion 5y agoSure there is. I code while watching videos all the time.
- logarhythm 5y agoThanks for the feedback, and I'm glad to hear that you understood the concept from the text documentation. We decided to include both videos and text in the documentation because we know that people are different, and have different preferences for learning. You're right that people are opinionated, and that it's difficult to convince them to try new ideas. However, I've been pleasantly surprised at how open the Clojure community has been to our concept and at the momentum it's starting to build. It'll be interesting to see if other language communities have the same mindset.
- tluyben2 5y agoIt's great you do this really. More ideas on how to actually get to LEGO (promised in software for a long, long time) like development. But yeah, even more than languages, I would think you need a massive following to get traction. Happy the community likes it!
- ModernMech 5y ago> More ideas on how to actually get to LEGO (promised in software for a long, long time) I think for this reason the Lego analogy needs to be completely abandoned. Every effort of software modularization has been analogized to Lego at some point, and yet they all fall short. No arhicture claims they are the equivalent of twine glue and toothpicks, even if that's what it ends up being. So any N+1 language/framework/architecture promising it's going to be Lego (for reals this time), even if it does actually deliver, will not be taken seriously when they make the claim.
- tluyben2 5y agoWell, good ABI/API’s and, let me really clearly separate this from the word ‘good’, standard OS GUI frameworks like Windows wpf and Mac OS X cacao for frontends is as far Lego as I have seen for now. Web frontends is where it all goes terribly wrong; nothing fits and everything breaks when you put X into Y when X and Y are from other authors generally. It is a shit show. But for backends and internally it can be done with good APIs. Problem is… not many people can write those, so you end up with something that says lego on the pack but is in fact lego after your ‘always was a bit weird’ cousin played with it with his flamethrower.
- FpUser 5y ago>"It is probably/definitely me but I watched the long video and did not learn anything" This is because the video says how nice would it be to have a banana without a slightest description of what the banana is and why do we need it. Absolutely useless video. And yes I very much prefer reading a document for understanding concepts. As for the project itself. I did a very brief reading and I fail to grasp any particular value. Basically what I understood is that if you organize your code in some particular way we will do some particular things. Maybe if they've presented clear example I would be willing to dig in deeper. For now I've "invested" couple of minutes and watched that "nothing" video and I do not think I'll invest any more time. Maybe it is my loss and their idea is amazing but they definitely do not make it easy to understand what's in it for me.
- logarhythm 5y agoBefore you completely give up on understanding the concept, I would like to suggest you try the 10-minute "Polylith in a Nutshell" video: https://www.youtube.com/watch?v=Xz8slbpGvnk https://www.youtube.com/watch?v=Xz8slbpGvnk If you watch it at 1.5x speed, then it'll take less than 7 minutes of your time. If you're still not getting the "why" of Polylith after this video, then I'd be very grateful if you could give us some quick feedback on what you're missing. That will help us figure out how to explain the concepts better in the future.
- cjg 5y agoThat was the video I watched and I just don't get what is different about polylith. The video spends too long telling me things I already know - e.g. what are functions / objects / layers / etc. Tell me something I don't know - such as what makes Polylith unique. The video says this is "Components". Well what's so different about those? They sound like microservices or perhaps high-level objects. Or perhaps interfaces. Show an example!
- logarhythm 5y agoThe idea with that part of the video was to couch the new concept (components) within the framework of existing concepts (functions, objects, layers, etc.) to try to help people connect the new concept at the right place in their knowledge graph. Though your feedback makes me think it didn't work as well as I hoped. Components do have attributes in common with microservices and with stateless objects (e.g. a public interface and encapsulated implementation). Where components differ from microservices is that a component's interface is simply a collection of functions, rather than network-facing endpoints. This means that multiple components can be deployed into a single artefact, keeping deployment complexity and cost down. Where components differ from objects is that a component is a higher-level abstraction, closer in scope to a microservice. However, we think that Polylith's biggest differentiator is the separation it gives between development and production. Let's say you have a Polylith project with 100 components, that you deploy in production across 10 services. You can work with all 100 components in a single development environment, and test them as though they're a monolith, even though they're not deployed that way in production. It's a lot like building systems with LEGO, and we think its just as fun!
- rco8786 5y agoAgreed wholeheartedly. It’s something that has been bugging me for a while. I can consume information maybe 3-5x faster (or more?) via text vs video but every trend I can see points to video being the preferred medium for Gen Z. Is it because they’re “video native” and know how to navigate it better? Surely they’re not sitting through 2 minutes introductions. Do they inherently understand how to return to the important parts of a video for future reference? My brain just does not operate like theirs, it seems.
- deleted 5y ago[deleted]
- tluyben2 5y agoI wonder the same; often I look up programming things and the first links are videos. So I try to watch one and immediately I think; how can anyone anyone do work like this? I needed a flag for ls and was too lazy to read the man page; the result was already put in 1 line on top by Google. Of course I needed only 5 chars only. Then I clicked the video that answered the question for fun; I will try to find it but I think it was 15 minutes of drivel… I just don’t get it. I mean sure I understand why the video makers do it, but who consumes this crap? And why? And it is getting worse; I like watching live streams of programming, but when you actually want to learn something and therefor need to enter code yourself, there is nothing more inefficient medium than video imho.
- hackerfromthefu 5y agoIt could be habit from the wiring of their brain being setup for video from social media. But following your idea of finding a reason that assumes it's actually more beneficial learning from video than text for people in that class, you need to consider two alternatives. The first is that they are better at video, but the second is that they are worse as long form text.
- rco8786 5y agoOh yea, I totally assume that they know what they’re doing. It’s just clear that I’m not wired that way. I didn’t grow up with videos accessible to the point of ubiquity like Z has.
- tuukkah 5y agoTo save some time for those working on frontends, from the FAQ: "There are several reasons why we don’t support Polylith for the frontend at the moment. One of them is that frontend development has other needs than backend development." https://polylith.gitbook.io/polylith/conclusion/faq https://polylith.gitbook.io/polylith/conclusion/faq
- phtrivier 5y agoIn a sense, some of it could be adapted, but with relaxing the idea of "components are pure functionsnindependant of a base" to "components are pure functions producing data usable by a given base using a given UI framework". For example, in a react / redux app, you would have "pure" components representing the business logic of your app, either a component or a base that actually stuff them in a redux store ; a multiple "react-components" that returns jsx ; and at least one "react base" (or react/redux base) that ties everything. Different projects would be "your real application", "your dev server connected to local stub services", "your storybook execution", etc...
- servytor 5y agoCool, it's written primarily in Clojure!
- logarhythm 5y agoI'm a member of the team that created Polylith, so feel free to ask questions or give feedback. Polylith has been gaining momentum within the Clojure community. As an example, you can follow along with Sean Corfield's journey migrating the World Singles codebase to Polylith: https://corfield.org/blog/2021/02/23/deps-edn-monorepo/ https://corfield.org/blog/2021/02/23/deps-edn-monorepo/ There's an active Slack channel, with people and teams using Polylith on both commercial and side-projects: https://clojurians.slack.com/archives/C013B7MQHJQ https://clojurians.slack.com/archives/C013B7MQHJQ Outside of the Clojure community, there's a project to port Polylith to Python, using Poetry: https://pypi.org/project/poetry-polylith-plugin/ https://pypi.org/project/poetry-polylith-plugin/ We'd love to see it get ported to other languages too!
- transitivebs 5y agoReally enjoyed your team's breakdown of different architectures on https://polylith.gitbook.io/polylith/conclusion/current-arcitectures https://polylith.gitbook.io/polylith/conclusion/current-arci...
- logarhythm 5y agoThanks! It was a bit nerve-racking to give traffic light ratings to existing architectures that people use and enjoy, but I hope we were fair in our assessment.
- TruthWillHurt 5y agoWhat company is behind Polylith?
- tengstrand 5y agoThere is no company behind Polylith, just me (Joakim Tengstrand), Furkan Bayraktar and James Trunk.
- TruthWillHurt 5y agoAh, shame. I mean - good for you and amazing work! I was hoping to apply to work for such an innovative and brave company :D
- Kinrany 5y agoI have a feeling that the gitbook could use an editor who would throw away half the content and reword the rest to be concise and concrete. For example, "Polylith in a Nutshell" mentions (pure) functions, but they never come up again.
- logarhythm 5y agoThanks for the feedback, we appreciate it. It's tricky to pick the right level of detail when explaining an idea like Polylith. If we could precisely identify the level of understanding of the reader, then we could tailor the content to perfectly match their experience level and vocabulary. Unfortunately, we can't do that, so we have to pick a middle ground, where we probably over explain some concepts, and under explain others. However, we'd be grateful if you could give us some specific examples of sections or pages that you didn't find useful or enlightening.
- Kinrany 5y agoIt seems there are several independent ideas somewhat mixed together. The idea number 0 is component interfaces. They seem equivalent to plain old interfaces in all the other languages. (Except some reflection may be necessary in statically typed languages to process the lists of functions in a generic way?) The idea number 1 is bases. They are domain-agnostic adapters that convert component interfaces (aka language-native interfaces) into language-agnostic interfaces. (Except they seemingly do include domain logic because they combine several components before exposing them?) The idea number 2 is project layout, I think? It appears to be more of a supporting convention at best, not sure.
- tengstrand 5y agoWe have a similar question in the FAQ, so I just copied the Q/A here (https://polylith.gitbook.io/polylith/conclusion/faq https://polylith.gitbook.io/polylith/conclusion/faq)! Question: What parts of Polylith are important and what are just “cermony”? Answer: The short answer is that all parts are needed: interface: Enables functionality to be replaced in projects/artifacts. component: The way we package reusable functionality. base: Enables a public API to be replaced in projects/artifacts. library: Enables global reuse of functionality. project: Enables us to pick and choose what functionality to include in the final artifact. development: Enables us to work with all our code from one place. workspace: Keeps the whole codebase in sync. The standardized naming and directory structure is an example of convention over configuration which enables incremental testing/builds and tooling to be built around Polylith. I also want to add one thing, and that is that Polylith combines the LEGO-like blocks of code (components/bases) outside of the language itself. In Clojure we use tools.deps, but in other languages we would use other tools, like Maven in Java, to combine the different source directories into projects (that is built into aftifacts in the end, like libraries, tools and services).
- dantodor 5y agoHonestly, I don't know enough Clojure to understand the proposal, and all the explanations are centered around it. My current understanding is that what you propose is an ascribed way of doing things by mixing several pre-existing concepts, like mono-repo, convention over configuration, and some generic dev principles that are universally desirable, like components "ensure encapsulation and composability but at the same time they are simple, easy to reason about, and flexible" - nothing wrong in that, all good principles, but I fail to understand how you enforce it. Because usually every monolith or micro-service out there starts with that in mind, and ends with spaghetti, because dev happens. At least that's my experience with Elixir/Phoenix umbrella apps, which, as per my current understanding, is the closest thing I see to Polylith. However, I would be very curious about your traffic lights evaluation. Generally, I would consider a "large" app something like 200+ microservices (yes, I'm biased towards that). In your FAQ, you describe and app that needs 4 services. Sorry, that doesn't qualify as a large distributed system. First, I would really doubt you can find a monorepo which is one language only (sorry, I didn't understood how Polylith would work if I have a codebase that's Scala, Elixir, Rust and Python, by example). Second, I don't understand how you handle builds. Third, I don't understand how you handle deployments and other operational concerns.
- logarhythm 5y agoYour understanding of Polylith is essentially correct. It is a combination of existing ideas, such as monorepos, convention, components, interfaces, encapsulation, and static code analysis. However, I'd argue that what emerged in Polylith from those ingredients was more than the sum of its parts - due to how those particular concepts resonate with each other. For example, because of the forced conventions, it's trivial for the Polylith Tool to perform static code analysis on a Polylith codebase. This means that the tool can identify the subset of tests to run, based on the components that have changed since the last run. Which leads to a fast-feedback loop, and encourages both good testing practices and fine-grained component modularity. Polylith gives you a system-level architectural building block; the component, which encourages a modular design and separation of concerns. However, you're right that it's still possible to create spaghetti code with Polylith. All it would take is poorly designed components, with bad names, multiple reasons to change, and exposing their state everywhere. However, I'd argue that when you give someone a well designed tool (like Polylith), then they're more likely to craft a well designed product with it. To understand how builds and deployments work with Polylith, I'd recommend reading the "Workflow" section in the Polylith Tool's documentation: https://polylith.gitbook.io/poly/workflow/shell https://polylith.gitbook.io/poly/workflow/shell (especially "Build", "Git", "Continuous Integration", and "Testing").
- yakshaving_jgt 5y ago> Polylith addresses these challenges by introducing simple, composable, LEGO-like bricks, which can easily be shared across teams and services. …Like functions and values?
- logarhythm 5y agoExactly! Components are an attempt at scaling-up functions to a system-level building block, whilst maintaining as many of the benefits as possible.
- SinParadise 5y agoWhat do you do in the cases of high coupling between components (parent child) or between a base and a component? You just let the couplings happen or they themselves turns into an individual component/base? How do you decide whether or not the resulting highly coupled component + base is a component or a base? Say in your Real world app you have a SQL for getting articles by user in store.clj. How do you decide if that SQL lives in article component or user component?
- tengstrand 5y agoI would say it's up to you to decide what you think works best, as long as the bases only contain the code needed to expose the public API and then you divide the rest of the code into components. The good thing with Polylith is that it's easy to refactor the code by splitting up existing components. When you add new functionality, you either add to an existing component or create a new one. Polylith allows you to make the components tiny with almost no performance penalties, and that is also our experience, that components tend to be really small, or be divided into many small namespaces. To answer your second question, I would make the same considerations as in any other architecture. If the SQL only took a user ID and didn't contain business logic from the user domain, then I would just put it in the article component, but if the SQL had to contain logic from the user domain (more than e.g. just translating user name to user ID) then I would extract that logic into the user component. Exactly how you combine this into a query is an implementation detail that can be solved in several different ways (and it often gets quite ugly!). This is how I think about it in general, but there are always situations when it's right to break "rules"!
- samatman 5y ago> If you prefer to start from the beginning, and take things at your own pace, then you're already in exactly the right place - just keep reading. If you don't mind a drive-by suggestion as I keep reading, this should be the first bullet in the list. It's a tiny speed bump in the funnel, but I could feel my attention dwindle until I got to "oh, there's more to read if I click the large, friendly button".
- logarhythm 5y agoThat's useful feedback, thank you. I'll suggest that change to Joakim.
- emperorcezar 5y agoCool. A way for me to "market" good software design to others without them realizing it's just normal modular design with reasonable best practices. Sadly most people need a fancy name and slide deck for this.
- tengstrand 5y ago"Normal" good software design takes you a bit, but it doesn't give you LEGO-like building blocks, and it will still be hard to share code between services. Polylith gives you a single development experience that you would not otherwise get. Take a look here to see what I mean: https://polylith.gitbook.io/polylith/architecture/bring-it-all-together https://polylith.gitbook.io/polylith/architecture/bring-it-a...
- emperorcezar 5y agoIs there tooling or something special around this? I'm not trying to be a curmudgeon, but I'm having a hard time seeing what is novel here other than applying a name to component based modular software design.
- logarhythm 5y agoHave you read the "Advantages of Polylith" page? https://polylith.gitbook.io/polylith/conclusion/advantages-of-polylith https://polylith.gitbook.io/polylith/conclusion/advantages-o... It tries to summarise the benefits from both a development and deployment perspective.
- ricardobeat 5y agoThat page doesn't clarify much to me. How exactly do you deploy pieces of the app as different services, while keeping it a monolith in development? Especially this thing not being a framework. Standard go/node modules give you "lego-like" pieces too. The real world example only has one "base" that puts everything together under a single API, so doesn't help understanding how this would be deployed as multiple services.