docs: code smells/cross-imports add#888
Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
illright
left a comment
There was a problem hiding this comment.
Thanks! I'm not so enthusiastic about the current length and focus of this page. I found it a bit difficult to read because it seemed like there were many different topics covered. Let me try to give examples:
- The first two sections describe what the article will be about, but they already go into a little bit of depth, so to me it feels like this short introduction ends up distracting from the main content. I would personally start this page from the third section, "Why is it a code smell" (with a short definition of what a cross-import is), I don't think the page would've become harder to read.
- There's a part about deep imports, which is its own problem, even outside of cross-imports. It's currently covered in the Public API reference page.
- There's an entire section about the shared layer, with examples, even though cross-imports aren't really relevant for Shared. I think this section should just be a simple clarification in the beginning.
- In the Entities section, there's a discussion about not putting UI in Entities. While it's good advice, I don't think it's relevant to the issue of cross-imports either.
- The Defining domain types in entities section gives examples of content that belongs to the Entities layer, which mostly duplicates responsibility with the Types example guide and the Layers reference
I would suggest to liberally cut this page to only leave the essentials — what we're talking about, why it's a problem, what can be done. For example, the strategies from the Features/Widgets section are nice, but they are also quite long in my opinion
Thank you so much for taking the time to provide such detailed feedback. |
|
Hi @illright, |
illright
left a comment
There was a problem hiding this comment.
Thanks for making these changes, I definitely think it's going in the right direction, but perhaps we overshot the destination a little bit :D
The section "Why is it a code smell" is too short now — it's essentially one sentence, preceded by an introduction to the document and followed by an introduction to the next section:
For example, when the cart slice directly depends on product UI or business logic, the domain/responsibility boundary becomes blurry.
This leaves questions in my mind — does it become blurry? why is that? and why is that bad, what is the purpose of a clear boundary between domains?
On a related note, I noticed quite a few other instances of one-sentence paragraphs — I think it'd be best to merge them into one paragraph. I like to think of paragraphs as expressing a single thought, so when a thought is spread across several paragraphs, it becomes harder for me to follow.
I also think the horizontal lines between sections are unnecessary — they strengthen the feeling of separation that is already provided by headings, which makes the page read as a collection of very loosely connected notes. Let's let the headings do the separation :)
I particularly like the "How strict you are is a team/project decision" section — it's not only very well-formatted, but also leaves no questions in my head, and yet it's concise enough to quickly read.
I also asked for feedback on this article from others in the Russian thread in Telegram because I want to check how well this content answers people's questions. Hope you don't mind :D. I'll let you know if I learn something that could help improve this article
Solant
left a comment
There was a problem hiding this comment.
hey 👋
Overall I agree with a point of cross-imports being bad, but I would like not to suggest using cross-import notation for the entities layer, as entities layer is a very tricky thing to do right, and cross-imports there are definitely making it harder.
Also you can mention that cross-imports prevent circular dependencies, and circular dependencies are objectively bad
Don't feel constrained by those comments, feel free to discard them if you want to restructure this article completely 😄
i18n/en/docusaurus-plugin-content-docs/current/guides/issues/cross-imports.mdx
Show resolved
Hide resolved
i18n/en/docusaurus-plugin-content-docs/current/guides/issues/cross-imports.mdx
Outdated
Show resolved
Hide resolved
After re-reading the article, I agree that a few parts ended up being too abstract, especially in the “Why is it a code smell” section. I’ll expand that section to better explain why the boundary becomes blurry, why that’s problematic, and what the purpose of clear domain boundaries is. Regarding the one-sentence paragraphs: I did this intentionally for readability. In Korean, longer paragraphs tend to wrap a lot, which can make the text harder to read and more tiring. That’s why I split the text. I also tried not to overdo it — rather than writing everything as one-liners, I split the content into multiple paragraphs with clear roles so it’s easier to scan and follow. I also agree about the horizontal separators — I’ll remove them and rely on headings for separation. And I actually think it’s great that you asked for feedback in the Russian Telegram thread — thank you |
Thanks for taking the time to review and share feedback. 😊 Just to clarify my intent: I didn’t mean to recommend using I realize that nuance didn’t make it into this PR, and the current wording can be read as encouraging Also, great point about circular dependencies: I’ll add a note explaining that uncontrolled or bidirectional cross-imports can lead to circular dependencies, and that circular dependencies are generally harmful. Thanks again for the feedback. |
|
@illright Update pushed: expanded the “Why is this a code smell?” section, merged/restructured short paragraphs for better flow in English, and removed horizontal separators. thank you |
i18n/en/docusaurus-plugin-content-docs/current/guides/issues/cross-imports.mdx
Outdated
Show resolved
Hide resolved
…ross-imports.mdx Co-authored-by: Solant <runner62v6@gmail.com>
* docs: code smells/cross-imports add * fix: Title typo correction * docs: reflecting feedback * docs: reflecting feedback * Update i18n/en/docusaurus-plugin-content-docs/current/guides/issues/cross-imports.mdx Co-authored-by: Solant <runner62v6@gmail.com> --------- Co-authored-by: Solant <runner62v6@gmail.com>
* chore: initial astro setup * feat: add i18n * add get-started pages * docs: migrate /get-started/tutorial page * chore: add discord link * docs: migrate /guides/examples/auth * chore: ignore .astro * docs(kr): fix title mismatch in Next.js guide (#896) - Change title from "Usage with Electron" to "Usage with Next.js" - Ensures title matches file name, URL path, and content * docs: code smells/cross-imports add (#888) * docs: code smells/cross-imports add * fix: Title typo correction * docs: reflecting feedback * docs: reflecting feedback * Update i18n/en/docusaurus-plugin-content-docs/current/guides/issues/cross-imports.mdx Co-authored-by: Solant <runner62v6@gmail.com> --------- Co-authored-by: Solant <runner62v6@gmail.com> * docs: refactor desegmentation page (#895) * docs: refactor desegmentation page * docs: remove wip class * docs: remove outdated translations * docs: migrate examples/guides/types * docs: migrate guides/examples/page-layout * docs: migrate guides/examples/api-requests * docs: migrate guides/migration articles * docs: migrate tech category * docs: migrate issues * docs: migrate reference * chore: add fsd logo * docs: change home page * chore: replace build script with astro * docs: add favicon * docs: add missing en pages * docs: add llms.txt support * docs: follow exiting docs routing * add missing root pages * fix language order and social links * add sidebar ru translations * add ru translations for get-started * migrate ru/docs/about articles * add ru/docs/reference articles * use aside consistently across the files * migrate ru guides * add ja translations * migrate the rest of ja articles * add uz translations * migrate kr about articles * add korean translations * add vi translations * add missing Aside components * fix linter * add missing component * add zh translations * add available category translations * add placeholder home pages * fix review comments * fix some text inconsistencies * fix light/dark mode images * add component to use images from /static * docs: astro.config sidebar title emoji remove * docs: astro document color theme and font apply * fix: astro custom.css format build error * add prettier config for astro * fix iframe size * use replace <img> with StaticImage * docs: color theme, font - system ui change * fix: image path issue * docs: cross-imports kr update * docs: redirect landing page to overview * fix formatting * docs: astro meta tag add * docs: astro format update * fix links * add missing image * fix nested slice images * remove excessive headings * docs: ko desegmented add --------- Co-authored-by: choisuhyeok1255 <72919631+choisuhyeok1255@users.noreply.github.com> Co-authored-by: Minsu <alstntorl@naver.com>
Background
This PR adds a new documentation page that explains common code smells related to cross-imports in Feature-Sliced Design (FSD).
The page was created after reviewing real-world discussions and recurring pain points shared by developers in the official FSD Telegram community.
By researching how teams have struggled with cross-import issues, the document aims to provide a clear conceptual understanding and a set of practical strategies to avoid or refactor problematic dependency patterns.
@xas a dedicated, domain-only public API surface for cross-entity importsfeatures/widgets:entitiespages/app)