Git Product home page Git Product logo

Comments (2)

renxuelong avatar renxuelong commented on August 29, 2024

我是这样想的,出现两个组件都需要相同的类业务对象时大多数是两种情况。

第一是组件隔离的不合理,两个组件本来是相同的需求单分成了两个组件从而导致上述问题,所以这时候解决方式就是重新梳理组件的划分规则。

第二是对组件化的隔离概念还是不太清晰,AccountBean 很明显是账户相关 Bean ,可以分到 Login 组件,其他组件都不能管理以及直接访问该类,其他组件需要的账户信息比如 UserId、LoginState 等都需要通过 componentbase 组件中转,不能一次传递整个 AccountBean 对象,直接传递整个类的设计就是有悖组件化的。其他组件需要什么就去跟 Login 要什么,不能一次都要。

大概是这个意思吧,希望可以解决你的问题,如果不能解决或者叙述不清楚,欢迎继续交流哈~

from componentdemo.

Jarrywell avatar Jarrywell commented on August 29, 2024

感谢博主答疑!
但感觉日常项目中一般情况下都会碰到这种模块与模块之间有数据类型交互的地方吧。比如一个http数据请求模块(假如是使用retrofit实现的业务接口请求模块,其内部实现了跟具体接口相关数据类型封装、缓存、接口依赖、Interceptor等)注定需要跟各业务bean对象有交互(比如接口定义Call request(String param);),而这里均不满足上述提到的两种情况。

个人感觉实际项目中组件间做不到完全隔离,或者即使做到隔离了也会使交互间带来诸多不便。

from componentdemo.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.