Click here to Skip to main content
15,946,158 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I understand the concept behind major software architectures. Their pros and cons and when to use what, etc. I can implement these my (hacky) way. But not sure whether it is the optimal way (am i missing some design pattern?).

My question is, how to convert software architecture diagram (topology) to code? What should the code look like?

Simply put, most software architecture books talks abstractly. I need the resource to be concrete.

Where can I find this red herring? In case it does not exist, what are the options for me?

What I have tried:

I went through several books but could not find sufficient sample code. Where can I find boilerplate code to implement the architectures or at least understand how these are implemented. Which design patterns shall I use to implement these architectures?

For example, there are several books which give sample code on implementing clean architecture.

Get Your Hands Dirty on Clean Architecture by Tom Hombergs
Implementing the Clean Architecture (Python Edition) by Sebastian Buczyński
Clean Architecture with PHP by Ferran Martı́n Sànchez
The Clean Architecture in PHP by Kristopher Wilson

In case of other Software Architectures, only a few books give code samples. For example:

Architecture Patterns with Python by Harry Percival, Bob Gregory
Software Architecture with Python by Anand Balachandran Pillai
Hands-On Software Architecture with Golang By Jyotiswarup Raiturkar
Hands-On Software Architecture with Java by Giuseppe Bonocore
Software Architecture by Example: Using C# and .NET by Paul Michaels

However, I want more details. For example, to create layered architecture, do this then that (with sample code). To close a layer do this (with sample code). To open a layer do this (with sample code). To use multiple database in a Service-Based Architecture, do this (with sample code). To use multiple User Interfaces in a Service-Based Architecture, do this (with sample code). To add API layer between the user interface and domain services, do this (Here is a sample code).
Updated 24-Sep-22 3:11am

1 solution

I know of no such thing, although a few might exist for specific domains. Architecture diagrams and books are intended for software architects: that is, people with a reasonable amount of experience developing software. That experience will give them a good idea as to how to convert a proposed architecture to code. But they will also have to fill in some blanks and make some changes so that the architecture is a better fit to their domain.

Books on design patterns usually provide examples of how to implement each pattern. But again, you have to adapt that to your own setting.

The fact that you're asking this suggests that you don't yet have the experience to implement software on the scale where architecture is an important consideration. You say that your implementations are hacky. They will become less so as you gain more experience, but it would also be helpful to read a book or two on how to write good code in the language(s) that you've chosen.
Share this answer
blueray453 24-Sep-22 10:27am    
I have chosen rust. The problem is, there is not that many books written on it regarding my specialized needs. For example, there are no: "Hands-On Software Architecture with Rust" or, "Implementing the Clean Architecture (Rust Edition)". However, it has become an advantage for me. I read books written for PHP, Python or Java (I understand these three) and interpret them in Rust (As I have already mentioned, the existing books are not fulfilling my needs completely). As the book I am looking for does not exist yet, what do you suggest I do so that I can quickly become capable to "convert a proposed architecture to code". Which books shall I go through? I think I have to do some exercises as well. What will be some great resources for that? My requirement is specific. I want to "convert a proposed architecture to code", I am ready to do (almost) whatever it takes. I just need some guidance.
Greg Utas 24-Sep-22 13:40pm    
Rust is different from most languages. I use C++ and looked at Rust out of curiosity but didn't want to go down what looked like a rabbit hole. But I'm retired, whereas you seem to be closer to starting out, and becoming proficient at Rust could be a very good decision from the standpoint of job opportunities going forward.

When I looked at Rust, there seemed to be some good books about it, so I would suggest that you read them and do whatever exercises they contain. I would pay special attention to how they suggest implementing an object-oriented design in Rust, because it doesn't have objects. However, I believe that a large system--meaning one where architecture is important--must provide frameworks. Classes are a good way to do that, and if a language doesn't have them, it had better have something that compares. I got the sense that Rust allowed you to define the equivalent of Java interfaces, but that was around the point that I decided not to dig any deeper.
blueray453 25-Sep-22 1:32am    
Thank you very much.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900