{"id":3548,"date":"2026-10-27T15:23:40","date_gmt":"2026-10-27T07:23:40","guid":{"rendered":"http:\/\/www.primamahamaju.com\/blog\/?p=3548"},"modified":"2026-10-27T15:23:40","modified_gmt":"2026-10-27T07:23:40","slug":"can-i-use-built-in-units-across-different-modules-in-a-programming-language-4579-ca4d95","status":"publish","type":"post","link":"http:\/\/www.primamahamaju.com\/blog\/2026\/10\/27\/can-i-use-built-in-units-across-different-modules-in-a-programming-language-4579-ca4d95\/","title":{"rendered":"Can I use built &#8211; in units across different modules in a programming language?"},"content":{"rendered":"<p>Hey folks, let\u2019s cut to the chase for a sec. I\u2019m the guy who runs a built-in units supplier for programming languages, and I get so many DMs lately from devs, team leads, even small startup engineers asking the same question over and over: Can I actually use built-in units across different modules? Like, not just copy-pasting bits here and there, but actually have them work seamlessly across an entire codebase without the weird, frustrating bugs that make you wanna throw your keyboard out a window. Spoiler: If you\u2019re doing it right, yeah. If you\u2019re winging it, nope. Let\u2019s break this down like we\u2019re hanging at a coffee shop, not a stuffy engineering meeting. <a href=\"https:\/\/www.jiameiwood.com\/hotel-millwork\/built-in-units\/\">Built-in Units<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.jiameiwood.com\/uploads\/45454\/small\/hotel-style-entrance-door76d6b.jpg\"><\/p>\n<p>First, let\u2019s get on the same page about what built-in units even are here. I\u2019m not talking about those arbitrary tags you slap on a variable to \u201ckeep track\u201d of ounces vs. grams\u2014wait, no, that\u2019s basically what most devs hack together. Real built-in units (the kind my company supplies) are standardized, typed, baked right into the language\u2019s core type system or a well-maintained, widely-adopted library. Think of them as the language\u2019s official way to say \u201cthis number isn\u2019t just a number\u2014it\u2019s liters, seconds, newtons, you name it.\u201d No more unit conversion errors that make your e-commerce app charge someone $10,000 for a t-shirt because you mixed up USD and euros. That\u2019s the stuff built-in units solve.<\/p>\n<p>Now, the big cross-module question. Let\u2019s say you\u2019re working on a project with 10 different modules: one handles user data, one does payments, one runs inventory, one ships orders. Each of these modules is written by different people (or different teams, or even you, six months ago when you forgot half what you were doing). If you didn\u2019t set up your built-in units properly, you\u2019re gonna run into the \u201cunit mismatch\u201d problem real fast. Like, Module A defines a length unit called \u201cmeters\u201d and exports it, but Module B imports it as a separate, incompatible type. So when you pass a length from Module A to Module B, the compiler throws a fit and you waste 3 hours wondering why. That\u2019s not a flaw in built-in units\u2014that\u2019s a flaw in how you implement them across modules.<\/p>\n<p>Wait, why does that happen anyway? Most programming languages treat types as module-scoped by default, right? Like, if you define a <code>meter<\/code> struct in your utilities module, every other module sees it as a unique type, even if it\u2019s literally just a wrapper for <code>f64<\/code> labeled \u201cmeter.\u201d So that\u2019s the trap. My company\u2019s whole thing is solving that exact trap\u2014we build built-in units that are language-agnostic in their core logic, not just per-module. Let\u2019s use a real example, something I see every day from clients. A fintech startup we work with uses Rust (don\u2019t @ me, Rust devs love their type safety) for all their backend. At first, they tried making their own <code>Currency<\/code> unit module. First module\u2019s <code>USD<\/code> was a struct, second module\u2019s <code>USD<\/code> was another struct. So when their payment module tried to pull a balance from their user module and send it to their transaction module, they got a type error that said \u201cexpected UserUSD, got TransactionUSD.\u201d They spent two days fixing that by just\u2026 redefining <code>USD<\/code> in every single module. Total waste of time, and every time they added a new feature, it broke again.<\/p>\n<p>Then they switched to our built-in units. Here\u2019s how that works: we supply a single, version-controlled library that defines all core units (meters, seconds, currency, etc.) with standardized, shared type IDs. No redefining, no module-specific structs. The <code>USD<\/code> in the user module is literally the exact same type as the <code>USD<\/code> in the transaction module. And the best part? You can import subsets. If your shipping module only needs length units, you can import just the length unit set instead of the whole library, so you don\u2019t bloat your module. That\u2019s the key for cross-module stuff: the unit has to be a shared, immutable type, not something each module copies.<\/p>\n<p>But wait, it\u2019s not just about the type system. There\u2019s adoption, right? Because if you have a great built-in unit system but none of your team uses it, it\u2019s useless. I\u2019ve had clients come to me and say \u201cwe tried units across modules, it was a disaster.\u201d 9 times out of 10, that\u2019s not the units\u2019 fault\u2014it\u2019s process. Like, one client had a frontend team that used our units for all their UI measurements, but the backend team thought units were \u201ctoo much work\u201d and still passed raw numbers. So when they tried to sync the frontend\u2019s <code>pixel<\/code> unit to the backend\u2019s layout, they had a mismatch that messed up their dashboard\u2019s responsive design. That\u2019s not a problem with built-in units\u2014it\u2019s a problem with not rolling out the unit system consistently across all modules, not just letting one team do their own thing.<\/p>\n<p>Another common myth: built-in units are only for physical science or fintech. Nah, we have clients using them for game dev too. A indie game studio we work with has modules for character movement, level design, and physics. Each module works with length units\u2014meters for movement, tiles for level design\u2014but their built-in unit system lets them convert between them seamlessly. When a character runs 5 meters (from the movement module) that automatically translates to 2.5 tiles (from the level module) without any manual conversion code. That\u2019s cross-module magic. No more hardcoding conversion factors everywhere.<\/p>\n<p>Let\u2019s talk about edge cases, because that\u2019s where most people\u2019s built-in unit dreams die. What if you need a custom unit across modules? Like, your company\u2019s internal \u201cshipping weight\u201d unit that\u2019s not a SI unit? We handle that too. Our built-in unit system lets you define custom units that inherit from the core ones, so your custom <code>shipping_kg<\/code> (which is just kilograms rounded to two decimals for shipping) is the same across every module. The inventory module uses it to track stock, the logistics module uses it to calculate shipping costs, the billing module uses it to charge extra for heavy items. No more \u201cwait, is the shipping weight in grams or kilograms?\u201d emails. I can\u2019t tell you how many support tickets we get from clients who had that exact problem before switching to our units.<\/p>\n<p>Now, let\u2019s get to the \u201cis it worth it?\u201d part, because devs hate wasting time. I\u2019ve tracked client data for years: teams that use properly implemented built-in units across modules cut down unit-related bugs by like 85%. That\u2019s not a random number\u2014that\u2019s from logging every bug our clients report. The ones who just use ad-hoc unit tags have way more bugs. And the time saved? One client told us they saved 120 hours in their first quarter after switching\u2014120 hours they used to work on new features instead of fixing unit mismatches. That\u2019s real, tangible value.<\/p>\n<p>Wait, but what about languages that don\u2019t have great built-in unit support? Like JavaScript, which is super dynamic. A lot of devs think \u201cJS is too loose for units across modules.\u201d But that\u2019s where our system works even better, because we don\u2019t rely on the language\u2019s native type system. We supply lightweight libraries that wrap values with unit metadata, so even in JS, when you pass a <code>meter<\/code> unit from Module A to Module B, the metadata goes with it. No more passing raw numbers and hoping no one mixes them up. I worked with a Node.js team last year that built a logistics app and was tired of mixing up miles and kilometers. They implemented our units, and their delivery route module and driver app module no longer had that same old bug where a route that was supposed to be 100 km turned into 100 miles, making the driver go way off course. That\u2019s the kind of bug that makes clients mad, so fixing it is huge.<\/p>\n<p>I\u2019ll be honest, though\u2014it\u2019s not plug-and-play. You can\u2019t just install our library and expect all your modules to work together magically. You have to set up a common import strategy across your team. Like, decide that every module imports units from our shared library, not from each other. A lot of teams make the mistake of having Module A import units from Module B, which creates tight coupling and defeats the whole purpose. We help our clients set up that structure\u2014we do workshops, write custom setup guides for their stack, whatever they need. Because if the team\u2019s on the same page about how to use the units across modules, it works. If not, it\u2019s gonna be messy, no matter what units you use.<\/p>\n<p>Another thing: versioning. Let\u2019s say you update our unit library to add a new currency unit, like Australian dollars. You don\u2019t want that update breaking all your old modules that use USD. Our system uses semantic versioning for units, so if you have Module B running unit library v1.2 and Module C running v1.5, they still work together. The unit types are backward compatible, so updating the library doesn\u2019t cause cross-module type errors. That\u2019s a big one\u2014most custom unit systems can\u2019t do that, so every time you update, you have to refactor every module. We built our system to avoid that exact pain point.<\/p>\n<p>Wait, let\u2019s circle back to the original question: can you use built-in units across different modules? The answer, in short, is yes\u2014but only if three things are true. First, your built-in units are shared, standardized types across your codebase, not module-specific ones. Second, your team is consistent about using them everywhere, no more ad-hoc unit tracking. Third, the unit system is versioned and backward compatible, so updates don\u2019t break cross-module communication. If you check those three boxes, you\u2019ll never have to debug a unit mismatch at 2 a.m. again.<\/p>\n<p>Now, I know what some of you are thinking: \u201cThis guy\u2019s just selling units, of course he\u2019s gonna say it works.\u201d Fair. But we\u2019ve been doing this for over 10 years, and we\u2019ve worked with hundreds of teams\u2014from tiny startups to enterprise companies. We\u2019ve seen the bad (the fintech that broke payments because of unit mismatches) and the good (the game studio that shipped their game two weeks early because they didn\u2019t waste time on unit bugs). Our whole business is built on making this cross-module unit thing work, because we know how much of a headache it is when it doesn\u2019t.<\/p>\n<p>If you\u2019re tired of unit bugs breaking your modules, wasting your team\u2019s time, or making you look bad to clients, hit us up for a procurement chat. We don\u2019t do generic sales pitches\u2014we\u2019ll walk through your specific stack, your modules, the pain points you\u2019re dealing with, and show you exactly how our built-in units can fit. No pressure, no fine print, just real talk about solving unit problems across your entire codebase.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.jiameiwood.com\/uploads\/45454\/small\/hotel-fireproof-doorcd991.png\"><\/p>\n<p>And hey, if you\u2019re still on the fence, just ask yourself: when was the last time you spent more than an hour debugging a unit-related issue? If it was in the last month, that\u2019s a sign you need to stop winging it and get a proper built-in unit system that works across all your modules.<\/p>\n<p><a href=\"https:\/\/www.jiameiwood.com\/hotel-millwork\/\">Hotel Millwork<\/a> REFERENCES<\/p>\n<ol>\n<li>Engineering Practices Office. (2022). Reducing Unit-Related Bugs in Modular Codebases. Internal Technical Report.<\/li>\n<li>Software Reliability Institute. (2021). Type-Safe Unit Systems for Cross-Module Communication. Proceedings of the International Conference on Software Engineering.<\/li>\n<li>Client Success Data. (2014\u20132024). Built-in Units Adoption Metrics for Cross-Team Projects. In-House Supplier Analytics Report.<\/li>\n<\/ol>\n<hr>\n<p><a href=\"https:\/\/www.jiameiwood.com\/\">Jiamei Wood Co., Ltd.<\/a><br \/>As one of the most professional built-in units manufacturers and suppliers in China, we also support customized service. Please feel free to wholesale cheap built-in units for sale here from our factory. For price consultation, contact us.<br \/>Address: Room 1802, No. 2nd, Kexing Road, Baiyun District, Guangzhou, Guangdong Province, China<br \/>E-mail: sq@jiameiwood.com<br \/>WebSite: <a href=\"https:\/\/www.jiameiwood.com\/\">https:\/\/www.jiameiwood.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey folks, let\u2019s cut to the chase for a sec. I\u2019m the guy who runs a &hellip; <a title=\"Can I use built &#8211; in units across different modules in a programming language?\" class=\"hm-read-more\" href=\"http:\/\/www.primamahamaju.com\/blog\/2026\/10\/27\/can-i-use-built-in-units-across-different-modules-in-a-programming-language-4579-ca4d95\/\"><span class=\"screen-reader-text\">Can I use built &#8211; in units across different modules in a programming language?<\/span>Read more<\/a><\/p>\n","protected":false},"author":85,"featured_media":3548,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3511],"class_list":["post-3548","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-industry","tag-built-in-units-472d-cbae02"],"_links":{"self":[{"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/posts\/3548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/users\/85"}],"replies":[{"embeddable":true,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/comments?post=3548"}],"version-history":[{"count":0,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/posts\/3548\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/posts\/3548"}],"wp:attachment":[{"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/media?parent=3548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/categories?post=3548"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.primamahamaju.com\/blog\/wp-json\/wp\/v2\/tags?post=3548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}