0
0
Microservicessystem_design~10 mins

Bounded context concept in Microservices - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a bounded context in microservices.

Microservices
class [1]Context:
    def __init__(self):
        self.services = []
Drag options to blanks, or click blank then click option'
AUser
BPayment
CInventory
DDatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a generic term like Database which is not a bounded context.
2fill in blank
medium

Complete the code to show communication between two bounded contexts.

Microservices
def communicate(context_a, context_b):
    return context_a.send_message_to([1])
Drag options to blanks, or click blank then click option'
Acontext_b
Bnetwork
Cdatabase
Dcontext_a
Attempts:
3 left
💡 Hint
Common Mistakes
Using context_a which is the sender itself.
3fill in blank
hard

Fix the error in the code to correctly isolate bounded contexts.

Microservices
class OrderContext:
    def __init__(self):
        self.data = [1]

    def add_order(self, order):
        self.data.append(order)
Drag options to blanks, or click blank then click option'
Aset()
B{}
CNone
D[]
Attempts:
3 left
💡 Hint
Common Mistakes
Using {} which is a dictionary and does not support append.
4fill in blank
hard

Fill both blanks to define two bounded contexts with clear separation.

Microservices
class [1]Context:
    pass

class [2]Context:
    pass
Drag options to blanks, or click blank then click option'
APayment
BUser
CInventory
DOrder
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing the same context name twice.
5fill in blank
hard

Fill all three blanks to complete the microservice architecture with bounded contexts.

Microservices
services = {
    '[1]': ['AuthService', 'ProfileService'],
    '[2]': ['OrderService', '[3]']
}
Drag options to blanks, or click blank then click option'
AUserContext
BPaymentService
COrderContext
DInventoryService
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing service names with context names.