Thank You Lord!

Thank You Lord!. Thank father for this new month, thank you for making it possible for us to see this day. Thank you for each everyone of my family Daddy….

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Introduction

I am working on the Asset-Importer-Lib since 2006. At first, we were three guys who wanted to share their file-loaders in one library with others. If you have ever tried to import any kind of 3Dfile–format you know how much work, frustration, and pain this will cause. A lot of hacks and special implementations for special use-cases are part of most of the formats I worked with. A lot of great developers helped us by writing importers, their knowledge, and bug fixes. So the code-base has grown over the years. So did the tech-debt’s. Programmings techniques have evolved, different styles from different developers got in, and so on.

In this blog post, I want to share which major issues I have found and which strategy can help to solve these.

The problem: Direct use of third-party-API and libs

We imported a file format called IFC. The shortcut stands for Industrial Foundation Classes. It is used by Building Information Modeling (BIM) programs to hold models and designs of facilities and buildings. This format provides 2D-polygons which needs to get triangulation. And we had to check whether these polygons will define a hole in the model topology.

We chose the clipper lib to solve this task and we used it directly in the IFC-stuff. The code is crucial to get a triangle mesh out of these polygons. Of course, finding holes and triangulate stuff is a job other formats shall reuse as well. But caused by the hard coupling of the clipper-lib reusing this code is hard and needs a lot of refactoring. And when you have to do a major update of the library with changing interfaces you get in serious trouble. Everywhere the code needs to get changed where this library was used for.

Solution: Use interfaces

Encapsulate the third-party-API behind an internal interface, which will be used in the assimp-codebase instead. This private interface shall include documentation about the idea and concepts of the used library. So you can reuse the lib more easily. You can migrate the lib behind the interface.

Add a comment

Related posts:

A Reforma Falhou

Em 31 de outubro de 1517, Martinho Lutero pregou suas 95 Teses, uma lista de proposições destinadas a tratar de problemas na Igreja Católica Romana, à porta da igreja universitária de Wittenberg, na…

Making Your Laundry Day Easier With MyDobi Coin Laundry

Doing the laundry can be a tedious chore that takes away your free time. That’s why MyDobi coin laundry has developed a revolutionary way to make laundry day easier: coin-operated machines that…

The Yes Problem

I have a problem. It’s the yes problem. Perhaps you’ve heard of it? Let me illustrate with a story. As I was talking with my husband earlier this week about our plans, I realized that I had…