0
0
Microservicessystem_design~10 mins

Identifying service boundaries 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 microservice responsible for user authentication.

Microservices
class AuthService:
    def __init__(self):
        self.[1] = []  # Store user credentials
Drag options to blanks, or click blank then click option'
Ausers
Borders
Cpayments
Dinventory
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unrelated data like orders or payments for authentication service.
2fill in blank
medium

Complete the code to separate order processing into its own microservice.

Microservices
class OrderService:
    def process_order(self, order):
        # Validate order
        if not order.[1]:
            raise ValueError('Invalid order')
Drag options to blanks, or click blank then click option'
Auser
Bid
Cstock
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Using price or stock which are attributes but not unique identifiers.
3fill in blank
hard

Fix the error in the service boundary definition by choosing the correct domain for payment processing.

Microservices
class PaymentService:
    def __init__(self):
        self.[1] = []  # Store payment transactions
Drag options to blanks, or click blank then click option'
Apayments
Busers
Corders
Dinventory
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing payments with user or order data.
4fill in blank
hard

Fill both blanks to correctly define service boundaries for inventory and order services.

Microservices
class InventoryService:
    def __init__(self):
        self.[1] = []  # Store inventory items

class OrderService:
    def __init__(self):
        self.[2] = []  # Store customer orders
Drag options to blanks, or click blank then click option'
Aitems
Borders
Cusers
Dpayments
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up orders with inventory items or users.
5fill in blank
hard

Fill all three blanks to correctly assign responsibilities in a microservices architecture.

Microservices
class UserService:
    def __init__(self):
        self.[1] = []  # Store user profiles

class OrderService:
    def __init__(self):
        self.[2] = []  # Store orders

class PaymentService:
    def __init__(self):
        self.[3] = []  # Store payment records
Drag options to blanks, or click blank then click option'
Aprofiles
Borders
Cpayments
Ditems
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning wrong data to services, like payments to UserService.