Mendix Best Practices for 2024

Photo of Jacek Pietsch

Jacek Pietsch

Updated Apr 30, 2024 • 10 min read
Double exposure of business man hand working on blank screen laptop computer on wooden desk as concept-Feb-08-2024-10-57-58-4885-AM

In the ever-evolving landscape of app development, Mendix stands out as a powerful platform that empowers both seasoned developers and newcomers to bring their ideas to life.

If you’re not yet familiar with Mendix, it’s high-time you do. In short, Mendix is digital acceleration at its finest. It’s a low-code development platform that makes it fast and easy to build, deploy, maintain, and upgrade software at scale.

With minimal coding requirements and intuitive visualization, the barrier to entry is much lower than with traditional development methods, making it significantly faster for businesses to turn ideas into apps.

Organizations across the globe appreciate this speed and ease.

“Right out of the gate we found that we could achieve at least 4.5 times the velocity with Mendix in comparison to our traditional development timelines,”– Douglas Potts, VP of Software. Engineering at Cognia

That’s why in 2023, for the seventh consecutive year, Mendix was named a Leader in the Gartner® Magic Quadrant™ for Enterprise Low-Code Application Platforms.

Over 4,000 organizations in 46 countries use Mendix. So far they have created 950,000 applications for 50 million end users – and counting. Take a look at 6 examples of apps built with Mendix.

Although Mendix makes development much simpler, rushing into the process without proper training can lead to suboptimal performance and messy structures. I always advise to take a step back – prepare and plan.

Follow these 10 rules and best practices to elevate your Mendix development experience in 2024. They work for me. I hope they will help you get better results too.

1. Use modules wisely

Modularity stands as a cornerstonefeature within the Mendix platform. It’s a unique and invaluable asset, providing a pathway for easy code adjustments.

In Mendix, unlike C++ or Java, the module is not a piece of backend code. It encapsulates a blend of views, business logic, security models, and data models. This mix positions a module as an independent entity, a separate piece of the application that delivers new business functionalities e.g. agreement generation or inventory and task tracking.

Question is – how big should each module be? In the developer's arena, opinions clash and sparks fly on that one. In my opinion, the answer varies based on what you’re trying to accomplish. I recommend evaluating module size from two perspectives:

  1. Size of the system – if it’s a complex ERP system, a single module can encompass everything on financial accounting. However, if your app is exclusively dedicated to financial accounting, you might want to cut it into smaller chunks. Remember that after exceeding a certain level of complexity, it’s a good idea to dissect the module into more manageable and targeted segments.
  2. Use case – ask yourself in how many areas you might want to use a certain component. All generic functionalities – those that you want to share across applications – are better kept in separate modules. It’ll make your work much faster and easier later in the process.

However, my advice is – divide with caution. An excessively refined granularity will not work in your favor. This may create an illusion of modularity when, in fact, modules are so tightly knit together that replacing any component becomes a formidable challenge. Striking the right balance between granularity and cohesion is essential.

2. Embrace simplicity

In short – KISS – keep it simple stupid. This applies to many areas of programming, Mendix as well.

When creating domain models or microflows, commit to simplicity. Microflows work best when kept straightforward, capped at 25 objects. If needed, introduce subflows.

While simplicity is the golden rule, exceptions do exist. Validation rules, for instance, may call for a single microflow for better readability.

3. Don’t repeat yourself

When navigating the waters of Mendix development, steer clear of repetitive code. Microflows and event modules will help you with that. So will inheritance.

“Sometimes, you want to add information to an entity which is used in a different module (...). At other times, you may want to add additional information to some objects of an entity but not to others. For these cases there are two methods you can use: generalization (or inheritance as it is often called) or associated entities,” – Mendix Docs – Studio Pro 10 Guide

That may sound scary for non-engineers but the concept is pretty straightforward and useful for clarifying domain models. With inheritance, entities can use a big portion of their parents and add more attributes when necessary.

