• xyzzy_plugh an hour ago

    This is only true when the dependency structure is not already apparent. Almost all modern languages solve for this in their import statements and/or via their own package manager, at which point pushing everything up into Bazel is indeed redundant.

    If anything this highlights the failure of languages solving for this themselves. I'm looking at you, C++.

    It's no surprise Bazel is a hard sell for Rust, Go, Node, etc. because for those languages/ecosystems Bazel BUILD files are not the best tool to represent software architecture.

    • jmmv 33 minutes ago

      The problem is that anything that's _apparent_ and not _enforced_ will be messed up over time. Maybe not in a project with few people where everyone is an expert on how "things are supposed to be", but it will inevitably happen when you add more and more people.

      And the whole point of the article is to say that import statements do actually _not_ solve this issue, because import statements are at the file level, not at the module level (whatever module means in your mind).

      In any case. As I mentioned in the article en passing, other languages _do_ provide similar features to Bazel's build files though, and I explicitly called out Rust as one of them. When you are defining crates and expressing dependencies via Cargo, you are _essentially doing the same_ as what I was describing in the article. Same with Go if you are breaking your code apart into multiple modules

      But then we all know that there are some huge repos out there that are just "one module" and you can't make anything out of their internal structure. Hence you start breaking them apart into Crates, Go modules, NPM packages, you name it or... you know, add Bazel and build files. They are the same tool -- and that's why I didn't write Bazel in the title, because I imagined "build files" more generically. I guess I needed to be clearer there.

      • kyrra an hour ago

        But there is a lot of C, C++, and Java in the world.

        It also helps in a mono-repo to help control access to packages. BAZEL makes it so you can't import packages that aren't visible to your package.

        • eej71 an hour ago

          Bazel is a hard sell overall.

        • bschwindHN 2 hours ago

          I must live in some alternate reality where this just isn't a problem, or maybe the author has not described the problem well. But reading the article, it just feels like some software form of bureaucracy.

          • jmmv 27 minutes ago

            If you work on a well-modularized codebase, with small and individual Go modules, or Rust crates or NPM packages or whatever you call them... you do not live in an alternate reality. You are doing essentially the same as I was describing because the package managers for those tools force you to express cross-dependencies explicitly in a separate "metadata file". You are just doing so via a different, language-specific tool.

            The problem appears when: 1. you have a significant number of people working on the project and 2. one of these "modules" has become too big internally where it's hard to make sense of its internal structure. Having a monorepo makes the problem even more likely. At that point, you'll probably want to start breaking up that gnarly module into pieces so that you can see its structure again, right?

            • Mesopropithecus an hour ago

              Was gonna write that it pays dividends only from a certain project size onwards, but in fact it could be true from a certain org size instead. So yes, it has some component of bureaucracy-as-code, and I agree with the author that that can be a good thing.

            • CuriouslyC 2 hours ago

              I like to take artifacts people are guaranteed to need and use them to represent architecture via introspection. Package files and manifests are enough to get you 80% of the way there, you can add annotations to package files and docstrings/doc comments to go as deep as you need. That keeps your architecture in Git and coupled to the code.

              • simpaticoder an hour ago

                Many words and few to the point. tldr: This person likes build-tools (Google's Bazel) that can constrain dependencies to be used only by certain packages, and says this documents the project's architecture.

                I've always thought of "architecture" as a high-level description of run-time behavior, not a set of compile-time dependency constraints.

                • npodbielski an hour ago

                  Exactly. I thought that in modern languages and frameworks there are better tools to do that like 'ProjectReference' in .Net. Oh well..

                  • jmmv 12 minutes ago

                    I have worked with ProjectReference before. How is it different from expressing a cross-module dependency in a Bazel BUILD file?

                    But as I already said in two other comments in this discussion, ProjectReference would be equivalent to what I'm describing in the article, just using language-specific tooling. If you are breaking your solution into various projects and keeping them separate with cross-references among them, you are doing exactly what I was describing already.

                • flanked-evergl 3 hours ago

                  Doubt it. The problem detailed at the start of the post can be solved by static analysis/linting. And no amount of new strange files will give you the same benefit as using some stock standard static analysis tools.

                  • jmmv 26 minutes ago

                    Please elaborate on what those "some stock standard static analysis tools" are.

                  • npodbielski an hour ago

                    So this incomprehensible file at the end of article, that supposed to be "lean" is what the author is fighting for?

                    And it supposed to show 'architecture'?

                    Wow. I am happy that I never started working with Java. That is terrible.

                    • simpaticoder an hour ago

                      This article has nothing to do with Java, and the author explicitly states that.

                      • npodbielski 20 minutes ago

                        But somehow all the examples involve it.