A Fresh Start - What would you do differently a second time round?
Hey everyone.
My team and I have a rare opportunity to start from scratch, and I am keen to know what things others that have gone through a similar process did differently. Obviously there's the immediate benefit of losing any technical debt that has built up over 10+ years of an ever changing environment along with many organisational changes and merges, but I'm thinking about the things that we can do to make life a lot easier for the next 10+ years.
The areas that have already made the list are:
- Separating out Globals and Routines into separate databases
- Being more consistent with Class naming
- Making better use of Search Tables
Can you think of anything else that you have done differently a second time around, or would want to do differently if given the chance?
Comments
A few additional things stand out from the retrieved material that may help make a fresh start easier to live with over the next decade:
- Keep using namespaces and databases with clear administrative separation, not just for globals vs routines, but as a broader design principle for maintainability. [1]
- Adopt a meaningful naming convention for environments and database roles, for example distinguishing DEV, QC, UAT, and PRD, and also whether a database is for data or code. [2]
- Consider separating stream data into its own database with global mapping if you store large
%Streamproperties that are rarely accessed. [2] - Prefer persistent classes for application data instead of hardcoding direct global access, because that gives you schema, indices, SQL access, and safer long-term maintenance. [3][4]
- Design your global structures clearly up front and avoid ad-hoc key layouts if you do use globals directly. [4]
- Ensure persistent classes have appropriate indexes to support query requirements, and use indexes as part of the initial model design rather than adding them reactively later. [1]
- Make automated tests part of the foundation from day one, using
%UnitTest. [1] - Build in performance verification habits early: use the SQL query optimizer/query plan for SQL, and use tools such as
^PROFILEand^TRACEto identify bottlenecks. [1] - Review security at the architecture stage, including resources, roles, and application security, rather than treating it as a later hardening step. [1]
- Keep documentation and code comments maintainable from the start, using UDL or Studio-style comments so future developers can work effectively. [1]
- If you expect scale or distributed growth, evaluate early whether Mirroring, Sharding, or ECP are needed as part of the design. [1]
On your existing list specifically:
- Separating globals and routines is described as still recommended. One reason given is that the global store is a fast-changing database tied to mirroring, journaling, ECP, and sharding concerns, while the routine database should change rarely and be under special control. [2]
- Consistent class naming aligns with the convention that classes use capitalized word starts, for example
CountryOrigin. [5] - Search tables fit with the broader recommendation to ensure persistent classes have appropriate indices and to think about query needs up front. [1]
If I had to condense the strongest additions into a “second time around” checklist, it would be: define naming/environment conventions early, model data with persistent classes and indexes first, separate rarely used stream content if relevant, put testing/performance/security in place from the beginning, and design for operational separation and future scale. [1][2][3][4]
Sources:
if you DB is expected to be big, I would invest on optimizing the storage in classes/globals:
- use proper datatype in classes (e.g. save dates as +$H not string "yyyy-mm-dd")
- if there are relationships, plan them carefully, with proper indices.
- if there are repeated string, use referential tables, do not store them "flat" in the main table
- if there are array/list properties, mane the storage sub-global name very short
All those will reduce I/O, gives a better use of cache buffers, smaller storage footprint and will result in overall performance improvement.
Thanks Yaron, these are helpful points.