I recommend using inheritance for entities that consistently require information from their associated objects, particularly in cases where users extensively engage in searching and sorting based on the associated attributes. Plus, it may also save you time and sanity :)

4. Stay organized

Organizing your workspace is key. Create and organize folders within the module to neatly group microflows, pages, and other elements.

What is the best approach to folder structure? As a best practice, I suggest considering two perspectives:

  1. Grouping by processes – keeping in close proximity all elements related to a single process.
  2. Grouping by entities – bundling pages, microflows (including validation and triggers), and other Mendix native components.

Crafting a solid and carefully designed folder structure is like creating a safety net for your app, ensuring that nothing goes missing or slips through the cracks.

5. Use AI

Mendix taps into the power of artificial intelligence and machine learning to turbocharge your development team's efforts. Think of it as your trio of virtual co-developer bots – MxAssist Logic Bot, MxAssist Best Practice Bot, and MxAssist Validation Bot – each specializing in a certain stage of the application lifecycle development.

You can count on MxAssist to keep you on the right track and help you follow many performance-related best practices. If you're curious about MxAssist, just click here or give ChatGPT a nudge.

6. Naming conventions

More times than I can count I've hit roadblocks in my development journey because of poorly named folders or attributes. Lesson learned: keep those names descriptive and clear. Ambiguity is the enemy. This applies to: modules, domains (entities, attributes, associations), folders, microflows, and other document types.

By following the naming best practices (ChatGPT will also help), you ensure everything has a crystal-clear description for your fellow developers to grasp its purpose and function. Your team will appreciate that. Thank me later.

7. Subflows 101

When creating subflows, use parameters when possible – transfer objects from the context to subflows. And here's a golden rule: don’t retrieve from the database; go for the association route using cached data and indexes for a performance boost.

8. Commit at the end

Make a habit of committing transactions as late as possible – preferably, at the end of the microflow. Why? When a transaction is committed, the data is locked until that whole microflow is finished. Others will not be able to work on this data till then.Therefore, it’s best to commit at the end to avoid locking.

9. Embrace triggers

Use triggers to enhance your workflow. Calculating data when an event happens beats doing it on the fly, especially when you want to display the value or use it in your microflow. Use before or after a commit trigger to calculate a value based on dynamic data from different attributes or entities. And avoid virtual attributes that can cause performance issues.

10. Search before building

When it comes to Mendix, there's no reason to reinvent the wheel. Check if there's a ready-made module in the marketplace before you dive into creating your own. Third-party modules might be a bit risky in some cases, I agree. However, when it comes to a trusted vendor like Amazon or Mendix, it’s often smarter to use their battle-tested and well-known modules rather than crafting something from scratch and burdening yourself with future maintenance.

“We use a lot from the Mendix Marketplace such as the modules for SSO, multi-field, AnyChart, encryption, nanoflow commons, and OQL. It provides a lot of value in terms of speed and simplicity in development,” – Risheek Thamatham Reddy, a career developer with C# and .NET experience within Schaeffler Group

Consider partnering with professionals

In today's business world, speed is the name of the game. No matter the industry, you need: fast idea validation, fast software development, fast market introduction. That's where Mendix steps in — it's the synonym for digital acceleration.

I hope these best practices help you move your Mendix development skills to a new level. If you’d like to learn more, take a look at our step by step guide on how to introduce Mendix to your organization.

Remember – mastering the craftsmanship of building scalable Mendix applications comes with years of experience. Consider hiring highly qualified developers to lay the groundwork for you. Once they build the core on your behalf, you can take over the development and stick to the best practices set by the agency or continue building in a hybrid model that blends their insights with your approach.

Photo of Jacek Pietsch

More posts by this author

Jacek Pietsch

Principal Mendix Expert at Netguru. Jacek leads the low-code/no-code initiative by shaping the new...
Create scalable solutions in record time  Streamline development with low-code  Find out how!

Read more on our Blog

Check out the knowledge base collected and distilled by experienced professionals.

We're Netguru

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency.

Let's talk business