The pMD Blog

Welcome to the
pMD Blog...

where we cover interesting and relevant news, insights, events, and more related to the health care industry and pMD. Most importantly, this blog is a fun, engaging way to learn about developments in an ever-changing field that is heavily influenced by technology.

Lessons From Surviving A Rewrite

Earlier this year, we released secure messaging clients across iOS, Android, and the browser. Over the last few months, however, it became clear that the web client was having slower release iterations than the other platforms while also hitting some performance ceilings. We decided it was finally time to fix all the issues, but as we got deeper into the code, we realized there was little we could reuse. The abstractions and implementation needed to change.

When you commit to rewriting a large chunk of code, you’re most likely about to make a huge mistake. Joel Spolsky argued this in his classic essay, “Things you should never do”. Yet when we successfully released it on schedule last week, I was frankly surprised because rewrites are usually such a dismal failure in the software industry. Since then, we’ve been thinking about the lessons we learned and how we managed scope creep. Here are some of those lessons:

  1. Know exactly why a rewrite will help the user on day one. This is probably the most important lesson to help keep things on the right track. Whether it’s better responsiveness, better features, or fewer bugs, have concrete and quantifiable goals that must be addressed. The rewrite is not for the developer, it’s for the user. Making the code “cleaner” is not good enough.

  2. Redefine the problem. Oftentimes, many requirements are in fact not really required. Insurmountable problems in the old code can become trivial if you question the right assumptions. I’ve found “hammock driven development” helps at this stage.

  3. Simplify the data model. How you store your data, on-disk and in memory, makes all the difference in what happens next. The fewer copies and immutable versions floating around the better, but avoid puritanical thoughts; denormalized data can be a beautiful thing.

  4. New infrastructure is expensive. Even if you outsource servers or services to somewhere in the cloud, the dependency and management of these new resources adds complexity (and fragility) you may not foresee. Designing simpler but performant infrastructure may be harder, but better.

  5. You probably don’t need a caching layer. Given modern hardware and the fact that databases already do some forms of caching for you, introducing more complexity into your stack can probably be avoided for many real world applications. Scrutinize whether something needs to be cached and at what level. Just remember Phil Karlton’s wise words: “There are only two hard things in Computer Science: cache invalidation and naming things.”

  6. You probably need a caching layer. If done right, caching can open a lot of doors. Yet this shouldn’t always entail introducing some new layer into your stack. Sometimes a good old static HashMap will do. There’s a cache for every budget.

  7. You can optimize that SQL query a lot more than you think. It never ceases to amaze me how much faster a SQL query can be made after you’ve told everyone it can’t be made any faster. These days it’s so easy to blame the relational backend and try to argue for a NoSQL solution. Be creative, you might be pleasantly surprised.

  8. If you’re deleting more code than you’re adding it means one of two things. You are either losing features and introducing old bugs or you’re actually doing something right. Make sure you know which one you’re doing at all times.

  9. The chance of a successful rewrite is inversely proportional to the age of the product. Code complexity is often a function of time: rebuild it when it’s young, and humor it when it’s old.


We didn’t rebuild our entire charge capture app, but we did end up rewriting a significant piece of the secure messaging feature. Whenever you get a sinking feeling of scope creep on a refactor, I think that Joel’s warnings and a few lessons can go a long way toward a successful strategy.
5G ACA Account Management ACI adoption Advancing Care Information AHCA AHRQ AI Alternative Payment Model Amazon S3 Android API Apple appointment reminders Artificial Intelligence arts Audit Bay Area BCRA Best Place to Work Best Practices Big Data bootcamp BPCI BPTW Bundled Payments Business relationships Care Communities care coordination Care Navigation Care Team Career Fair CDC Charge Capture Charge Capture App Charge Capture Software Charge Capture Solution Charge Capture Statistics Charge Lag CHIP CIO Clinical Communication clinical data Clinical Data Registry Clinically integrated network Cloud CMS cms regulations Collaboration Communication Company Culture Conferences Connected Health Record contact practice Coronavirus COVID-19 COVID19 Cross-functional culture custom reports Customer Interaction customer relations customer service customer success customer support Customers Cyber Security cybersecurity Developer DHHS Dialysis discharge instructions EHR elderly Electronic Charge Capture Encryption epidemic Expansion FDA FHIR Flu fundamentals GI GI Outlook Goals group messaging Health Care Health Care Technology Health Care Web health data Health Information Exchange Health Record Healthcare healthcare interface healthcare interface integration healthcare software HIE HIPAA hipaa compliant communication hipaa compliant communication platform HIPAA-Compliant HL7 Home dialysis Hospital Census Hospital Communication humanity IA ICD-10 ICD-11 Implementation Improvement Activities in-app calling Instant capture Integration interface interoperability iOS iOS 8 iOS7 iPad iPhone iPhone 6 Lead Generation length of stay Long Term Care LTC Machine learning MACRA Medaxiom Medical Billing Medical Errors Medical Software Medicare Mental Health Mentorship Messaging Messaging with Patients MGMA MIPS MIPS Registry mobile Mobile App Mobile Charge Capture Mobile EHR Mobile Health Mobile Messaging Mobile security Mobile Technology Modern Healthcare Native App Network new feature new features news NIH OCM onboarding Oncology Care Model operations opioid crisis Pandemic Parenting partnerships Patient Patient access Patient App Patient Care Patient Chat Patient chat routers Patient Communication patient data Patient Engagement patient experience Patient Generated Health Data Patient Handoff Software Patient Information Patient Messaging Patient Safety patient support Patient Visits Patient-Centric PCP Performance bonus pmd pMD Team population health Population Health Management PQRS Product Development Productivity products Promoting Interoperability QCDR QPP quality reporting Quality Scoring Recruiting Recruitment Reimbursement remote jobs Remote Work reports Residents Responsibility ROI Rural communities Sales Secure Communication Secure Data Secure Messaging Secure Messaging Video Secure Text Messaging Secure Video Secure Video Chat Security Audit self care seniors SF Biz Times SNF SOC 2 software vendor Specialty Care success support TCM Team culture Teamwork technology telehealth Telemedicine telemedicine in long term care Telemedicine skilled nursing facilities Teletherapy Text Messaging texting training Travel Upgrades UX Design VA Value-based care Video Calling Video chat video communication video conferencing Virtual Care Virtual Visit voice calling voice memos Wearable Device wearing many hats Web App wellness wfh Wireless Work From Home Work Life Balance