# Writing modular upgradable contracts

**URL:** <https://forum.openzeppelin.com/t/writing-modular-upgradable-contracts/32887>\
**Category:** Upgrades\
**Tags:** proxies\
**Created:** [November 2, 2022, 7:33pm UTC](https://forum.openzeppelin.com/t/writing-modular-upgradable-contracts/32887 "2022-11-02T19:33:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [November 3, 2022, 6:41pm UTC](https://forum.openzeppelin.com/t/writing-modular-upgradable-contracts/32887/2 "2022-11-03T18:41:30Z")

</div>

1. If `Utils` will not be deployed by itself, and will only be inherited by `contract One`, then no. Although consider marking it as `abstract` in this case. Note: it **can** have an initialization function if needed (to be called by `One` in `One`'s initializer).
2. It can be in either place. It does not need to be in both in this case.
3. I don't suggest removing an initializer unless you are sure that you will never need it in the future. See [Removing initializer on upgrades - #2 by ericglau](https://forum.openzeppelin.com/t/removing-initializer-on-upgrades/32885/2)

But a major problem with the above is that you CANNOT upgrade from your first `One` (with everything in it) to the bottom `One` as it is written -- this is because the storage layout will change due to the inheritance. In the bottom `One`, the inherited `Utils`'s `var2` occupies a storage slot before `var1`. A possible solution is to use [a storage contract similar to this approach](https://forum.openzeppelin.com/t/to-inherit-version1-to-version2-or-to-copy-code-inheritance-order-from-version1-to-version2/28069/18).

---

_[View the full topic](https://forum.openzeppelin.com/t/writing-modular-upgradable-contracts/32887)._
