This is the third blog in my series on how LLMs can help software architects in their daily work. In my previous blog, we explored how to use LLMs to help you write architecture documents. 

Choosing the right architecture pattern is one of the most important decisions architects make. With so many options, including layered architectures, microservices, and event-driven patterns, it’s not always clear which one best suits your project.

In my experience, Large Language Models (LLMs) like ChatGPT can be powerful allies in this process. Let’s explore how they can help you evaluate, compare, and implement architecture patterns more effectively.

Pattern Recommendations Based on Context

LLMs can recommend appropriate architecture patterns when provided with the right context. The key is to clearly describe your project’s goals, constraints, and environment.

Prompt example

I’m building an e-commerce application handling product management, user accounts, and order processing. Requirements:

–       Small team (3–5 developers)

–       Moderate traffic initially (hundreds of calls per day)

–       Need flexibility to scale specific components

–       Future payment provider integrations

Which architecture pattern do you recommend and why?

With this kind of prompt, the LLM can suggest a pattern and explain how it aligns with your needs.

Trade-off Analysis Between Patterns

LLMs can also help you compare multiple architecture options by highlighting their trade-offs, enabling you to understand the real implications of each choice, and making more informed decisions on which pattern to use.

Prompt example

Compare Layered Architecture, Microservices, and Event-Driven Architecture for a financial application that requires real-time transactions.

Focus on:

–       Complexity vs Maintainability

–       Performance and Scalability

–       Deployment Overhead

–       Team Expertise Requirements

–       Cost Implications

Provide a comparison table that outlines the pros and cons.

Implementation Guidance

Beyond choosing a pattern, LLMs can help you understand how to implement it. You can ask for actionable advice, code snippets, and best practices.

Prompt example

For a microservices-based e-commerce platform with user management, inventory, and order processing:

–       Suggest a service structure

–       Recommend inter-service communication methods (REST, gRPC, message brokers)

–       Provide Java code examples with error handling

–       Explain cross-service authentication strategies

–       List best practices for monitoring and logging

In general, for better Results from LLMs, your prompts must include:

  • Specific technical context (domain, traffic, complexity)
  • Non-functional requirements (performance, scalability, maintainability, etc.)
  • Team-related factors (size, skills, etc.)
  • Technical and business constraints (budget, time-to-market, expected growth)

The more relevant the context, the more precise and practical the recommendations

In my book, Generative AI for Software Architects: How to Use LLMs to Boost Your Productivity, I delve deeper into how LLMs can help you with both architecture and design patterns. You’ll find practical prompts and real-world examples to guide you through complex technical decisions.

About the Author

My name is Adel Ghlamallah and I’m an architect and a java developer.

View Articles