Showing preview only (3,503K chars total). Download the full file or copy to clipboard to get everything.
Repository: ashishps1/awesome-low-level-design
Branch: main
Commit: fc26e4033cad
Files: 2758
Total size: 2.8 MB
Directory structure:
gitextract_z31mpvc2/
├── .gitignore
├── LICENSE
├── README.md
├── design-patterns/
│ ├── Javascript/
│ │ ├── Behavioral Pattern/
│ │ │ ├── Chain of Responsibilites/
│ │ │ │ ├── main.js
│ │ │ │ └── supportRequest.js
│ │ │ ├── Command Design Pattern/
│ │ │ │ ├── command.js
│ │ │ │ ├── invoker.js
│ │ │ │ ├── main.js
│ │ │ │ └── receiver.js
│ │ │ ├── Iterator Design Pattern/
│ │ │ │ ├── aggregate.js
│ │ │ │ ├── book.js
│ │ │ │ ├── iterator.js
│ │ │ │ └── main.js
│ │ │ ├── Mediator Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── mediator.js
│ │ │ │ └── user.js
│ │ │ ├── Memento Design Pattern/
│ │ │ │ ├── Example2/
│ │ │ │ │ ├── canvas.js
│ │ │ │ │ ├── careTaker.js
│ │ │ │ │ ├── main.js
│ │ │ │ │ └── memento.js
│ │ │ │ ├── careTaker.js
│ │ │ │ ├── main.js
│ │ │ │ ├── memento.js
│ │ │ │ └── orginator.js
│ │ │ ├── Observer Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── observer.js
│ │ │ │ └── publisher.js
│ │ │ ├── State Design Pattern/
│ │ │ │ ├── context.js
│ │ │ │ ├── main.js
│ │ │ │ └── state.js
│ │ │ ├── Strategy Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── paymentStrategy.js
│ │ │ │ └── shoppingCart_Context.js
│ │ │ ├── Template Design Pattern/
│ │ │ │ ├── beverages.js
│ │ │ │ ├── beveragesTypes.js
│ │ │ │ └── main.js
│ │ │ └── Visitor Design Pattern/
│ │ │ ├── element.js
│ │ │ ├── main.js
│ │ │ └── visitor.js
│ │ ├── Creational Pattern/
│ │ │ ├── AbstractFactory Design Pattern/
│ │ │ │ ├── abstract.js
│ │ │ │ └── main.js
│ │ │ ├── Builder Design Pattern/
│ │ │ │ ├── app.js
│ │ │ │ └── computerBuilder.js
│ │ │ ├── Factory Design Pattern/
│ │ │ │ ├── factory.js
│ │ │ │ ├── main.js
│ │ │ │ └── pizza.js
│ │ │ ├── Prototype Design Pattern/
│ │ │ │ └── app.js
│ │ │ └── Singleton Design Pattern/
│ │ │ ├── app.js
│ │ │ └── singleton.js
│ │ └── Structural Pattern/
│ │ ├── Adapter Design Pattern/
│ │ │ ├── adapter.js
│ │ │ ├── main.js
│ │ │ ├── usbA_connector.js
│ │ │ └── usbC_device.js
│ │ ├── Bridge Design Pattern/
│ │ │ ├── device.js
│ │ │ ├── main.js
│ │ │ └── remoteControl.js
│ │ ├── Composite Design Pattern/
│ │ │ ├── app.js
│ │ │ ├── component.js
│ │ │ ├── file.js
│ │ │ └── folder.js
│ │ ├── Decorator Design Pattern/
│ │ │ ├── additional.js
│ │ │ ├── coffee.js
│ │ │ └── main.js
│ │ ├── Facade Design Pattern/
│ │ │ ├── dvdPlayer.js
│ │ │ ├── lights.js
│ │ │ ├── main.js
│ │ │ ├── movieFacade.js
│ │ │ ├── projector.js
│ │ │ ├── snacks.js
│ │ │ └── soundSystem.js
│ │ ├── Flyweight Design Pattern/
│ │ │ ├── circle.js
│ │ │ ├── circleFactory.js
│ │ │ └── main.js
│ │ └── Proxy Design Pattern/
│ │ ├── main.js
│ │ ├── proxyImage.js
│ │ └── real_Image.js
│ ├── cpp/
│ │ ├── adapter/
│ │ │ ├── in_house_payment_processor.cpp
│ │ │ ├── in_house_payment_processor.h
│ │ │ ├── legacy_gateway.cpp
│ │ │ ├── legacy_gateway.h
│ │ │ ├── legacy_gateway_adapter.cpp
│ │ │ ├── legacy_gateway_adapter.h
│ │ │ ├── main.cpp
│ │ │ └── payment_processor.h
│ │ ├── bridge/
│ │ │ ├── circle.cpp
│ │ │ ├── circle.h
│ │ │ ├── main.cpp
│ │ │ ├── raster_renderer.cpp
│ │ │ ├── raster_renderer.h
│ │ │ ├── rectangle.cpp
│ │ │ ├── rectangle.h
│ │ │ ├── renderer.h
│ │ │ ├── shape.cpp
│ │ │ ├── shape.h
│ │ │ ├── vector_renderer.cpp
│ │ │ └── vector_renderer.h
│ │ ├── builder/
│ │ │ ├── http_request.cpp
│ │ │ ├── http_request.h
│ │ │ ├── http_request_builder.cpp
│ │ │ ├── http_request_builder.h
│ │ │ └── main.cpp
│ │ ├── chainofresponsibility/
│ │ │ ├── auth_handler.h
│ │ │ ├── authorization_handler.h
│ │ │ ├── base_handler.cpp
│ │ │ ├── base_handler.h
│ │ │ ├── business_logic_handler.h
│ │ │ ├── main.cpp
│ │ │ ├── rate_limit_handler.h
│ │ │ ├── request.cpp
│ │ │ ├── request.h
│ │ │ ├── request_handler.h
│ │ │ └── validation_handler.h
│ │ ├── composite/
│ │ │ ├── file.cpp
│ │ │ ├── file.h
│ │ │ ├── file_system_item.h
│ │ │ ├── folder.cpp
│ │ │ ├── folder.h
│ │ │ └── main.cpp
│ │ ├── decorator/
│ │ │ ├── bold_decorator.cpp
│ │ │ ├── bold_decorator.h
│ │ │ ├── italic_decorator.cpp
│ │ │ ├── italic_decorator.h
│ │ │ ├── main.cpp
│ │ │ ├── plain_text_view.cpp
│ │ │ ├── plain_text_view.h
│ │ │ ├── text_decorator.cpp
│ │ │ ├── text_decorator.h
│ │ │ ├── text_view.h
│ │ │ ├── underline_decorator.cpp
│ │ │ └── underline_decorator.h
│ │ ├── facade/
│ │ │ ├── build_system.cpp
│ │ │ ├── build_system.h
│ │ │ ├── deployment_facade.cpp
│ │ │ ├── deployment_facade.h
│ │ │ ├── deployment_target.cpp
│ │ │ ├── deployment_target.h
│ │ │ ├── main.cpp
│ │ │ ├── testing_framework.cpp
│ │ │ ├── testing_framework.h
│ │ │ ├── version_control_system.cpp
│ │ │ └── version_control_system.h
│ │ ├── factory/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── email_notification.cpp
│ │ │ ├── email_notification.h
│ │ │ ├── main.cpp
│ │ │ ├── notification.h
│ │ │ ├── notification_factory.cpp
│ │ │ ├── notification_factory.h
│ │ │ ├── push_notification.cpp
│ │ │ ├── push_notification.h
│ │ │ ├── sms_notification.cpp
│ │ │ └── sms_notification.h
│ │ ├── flyweight/
│ │ │ ├── circle.cpp
│ │ │ ├── circle.h
│ │ │ ├── main.cpp
│ │ │ ├── shape.h
│ │ │ ├── shape_factory.cpp
│ │ │ └── shape_factory.h
│ │ ├── iterator/
│ │ │ ├── container.h
│ │ │ ├── iterator.h
│ │ │ ├── main.cpp
│ │ │ ├── name_iterator.cpp
│ │ │ ├── name_iterator.h
│ │ │ ├── name_repository.cpp
│ │ │ └── name_repository.h
│ │ ├── mediator/
│ │ │ ├── button.cpp
│ │ │ ├── button.h
│ │ │ ├── form_mediator.cpp
│ │ │ ├── form_mediator.h
│ │ │ ├── label.cpp
│ │ │ ├── label.h
│ │ │ ├── main.cpp
│ │ │ ├── text_field.cpp
│ │ │ ├── text_field.h
│ │ │ ├── ui_component.cpp
│ │ │ ├── ui_component.h
│ │ │ └── ui_mediator.h
│ │ ├── memento/
│ │ │ ├── main.cpp
│ │ │ ├── text_editor.cpp
│ │ │ ├── text_editor.h
│ │ │ ├── text_editor_memento.cpp
│ │ │ ├── text_editor_memento.h
│ │ │ ├── text_editor_undo_manager.cpp
│ │ │ └── text_editor_undo_manager.h
│ │ ├── observer/
│ │ │ ├── fitness_data.cpp
│ │ │ ├── fitness_data.h
│ │ │ ├── fitness_data_observer.h
│ │ │ ├── fitness_data_subject.h
│ │ │ ├── goal_notifier.cpp
│ │ │ ├── goal_notifier.h
│ │ │ ├── live_activity_display.cpp
│ │ │ ├── live_activity_display.h
│ │ │ ├── main.cpp
│ │ │ ├── progress_logger.cpp
│ │ │ └── progress_logger.h
│ │ ├── prototype/
│ │ │ ├── enemy.cpp
│ │ │ ├── enemy.h
│ │ │ ├── enemy_prototype.h
│ │ │ ├── enemy_registry.cpp
│ │ │ ├── enemy_registry.h
│ │ │ └── main.cpp
│ │ ├── proxy/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── high_resolution_image.cpp
│ │ │ ├── high_resolution_image.h
│ │ │ ├── image.h
│ │ │ ├── image_gallery_app_v1.cpp
│ │ │ ├── image_gallery_app_v2.cpp
│ │ │ ├── image_proxy.cpp
│ │ │ └── image_proxy.h
│ │ ├── singleton/
│ │ │ ├── double_checked_singleton.cpp
│ │ │ ├── double_checked_singleton.h
│ │ │ ├── eager_singleton.cpp
│ │ │ ├── eager_singleton.h
│ │ │ ├── lazy_singleton.cpp
│ │ │ ├── lazy_singleton.h
│ │ │ ├── main.cpp
│ │ │ ├── thread_safe_singleton.cpp
│ │ │ └── thread_safe_singleton.h
│ │ ├── state/
│ │ │ ├── dispensing_state.cpp
│ │ │ ├── dispensing_state.h
│ │ │ ├── has_money_state.cpp
│ │ │ ├── has_money_state.h
│ │ │ ├── idle_state.cpp
│ │ │ ├── idle_state.h
│ │ │ ├── item_selected_state.cpp
│ │ │ ├── item_selected_state.h
│ │ │ ├── machine_state.h
│ │ │ ├── main.cpp
│ │ │ ├── vending_machine.cpp
│ │ │ └── vending_machine.h
│ │ ├── strategy/
│ │ │ ├── distance_based_shipping.cpp
│ │ │ ├── distance_based_shipping.h
│ │ │ ├── ecommerce_app.cpp
│ │ │ ├── flat_rate_shipping.cpp
│ │ │ ├── flat_rate_shipping.h
│ │ │ ├── order.h
│ │ │ ├── shipping_cost_service.cpp
│ │ │ ├── shipping_cost_service.h
│ │ │ ├── shipping_strategy.h
│ │ │ ├── third_party_api_shipping.cpp
│ │ │ ├── third_party_api_shipping.h
│ │ │ ├── weight_based_shipping.cpp
│ │ │ └── weight_based_shipping.h
│ │ └── templatemethod/
│ │ ├── CMakeLists.txt
│ │ ├── abstract_report_exporter.cpp
│ │ ├── abstract_report_exporter.h
│ │ ├── csv_report_exporter.cpp
│ │ ├── csv_report_exporter.h
│ │ ├── excel_report_exporter.cpp
│ │ ├── excel_report_exporter.h
│ │ ├── pdf_report_exporter.cpp
│ │ ├── pdf_report_exporter.h
│ │ ├── report_app.cpp
│ │ ├── report_data.cpp
│ │ └── report_data.h
│ ├── csharp/
│ │ ├── adapter/
│ │ │ ├── CheckoutService.cs
│ │ │ ├── IPaymentProcessor.cs
│ │ │ ├── InHousePaymentProcessor.cs
│ │ │ ├── LegacyGateway.cs
│ │ │ ├── LegacyGatewayAdapter.cs
│ │ │ └── Program.cs
│ │ ├── bridge/
│ │ │ ├── Circle.cs
│ │ │ ├── IRenderer.cs
│ │ │ ├── Program.cs
│ │ │ ├── RasterRenderer.cs
│ │ │ ├── Rectangle.cs
│ │ │ ├── Shape.cs
│ │ │ └── VectorRenderer.cs
│ │ ├── builder/
│ │ │ ├── HttpRequest.cs
│ │ │ └── Program.cs
│ │ ├── chainofresponsibility/
│ │ │ ├── AuthHandler.cs
│ │ │ ├── AuthorizationHandler.cs
│ │ │ ├── BaseHandler.cs
│ │ │ ├── BusinessLogicHandler.cs
│ │ │ ├── IRequestHandler.cs
│ │ │ ├── Program.cs
│ │ │ ├── RateLimitHandler.cs
│ │ │ ├── Request.cs
│ │ │ └── ValidationHandler.cs
│ │ ├── composite/
│ │ │ ├── File.cs
│ │ │ ├── Folder.cs
│ │ │ ├── IFileSystemItem.cs
│ │ │ └── Program.cs
│ │ ├── decorator/
│ │ │ ├── BoldDecorator.cs
│ │ │ ├── ITextView.cs
│ │ │ ├── ItalicDecorator.cs
│ │ │ ├── PlainTextView.cs
│ │ │ ├── Program.cs
│ │ │ ├── TextDecorator.cs
│ │ │ └── UnderlineDecorator.cs
│ │ ├── facade/
│ │ │ ├── BuildSystem.cs
│ │ │ ├── DeploymentFacade.cs
│ │ │ ├── DeploymentTarget.cs
│ │ │ ├── Program.cs
│ │ │ ├── TestingFramework.cs
│ │ │ └── VersionControlSystem.cs
│ │ ├── factory/
│ │ │ ├── EmailNotification.cs
│ │ │ ├── INotification.cs
│ │ │ ├── NotificationServiceNaive.cs
│ │ │ ├── Program.cs
│ │ │ ├── PushNotification.cs
│ │ │ ├── SMSNotification.cs
│ │ │ └── SimpleNotificationFactory.cs
│ │ ├── flyweight/
│ │ │ ├── CharacterFlyweightFactory.cs
│ │ │ ├── CharacterGlyph.cs
│ │ │ ├── ICharacterFlyweight.cs
│ │ │ ├── Program.cs
│ │ │ └── TextEditorClient.cs
│ │ ├── iterator/
│ │ │ ├── IIterableCollection.cs
│ │ │ ├── IIterator.cs
│ │ │ ├── Playlist.cs
│ │ │ ├── PlaylistIterator.cs
│ │ │ └── Program.cs
│ │ ├── mediator/
│ │ │ ├── Button.cs
│ │ │ ├── FormMediator.cs
│ │ │ ├── IUIMediator.cs
│ │ │ ├── Label.cs
│ │ │ ├── Program.cs
│ │ │ ├── TextField.cs
│ │ │ └── UIComponent.cs
│ │ ├── memento/
│ │ │ ├── Program.cs
│ │ │ ├── TextEditor.cs
│ │ │ ├── TextEditorMemento.cs
│ │ │ └── TextEditorUndoManager.cs
│ │ ├── observer/
│ │ │ ├── FitnessData.cs
│ │ │ ├── GoalNotifier.cs
│ │ │ ├── IFitnessDataObserver.cs
│ │ │ ├── IFitnessDataSubject.cs
│ │ │ ├── LiveActivityDisplay.cs
│ │ │ ├── Program.cs
│ │ │ └── ProgressLogger.cs
│ │ ├── prototype/
│ │ │ ├── Enemy.cs
│ │ │ ├── EnemyRegistry.cs
│ │ │ ├── Game.cs
│ │ │ └── IEnemyPrototype.cs
│ │ ├── proxy/
│ │ │ ├── HighResolutionImage.cs
│ │ │ ├── IImage.cs
│ │ │ ├── ImageGalleryApp.cs
│ │ │ └── ImageProxy.cs
│ │ ├── singleton/
│ │ │ ├── BillPughSingleton.cs
│ │ │ ├── DoubleCheckedLockingSingleton.cs
│ │ │ ├── EagerSingleton.cs
│ │ │ ├── LazySingleton.cs
│ │ │ ├── SingletonDemo.cs
│ │ │ ├── StaticBlockSingleton.cs
│ │ │ └── ThreadSafeSingleton.cs
│ │ ├── state/
│ │ │ ├── DispensingState.cs
│ │ │ ├── HasMoneyState.cs
│ │ │ ├── IMachineState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── ItemSelectedState.cs
│ │ │ ├── Program.cs
│ │ │ └── VendingMachine.cs
│ │ ├── strategy/
│ │ │ ├── DistanceBasedShipping.cs
│ │ │ ├── FlatRateShipping.cs
│ │ │ ├── IShippingStrategy.cs
│ │ │ ├── Order.cs
│ │ │ ├── Program.cs
│ │ │ ├── ShippingCostService.cs
│ │ │ ├── ThirdPartyApiShipping.cs
│ │ │ └── WeightBasedShipping.cs
│ │ └── templatemethod/
│ │ ├── AbstractReportExporter.cs
│ │ ├── CsvReportExporter.cs
│ │ ├── ExcelReportExporter.cs
│ │ ├── PdfReportExporter.cs
│ │ ├── Program.cs
│ │ └── ReportData.cs
│ ├── golang/
│ │ ├── adapter/
│ │ │ ├── checkout_service.go
│ │ │ ├── go.mod
│ │ │ ├── in_house_payment_processor.go
│ │ │ ├── legacy_gateway.go
│ │ │ ├── legacy_gateway_adapter.go
│ │ │ ├── main.go
│ │ │ └── payment_processor.go
│ │ ├── bridge/
│ │ │ ├── circle.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── raster_renderer.go
│ │ │ ├── rectangle.go
│ │ │ ├── renderer.go
│ │ │ ├── shape.go
│ │ │ └── vector_renderer.go
│ │ ├── builder/
│ │ │ ├── go.mod
│ │ │ ├── http_request.go
│ │ │ ├── http_request_builder.go
│ │ │ └── main.go
│ │ ├── chainofresponsibility/
│ │ │ ├── authentication_handler.go
│ │ │ ├── authorization_handler.go
│ │ │ ├── base_handler.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── request.go
│ │ │ ├── request_handler.go
│ │ │ └── validation_handler.go
│ │ ├── composite/
│ │ │ ├── file.go
│ │ │ ├── file_system_item.go
│ │ │ ├── folder.go
│ │ │ ├── go.mod
│ │ │ └── main.go
│ │ ├── decorator/
│ │ │ ├── beverage.go
│ │ │ ├── beverage_decorator.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── milk_decorator.go
│ │ │ ├── simple_coffee.go
│ │ │ └── sugar_decorator.go
│ │ ├── facade/
│ │ │ ├── build_system.go
│ │ │ ├── deployment_facade.go
│ │ │ ├── deployment_target.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── testing_framework.go
│ │ │ └── version_control_system.go
│ │ ├── factory/
│ │ │ ├── email_notification.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── notification.go
│ │ │ ├── push_notification.go
│ │ │ ├── simple_notification_factory.go
│ │ │ └── sms_notification.go
│ │ ├── flyweight/
│ │ │ ├── character_flyweight.go
│ │ │ ├── character_flyweight_factory.go
│ │ │ ├── character_glyph.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ └── text_editor_client.go
│ │ ├── iterator/
│ │ │ ├── book.go
│ │ │ ├── book_collection.go
│ │ │ ├── collection.go
│ │ │ ├── go.mod
│ │ │ ├── iterator.go
│ │ │ └── main.go
│ │ ├── mediator/
│ │ │ ├── chat_mediator.go
│ │ │ ├── colleague.go
│ │ │ ├── main.go
│ │ │ ├── mediator.go
│ │ │ └── user.go
│ │ ├── memento/
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── text_editor.go
│ │ │ ├── text_editor_memento.go
│ │ │ └── text_editor_undo_manager.go
│ │ ├── observer/
│ │ │ ├── fitness_data.go
│ │ │ ├── fitness_data_observer.go
│ │ │ ├── fitness_data_subject.go
│ │ │ ├── go.mod
│ │ │ ├── goal_notifier.go
│ │ │ ├── live_activity_display.go
│ │ │ ├── main.go
│ │ │ └── progress_logger.go
│ │ ├── prototype/
│ │ │ ├── enemy.go
│ │ │ ├── enemy_prototype.go
│ │ │ ├── enemy_registry.go
│ │ │ ├── go.mod
│ │ │ └── main.go
│ │ ├── proxy/
│ │ │ ├── go.mod
│ │ │ ├── high_resolution_image.go
│ │ │ ├── image.go
│ │ │ ├── image_proxy.go
│ │ │ └── main.go
│ │ ├── singleton/
│ │ │ ├── double_checked_singleton.go
│ │ │ ├── eager_singleton.go
│ │ │ ├── go.mod
│ │ │ ├── lazy_singleton.go
│ │ │ ├── main.go
│ │ │ └── thread_safe_singleton.go
│ │ ├── state/
│ │ │ ├── go.mod
│ │ │ ├── has_money_state.go
│ │ │ ├── idle_state.go
│ │ │ ├── item_selected_state.go
│ │ │ ├── machine_state.go
│ │ │ ├── main.go
│ │ │ └── vending_machine.go
│ │ ├── strategy/
│ │ │ ├── credit_card_payment.go
│ │ │ ├── main.go
│ │ │ ├── payment_strategy.go
│ │ │ ├── paypal_payment.go
│ │ │ └── shopping_cart.go
│ │ └── templatemethod/
│ │ ├── csv_data_processor.go
│ │ ├── data_processor.go
│ │ ├── main.go
│ │ └── xml_data_processor.go
│ ├── java/
│ │ ├── abstractfactory/
│ │ │ ├── AppLauncher.java
│ │ │ ├── Application.java
│ │ │ ├── Button.java
│ │ │ ├── Checkbox.java
│ │ │ ├── GUIFactory.java
│ │ │ ├── MacOSButton.java
│ │ │ ├── MacOSCheckbox.java
│ │ │ ├── MacOSFactory.java
│ │ │ ├── WindowsButton.java
│ │ │ ├── WindowsCheckbox.java
│ │ │ ├── WindowsFactory.java
│ │ │ └── shoefactory/
│ │ │ ├── BumpySole.java
│ │ │ ├── CasualShoeFactory.java
│ │ │ ├── FlatSole.java
│ │ │ ├── FormalShoeFactory.java
│ │ │ ├── RoundShoeLace.java
│ │ │ ├── Shoe.java
│ │ │ ├── ShoeFactory.java
│ │ │ ├── ShoeLace.java
│ │ │ ├── ShoeManufacture.java
│ │ │ ├── Sole.java
│ │ │ ├── SportsShoeFactory.java
│ │ │ ├── TapeShoeLace.java
│ │ │ └── ThinSole.java
│ │ ├── adapter/
│ │ │ ├── CheckoutService.java
│ │ │ ├── ECommerceAppV1.java
│ │ │ ├── ECommerceAppV2.java
│ │ │ ├── InHousePaymentProcessor.java
│ │ │ ├── LegacyGateway.java
│ │ │ ├── LegacyGatewayAdapter.java
│ │ │ └── PaymentProcessor.java
│ │ ├── bridge/
│ │ │ ├── BridgeDemo.java
│ │ │ ├── Circle.java
│ │ │ ├── RasterRenderer.java
│ │ │ ├── Rectangle.java
│ │ │ ├── Renderer.java
│ │ │ ├── Shape.java
│ │ │ └── VectorRenderer.java
│ │ ├── builder/
│ │ │ ├── HttpAppBuilder.java
│ │ │ ├── HttpAppTelescoping.java
│ │ │ ├── HttpRequest.java
│ │ │ └── HttpRequestTelescoping.java
│ │ ├── chainofresponsibility/
│ │ │ ├── AuthHandler.java
│ │ │ ├── AuthorizationHandler.java
│ │ │ ├── BaseHandler.java
│ │ │ ├── BusinessLogicHandler.java
│ │ │ ├── RateLimitHandler.java
│ │ │ ├── Request.java
│ │ │ ├── RequestHandler.java
│ │ │ ├── RequestHandlerV1.java
│ │ │ ├── RequestHandlerV2.java
│ │ │ └── ValidationHandler.java
│ │ ├── command/
│ │ │ ├── Command.java
│ │ │ ├── CommandPatternDemo.java
│ │ │ ├── Light.java
│ │ │ ├── LightOffCommand.java
│ │ │ ├── LightOnCommand.java
│ │ │ ├── SetTemperatureCommand.java
│ │ │ ├── SmartButton.java
│ │ │ └── Thermostat.java
│ │ ├── composite/
│ │ │ ├── filesystem/
│ │ │ │ ├── File.java
│ │ │ │ ├── FileExplorerApp.java
│ │ │ │ ├── FileSystemItem.java
│ │ │ │ └── Folder.java
│ │ │ └── organization/
│ │ │ ├── CompositeDemo.java
│ │ │ ├── Designer.java
│ │ │ ├── Developer.java
│ │ │ ├── Employee.java
│ │ │ └── Manager.java
│ │ ├── decorator/
│ │ │ ├── BoldDecorator.java
│ │ │ ├── DecoratorDemo.java
│ │ │ ├── ItalicDecorator.java
│ │ │ ├── PlainTextView.java
│ │ │ ├── TextDecorator.java
│ │ │ ├── TextView.java
│ │ │ ├── UnderlineDecorator.java
│ │ │ └── coffee/
│ │ │ ├── Coffee.java
│ │ │ ├── CoffeeDecorator.java
│ │ │ ├── DecoratorDemo.java
│ │ │ ├── Milk.java
│ │ │ ├── SimpleCoffee.java
│ │ │ └── Sugar.java
│ │ ├── facade/
│ │ │ ├── BuildSystem.java
│ │ │ ├── DeploymentAppDirect.java
│ │ │ ├── DeploymentAppFacade.java
│ │ │ ├── DeploymentFacade.java
│ │ │ ├── DeploymentOrchestrator.java
│ │ │ ├── DeploymentTarget.java
│ │ │ ├── TestingFramework.java
│ │ │ └── VersionControlSystem.java
│ │ ├── factory/
│ │ │ ├── notification/
│ │ │ │ ├── EmailNotification.java
│ │ │ │ ├── EmailNotificationCreator.java
│ │ │ │ ├── FactoryMethodDemo.java
│ │ │ │ ├── Notification.java
│ │ │ │ ├── NotificationCreator.java
│ │ │ │ ├── NotificationServiceNaive.java
│ │ │ │ ├── PushNotification.java
│ │ │ │ ├── PushNotificationCreator.java
│ │ │ │ ├── SMSNotification.java
│ │ │ │ ├── SMSNotificationCreator.java
│ │ │ │ └── SimpleNotificationFactory.java
│ │ │ └── subscription/
│ │ │ ├── Customer.java
│ │ │ ├── DataBase.java
│ │ │ ├── FactoryApplication.java
│ │ │ ├── Gold.java
│ │ │ ├── Platinum.java
│ │ │ ├── RoyalGold.java
│ │ │ ├── Silver.java
│ │ │ ├── Subscription.java
│ │ │ └── SubscriptionFactory.java
│ │ ├── flyweight/
│ │ │ ├── CharacterFlyweight.java
│ │ │ ├── CharacterFlyweightFactory.java
│ │ │ ├── CharacterGlyph.java
│ │ │ ├── FlyweightDemo.java
│ │ │ └── TextEditorClient.java
│ │ ├── iterator/
│ │ │ ├── IterableCollection.java
│ │ │ ├── Iterator.java
│ │ │ ├── MusicPlayer.java
│ │ │ ├── Playlist.java
│ │ │ ├── PlaylistIterator.java
│ │ │ └── books/
│ │ │ ├── Book.java
│ │ │ ├── BookShelf.java
│ │ │ ├── Container.java
│ │ │ ├── Iterator.java
│ │ │ └── IteratorDemo.java
│ │ ├── mediator/
│ │ │ ├── Button.java
│ │ │ ├── FormMediator.java
│ │ │ ├── Label.java
│ │ │ ├── MediatorApp.java
│ │ │ ├── TextField.java
│ │ │ ├── UIComponent.java
│ │ │ └── UIMediator.java
│ │ ├── memento/
│ │ │ ├── TextEditor.java
│ │ │ ├── TextEditorMemento.java
│ │ │ ├── TextEditorNaive.java
│ │ │ ├── TextEditorUndoManager.java
│ │ │ ├── TextEditorUndoV1.java
│ │ │ └── TextEditorUndoV2.java
│ │ ├── observer/
│ │ │ ├── FitnessAppNaiveClient.java
│ │ │ ├── FitnessAppObserverDemo.java
│ │ │ ├── FitnessData.java
│ │ │ ├── FitnessDataNaive.java
│ │ │ ├── FitnessDataObserver.java
│ │ │ ├── FitnessDataSubject.java
│ │ │ ├── GoalNotifier.java
│ │ │ ├── LiveActivityDisplay.java
│ │ │ ├── LiveActivityDisplayNaive.java
│ │ │ ├── NotificationServiceNaive.java
│ │ │ ├── ProgressLogger.java
│ │ │ └── ProgressLoggerNaive.java
│ │ ├── prototype/
│ │ │ ├── Enemy.java
│ │ │ ├── EnemyPrototype.java
│ │ │ ├── EnemyRegistry.java
│ │ │ └── Game.java
│ │ ├── proxy/
│ │ │ ├── HighResolutionImage.java
│ │ │ ├── Image.java
│ │ │ ├── ImageGalleryAppV1.java
│ │ │ ├── ImageGalleryAppV2.java
│ │ │ └── ImageProxy.java
│ │ ├── singleton/
│ │ │ ├── BillPughSingleton.java
│ │ │ ├── DoubleCheckedLockingSingleton.java
│ │ │ ├── EagerSingleton.java
│ │ │ ├── EnumSingleton.java
│ │ │ ├── LazySingleton.java
│ │ │ ├── StaticBlockSingleton.java
│ │ │ └── ThreadSafeSingleton.java
│ │ ├── state/
│ │ │ ├── DispensingState.java
│ │ │ ├── HasMoneyState.java
│ │ │ ├── IdleState.java
│ │ │ ├── ItemSelectedState.java
│ │ │ ├── MachineState.java
│ │ │ ├── VendingMachine.java
│ │ │ ├── VendingMachineApp.java
│ │ │ └── VendingMachineNaive.java
│ │ ├── strategy/
│ │ │ ├── DistanceBasedShipping.java
│ │ │ ├── ECommerceAppV1.java
│ │ │ ├── ECommerceAppV2.java
│ │ │ ├── FlatRateShipping.java
│ │ │ ├── Order.java
│ │ │ ├── ShippingCostCalculatorNaive.java
│ │ │ ├── ShippingCostService.java
│ │ │ ├── ShippingStrategy.java
│ │ │ ├── ThirdPartyApiShipping.java
│ │ │ └── WeightBasedShipping.java
│ │ ├── templatemethod/
│ │ │ ├── AbstractReportExporter.java
│ │ │ ├── CsvReportExporter.java
│ │ │ ├── CsvReportExporterNaive.java
│ │ │ ├── ExcelReportExporter.java
│ │ │ ├── ExcelReportExporterNaive.java
│ │ │ ├── PdfReportExporter.java
│ │ │ ├── PdfReportExporterNaive.java
│ │ │ ├── ReportAppNaive.java
│ │ │ ├── ReportAppTemplateMethod.java
│ │ │ └── ReportData.java
│ │ └── visitor/
│ │ ├── AreaCalculatorVisitor.java
│ │ ├── Circle.java
│ │ ├── Rectangle.java
│ │ ├── Shape.java
│ │ ├── ShapeVisitor.java
│ │ ├── SvgExporterVisitor.java
│ │ └── VisitorPatternDemo.java
│ └── python/
│ ├── README.md
│ └── adapter/
│ └── README.md
├── oop/
│ ├── cpp/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── csharp/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── golang/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── java/
│ │ ├── AggregationVsComposition/
│ │ │ └── README.MD
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── python/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ └── rust/
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── abstraction/
│ │ ├── README.md
│ │ └── main.rs
│ ├── aggregation/
│ │ ├── README.md
│ │ └── main.rs
│ ├── association/
│ │ ├── README.md
│ │ └── main.rs
│ ├── classes_and_objects/
│ │ ├── README.md
│ │ └── main.rs
│ ├── composition/
│ │ ├── README.md
│ │ └── main.rs
│ ├── encapsulation/
│ │ ├── README.md
│ │ └── main.rs
│ ├── inheritance/
│ │ ├── README.md
│ │ └── main.rs
│ ├── interfaces/
│ │ ├── README.md
│ │ └── main.rs
│ └── polymorphism/
│ ├── README.md
│ └── main.rs
├── problems/
│ ├── airline-management-system.md
│ ├── atm.md
│ ├── car-rental-system.md
│ ├── chess-game.md
│ ├── coffee-vending-machine.md
│ ├── concert-ticket-booking-system.md
│ ├── course-registration-system.md
│ ├── cricinfo.md
│ ├── digital-wallet-service.md
│ ├── elevator-system.md
│ ├── food-delivery-service.md
│ ├── hotel-management-system.md
│ ├── library-management-system.md
│ ├── linkedin.md
│ ├── logging-framework.md
│ ├── lru-cache.md
│ ├── movie-ticket-booking-system.md
│ ├── music-streaming-service.md
│ ├── online-auction-system.md
│ ├── online-shopping-service.md
│ ├── online-stock-brokerage-system.md
│ ├── parking-lot.md
│ ├── pub-sub-system.md
│ ├── restaurant-management-system.md
│ ├── ride-sharing-service.md
│ ├── snake-and-ladder.md
│ ├── social-networking-service.md
│ ├── splitwise.md
│ ├── stack-overflow.md
│ ├── task-management-system.md
│ ├── tic-tac-toe.md
│ ├── traffic-signal.md
│ └── vending-machine.md
└── solutions/
├── cpp/
│ ├── airlinemanagementsystem/
│ │ ├── AirlineManagementSystem.cpp
│ │ ├── AirlineManagementSystem.hpp
│ │ ├── AirlineManagementSystemDemo.cpp
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── Flight.cpp
│ │ ├── Flight.hpp
│ │ ├── Passenger.cpp
│ │ ├── Passenger.hpp
│ │ ├── README.md
│ │ ├── Seat.cpp
│ │ ├── Seat.hpp
│ │ └── airline_system
│ ├── atm/
│ │ ├── ATM.cpp
│ │ ├── ATM.hpp
│ │ ├── ATMDemo.cpp
│ │ ├── Account.cpp
│ │ ├── Account.hpp
│ │ ├── README.md
│ │ └── atm
│ ├── carrentalsystem/
│ │ ├── Car.cpp
│ │ ├── Car.hpp
│ │ ├── CarRentalSystem.cpp
│ │ ├── CarRentalSystem.hpp
│ │ ├── CarRentalSystemDemo.cpp
│ │ ├── Customer.cpp
│ │ ├── Customer.hpp
│ │ ├── README.md
│ │ ├── Rental.cpp
│ │ ├── Rental.hpp
│ │ └── car_rental
│ ├── chessgame/
│ │ ├── Board.hpp
│ │ ├── ChessDemo.cpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── Piece.cpp
│ │ ├── Piece.hpp
│ │ ├── Position.hpp
│ │ ├── README.md
│ │ └── pieces/
│ │ ├── Bishop.cpp
│ │ ├── Bishop.hpp
│ │ ├── King.cpp
│ │ ├── King.hpp
│ │ ├── Knight.cpp
│ │ ├── Knight.hpp
│ │ ├── Pawn.cpp
│ │ ├── Pawn.hpp
│ │ ├── Queen.cpp
│ │ ├── Queen.hpp
│ │ ├── Rook.cpp
│ │ └── Rook.hpp
│ ├── coffeevendingmachine/
│ │ ├── Coffee.cpp
│ │ ├── Coffee.hpp
│ │ ├── CoffeeType.hpp
│ │ ├── CoffeeVendingMachine.cpp
│ │ ├── CoffeeVendingMachine.hpp
│ │ ├── CoffeeVendingMachineDemo.cpp
│ │ ├── Inventory.cpp
│ │ ├── Inventory.hpp
│ │ ├── README.md
│ │ └── coffee_machine
│ ├── concertticketbookingsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── BookingSystem.cpp
│ │ ├── BookingSystem.hpp
│ │ ├── Concert.cpp
│ │ ├── Concert.hpp
│ │ ├── ConcertBookingDemo.cpp
│ │ ├── README.md
│ │ ├── Seat.cpp
│ │ ├── Seat.hpp
│ │ └── concert_booking
│ ├── courseregistrationsystem/
│ │ ├── Course.cpp
│ │ ├── Course.hpp
│ │ ├── README.md
│ │ ├── RegistrationSystem.cpp
│ │ ├── RegistrationSystem.hpp
│ │ ├── RegistrationSystemDemo.cpp
│ │ ├── Student.cpp
│ │ └── Student.hpp
│ ├── cricinfo/
│ │ ├── CricInfoDemo.cpp
│ │ ├── CricInfoSystem.cpp
│ │ ├── CricInfoSystem.hpp
│ │ ├── Match.cpp
│ │ ├── Match.hpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ ├── PlayerStats.hpp
│ │ ├── README.md
│ │ ├── Team.cpp
│ │ └── Team.hpp
│ ├── digitalwalletservice/
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── User.cpp
│ │ ├── User.hpp
│ │ ├── Wallet.cpp
│ │ ├── Wallet.hpp
│ │ ├── WalletDemo.cpp
│ │ ├── WalletSystem.cpp
│ │ └── WalletSystem.hpp
│ ├── elevatorsystem/
│ │ ├── Elevator.cpp
│ │ ├── Elevator.hpp
│ │ ├── ElevatorDemo.cpp
│ │ ├── ElevatorSystem.cpp
│ │ ├── ElevatorSystem.hpp
│ │ ├── README.md
│ │ ├── Request.cpp
│ │ └── Request.hpp
│ ├── fooddeliveryservice/
│ │ ├── DeliveryDemo.cpp
│ │ ├── DeliveryService.cpp
│ │ ├── DeliveryService.hpp
│ │ ├── MenuItem.cpp
│ │ ├── MenuItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── README.md
│ │ ├── Restaurant.cpp
│ │ ├── Restaurant.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── hotelmanagementsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── Guest.cpp
│ │ ├── Guest.hpp
│ │ ├── HotelDemo.cpp
│ │ ├── HotelManager.cpp
│ │ ├── HotelManager.hpp
│ │ ├── README.md
│ │ ├── Room.cpp
│ │ └── Room.hpp
│ ├── librarymanagementsystem/
│ │ ├── Book.cpp
│ │ ├── Book.hpp
│ │ ├── LibraryDemo.cpp
│ │ ├── LibraryManager.cpp
│ │ ├── LibraryManager.hpp
│ │ ├── Member.cpp
│ │ ├── Member.hpp
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ └── Transaction.hpp
│ ├── linkedin/
│ │ ├── LinkedInDemo.cpp
│ │ ├── LinkedInManager.cpp
│ │ ├── LinkedInManager.hpp
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── Profile.cpp
│ │ ├── Profile.hpp
│ │ ├── README.md
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── loggingframework/
│ │ ├── ConsoleAppender.cpp
│ │ ├── ConsoleAppender.hpp
│ │ ├── FileAppender.cpp
│ │ ├── FileAppender.hpp
│ │ ├── LogAppender.hpp
│ │ ├── LogLevel.hpp
│ │ ├── LogMessage.cpp
│ │ ├── LogMessage.hpp
│ │ ├── Logger.cpp
│ │ ├── Logger.hpp
│ │ ├── LoggingDemo.cpp
│ │ └── README.md
│ ├── lrucache/
│ │ ├── DoublyLinkedList.hpp
│ │ ├── LRUCache.hpp
│ │ ├── LRUCacheDemo.cpp
│ │ └── README.md
│ ├── movieticketbookingsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── BookingDemo.cpp
│ │ ├── BookingSystem.cpp
│ │ ├── BookingSystem.hpp
│ │ ├── Movie.cpp
│ │ ├── Movie.hpp
│ │ ├── README.md
│ │ ├── Show.cpp
│ │ ├── Show.hpp
│ │ ├── Theater.cpp
│ │ └── Theater.hpp
│ ├── musicstreamingservice/
│ │ ├── Artist.cpp
│ │ ├── Artist.hpp
│ │ ├── MusicStreamingDemo.cpp
│ │ ├── MusicStreamingService.cpp
│ │ ├── MusicStreamingService.hpp
│ │ ├── Playlist.cpp
│ │ ├── Playlist.hpp
│ │ ├── README.md
│ │ ├── Song.cpp
│ │ ├── Song.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlineauctionsystem/
│ │ ├── Auction.cpp
│ │ ├── Auction.hpp
│ │ ├── AuctionSystem.cpp
│ │ ├── AuctionSystem.hpp
│ │ ├── AuctionSystemDemo.cpp
│ │ ├── Item.cpp
│ │ ├── Item.hpp
│ │ ├── README.md
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlineshoppingservice/
│ │ ├── Cart.cpp
│ │ ├── Cart.hpp
│ │ ├── CartItem.cpp
│ │ ├── CartItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── Product.cpp
│ │ ├── Product.hpp
│ │ ├── README.md
│ │ ├── ShoppingDemo.cpp
│ │ ├── ShoppingSystem.cpp
│ │ ├── ShoppingSystem.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlinestockbrokeragesystem/
│ │ ├── BrokerageDemo.cpp
│ │ ├── BrokerageSystem.cpp
│ │ ├── BrokerageSystem.hpp
│ │ ├── Portfolio.cpp
│ │ ├── Portfolio.hpp
│ │ ├── README.md
│ │ ├── Stock.cpp
│ │ ├── Stock.hpp
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── parkinglot/
│ │ ├── ParkingLot.cpp
│ │ ├── ParkingLot.hpp
│ │ ├── ParkingLotDemo.cpp
│ │ ├── ParkingSpot.cpp
│ │ ├── ParkingSpot.hpp
│ │ ├── README.md
│ │ ├── Vehicle.cpp
│ │ └── Vehicle.hpp
│ ├── pubsubsystem/
│ │ ├── Message.cpp
│ │ ├── Message.hpp
│ │ ├── PubSubDemo.cpp
│ │ ├── PubSubSystem.cpp
│ │ ├── PubSubSystem.hpp
│ │ ├── README.md
│ │ ├── Subscriber.cpp
│ │ ├── Subscriber.hpp
│ │ ├── Topic.cpp
│ │ └── Topic.hpp
│ ├── restaurantmanagementsystem/
│ │ ├── MenuItem.cpp
│ │ ├── MenuItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── OrderItem.cpp
│ │ ├── OrderItem.hpp
│ │ ├── README.md
│ │ ├── RestaurantDemo.cpp
│ │ ├── RestaurantSystem.cpp
│ │ ├── RestaurantSystem.hpp
│ │ ├── Table.cpp
│ │ └── Table.hpp
│ ├── ridesharingservice/
│ │ ├── Location.cpp
│ │ ├── Location.hpp
│ │ ├── README.md
│ │ ├── Ride.cpp
│ │ ├── Ride.hpp
│ │ ├── RideDemo.cpp
│ │ ├── RideService.cpp
│ │ ├── RideService.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── snakeandladdergame/
│ │ ├── Board.cpp
│ │ ├── Board.hpp
│ │ ├── Dice.cpp
│ │ ├── Dice.hpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── GameDemo.cpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ └── README.md
│ ├── socialnetworkingservice/
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── README.md
│ │ ├── SocialNetwork.cpp
│ │ ├── SocialNetwork.hpp
│ │ ├── SocialNetworkDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── splitwise/
│ │ ├── Expense.cpp
│ │ ├── Expense.hpp
│ │ ├── README.md
│ │ ├── SplitwiseDemo.cpp
│ │ ├── SplitwiseSystem.cpp
│ │ ├── SplitwiseSystem.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── stackoverflow/
│ │ ├── Comment.cpp
│ │ ├── Comment.hpp
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── README.md
│ │ ├── StackOverflow.cpp
│ │ ├── StackOverflow.hpp
│ │ ├── StackOverflowDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── taskmanagementsystem/
│ │ ├── README.md
│ │ ├── Task.cpp
│ │ ├── Task.hpp
│ │ ├── TaskManager.cpp
│ │ ├── TaskManager.hpp
│ │ ├── TaskManagerDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── tictactoe/
│ │ ├── Board.cpp
│ │ ├── Board.hpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ ├── README.md
│ │ └── TicTacToeDemo.cpp
│ ├── trafficsignalsystem/
│ │ ├── Intersection.cpp
│ │ ├── Intersection.hpp
│ │ ├── README.md
│ │ ├── Signal.cpp
│ │ ├── Signal.hpp
│ │ ├── TrafficSystem.cpp
│ │ ├── TrafficSystem.hpp
│ │ └── TrafficSystemDemo.cpp
│ ├── vendingmachine/
│ │ ├── Product.cpp
│ │ ├── Product.hpp
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── VendingMachine.cpp
│ │ ├── VendingMachine.hpp
│ │ └── VendingMachineDemo.cpp
│ └── votingsystem/
│ └── README.md
├── csharp/
│ ├── LLDRunner.cs
│ ├── airlinemanagementsystem/
│ │ ├── Aircraft.cs
│ │ ├── AirlineManagementSystem.cs
│ │ ├── AirlineManagementSystemDemo.cs
│ │ ├── Booking.cs
│ │ ├── BookingManager.cs
│ │ ├── BookingStatus.cs
│ │ ├── Flight.cs
│ │ ├── FlightSearch.cs
│ │ ├── Passenger.cs
│ │ ├── Payment.cs
│ │ ├── PaymentProcessor.cs
│ │ ├── PaymentStatus.cs
│ │ ├── README.md
│ │ ├── Seat.cs
│ │ ├── SeatStatus.cs
│ │ └── SeatType.cs
│ ├── atm/
│ │ ├── ATM.cs
│ │ ├── ATMDemo.cs
│ │ ├── DispenserChain/
│ │ │ ├── CashDispenser.cs
│ │ │ ├── IDispenseChain.cs
│ │ │ ├── NoteDispenser.cs
│ │ │ ├── NoteDispenser100.cs
│ │ │ ├── NoteDispenser20.cs
│ │ │ └── NoteDispenser50.cs
│ │ ├── Enums/
│ │ │ └── OperationType.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ └── Card.cs
│ │ ├── README.md
│ │ ├── Service/
│ │ │ └── BankService.cs
│ │ ├── State/
│ │ │ ├── AuthenticatedState.cs
│ │ │ ├── HasCardState.cs
│ │ │ ├── IATMState.cs
│ │ │ └── IdleState.cs
│ │ └── atm.csproj
│ ├── bin/
│ │ └── Debug/
│ │ └── net8.0/
│ │ ├── c#
│ │ ├── c#.deps.json
│ │ ├── c#.pdb
│ │ └── c#.runtimeconfig.json
│ ├── c#.csproj
│ ├── c#.sln
│ ├── carrentalsystem/
│ │ ├── Car.cs
│ │ ├── CarRentalSystemDemo.cs
│ │ ├── CreditCardPaymentProcessor.cs
│ │ ├── Customer.cs
│ │ ├── IPaymentProcessor.cs
│ │ ├── PayPalPaymentProcessor.cs
│ │ ├── README.md
│ │ ├── RentalSystem.cs
│ │ └── Reservation.cs
│ ├── chessgame/
│ │ ├── Bishop.cs
│ │ ├── Board.cs
│ │ ├── ChessGame.cs
│ │ ├── ChessGameDemo.cs
│ │ ├── Color.cs
│ │ ├── InvalidMoveException.cs
│ │ ├── King.cs
│ │ ├── Knight.cs
│ │ ├── Move.cs
│ │ ├── Pawn.cs
│ │ ├── Piece.cs
│ │ ├── Player.cs
│ │ ├── Queen.cs
│ │ ├── README.md
│ │ └── Rook.cs
│ ├── coffeevendingmachine/
│ │ ├── CoffeeVendingMachine.cs
│ │ ├── CoffeeVendingMachineDemo.cs
│ │ ├── Decorator/
│ │ │ ├── CaramelSyrupDecorator.cs
│ │ │ ├── CoffeeDecorator.cs
│ │ │ └── ExtraSugarDecorator.cs
│ │ ├── Enums/
│ │ │ ├── CoffeeType.cs
│ │ │ ├── Ingredient.cs
│ │ │ └── ToppingType.cs
│ │ ├── Factory/
│ │ │ └── CoffeeFactory.cs
│ │ ├── Inventory.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── IVendingMachineState.cs
│ │ │ ├── OutOfIngredientState.cs
│ │ │ ├── PaidState.cs
│ │ │ ├── ReadyState.cs
│ │ │ └── SelectingState.cs
│ │ ├── TemplateMethod/
│ │ │ ├── Cappuccino.cs
│ │ │ ├── Coffee.cs
│ │ │ ├── Espresso.cs
│ │ │ └── Latte.cs
│ │ └── coffeevendingmachine.csproj
│ ├── concertticketbookingsystem/
│ │ ├── Booking.cs
│ │ ├── BookingStatus.cs
│ │ ├── Concert.cs
│ │ ├── ConcertTicketBookingSystem.cs
│ │ ├── ConcertTicketBookingSystemDemo.cs
│ │ ├── README.md
│ │ ├── Seat.cs
│ │ ├── SeatNotAvailableException.cs
│ │ ├── SeatStatus.cs
│ │ ├── SeatType.cs
│ │ └── User.cs
│ ├── courseregistrationsystem/
│ │ ├── Course.cs
│ │ ├── CourseRegistrationDemo.cs
│ │ ├── CourseRegistrationSystem.cs
│ │ ├── README.md
│ │ ├── Registration.cs
│ │ └── Student.cs
│ ├── cricinfo/
│ │ ├── CommentaryManager.cs
│ │ ├── CricinfoDemo.cs
│ │ ├── CricinfoService.cs
│ │ ├── Enums/
│ │ │ ├── ExtraType.cs
│ │ │ ├── MatchStatus.cs
│ │ │ ├── MatchType.cs
│ │ │ ├── PlayerRole.cs
│ │ │ └── WicketType.cs
│ │ ├── Models/
│ │ │ ├── Ball.cs
│ │ │ ├── Innings.cs
│ │ │ ├── Match.cs
│ │ │ ├── Player.cs
│ │ │ ├── PlayerStats.cs
│ │ │ ├── Team.cs
│ │ │ └── Wicket.cs
│ │ ├── Observers/
│ │ │ ├── CommentaryDisplay.cs
│ │ │ ├── IMatchObserver.cs
│ │ │ ├── ScorecardDisplay.cs
│ │ │ └── UserNotifier.cs
│ │ ├── README.md
│ │ ├── Repositories/
│ │ │ ├── MatchRepository.cs
│ │ │ └── PlayerRepository.cs
│ │ ├── States/
│ │ │ ├── FinishedState.cs
│ │ │ ├── IMatchState.cs
│ │ │ ├── InBreakState.cs
│ │ │ ├── LiveState.cs
│ │ │ └── ScheduledState.cs
│ │ ├── Strategy/
│ │ │ ├── IMatchFormatStrategy.cs
│ │ │ ├── ODIFormatStrategy.cs
│ │ │ └── T20FormatStrategy.cs
│ │ └── cricinfo.csproj
│ ├── digitalwalletservice/
│ │ ├── Account.cs
│ │ ├── BankAccount.cs
│ │ ├── CreditCard.cs
│ │ ├── Currency.cs
│ │ ├── CurrencyConverter.cs
│ │ ├── DigitalWallet.cs
│ │ ├── DigitalWalletDemo.cs
│ │ ├── InsufficientFundsException.cs
│ │ ├── PaymentMethod.cs
│ │ ├── README.md
│ │ ├── Transaction.cs
│ │ └── User.cs
│ ├── elevatorsystem/
│ │ ├── ElevatorSystem.cs
│ │ ├── ElevatorSystemDemo.cs
│ │ ├── Enums/
│ │ │ ├── Direction.cs
│ │ │ └── RequestSource.cs
│ │ ├── Models/
│ │ │ ├── Elevator.cs
│ │ │ └── Request.cs
│ │ ├── Observer/
│ │ │ ├── Display.cs
│ │ │ └── IElevatorObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── IElevatorState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── MovingDownState.cs
│ │ │ └── MovingUpState.cs
│ │ ├── Strategy/
│ │ │ ├── IElevatorSelectionStrategy.cs
│ │ │ └── NearestElevatorStrategy.cs
│ │ └── elevatorsystem.csproj
│ ├── fooddeliveryservice/
│ │ ├── Enums/
│ │ │ └── OrderStatus.cs
│ │ ├── FoodDeliveryService.cs
│ │ ├── FoodDeliveryServiceDemo.cs
│ │ ├── Models/
│ │ │ ├── Address.cs
│ │ │ ├── Customer.cs
│ │ │ ├── DeliveryAgent.cs
│ │ │ ├── Menu.cs
│ │ │ ├── MenuItem.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderItem.cs
│ │ │ ├── Restaurant.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IOrderObserver.cs
│ │ ├── README.md
│ │ ├── Strategies/
│ │ │ ├── assignment/
│ │ │ │ ├── IDeliveryAssignmentStrategy.cs
│ │ │ │ └── NearestAvailableAgentStrategy.cs
│ │ │ └── search/
│ │ │ ├── IRestaurantSearchStrategy.cs
│ │ │ ├── SearchByCityStrategy.cs
│ │ │ ├── SearchByMenuKeywordStrategy.cs
│ │ │ └── SearchByProximityStrategy.cs
│ │ └── fooddeliveryservice.csproj
│ ├── hotelmanagementsystem/
│ │ ├── CashPayment.cs
│ │ ├── CreditCardPayment.cs
│ │ ├── Guest.cs
│ │ ├── HotelManagementSystem.cs
│ │ ├── HotelManagementSystemDemo.cs
│ │ ├── Payment.cs
│ │ ├── README.md
│ │ ├── Reservation.cs
│ │ ├── ReservationStatus.cs
│ │ ├── Room.cs
│ │ ├── RoomStatus.cs
│ │ └── RoomType.cs
│ ├── librarymanagementsystem/
│ │ ├── Enum/
│ │ │ └── ItemType.cs
│ │ ├── Factory/
│ │ │ └── ItemFactory.cs
│ │ ├── LibraryManagementSystem.cs
│ │ ├── LibraryManagementSystemDemo.cs
│ │ ├── Models/
│ │ │ ├── Book.cs
│ │ │ ├── BookCopy.cs
│ │ │ ├── LibraryItem.cs
│ │ │ ├── Loan.cs
│ │ │ ├── Magazine.cs
│ │ │ ├── Member.cs
│ │ │ └── TransactionService.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── AvailableState.cs
│ │ │ ├── CheckedOutState.cs
│ │ │ ├── IItemState.cs
│ │ │ └── OnHoldState.cs
│ │ ├── Strategy/
│ │ │ ├── ISearchStrategy.cs
│ │ │ ├── SearchByAuthorStrategy.cs
│ │ │ └── SearchByTitleStrategy.cs
│ │ └── librarymanagementsystem.csproj
│ ├── linkedIn/
│ │ ├── Enums/
│ │ │ ├── ConnectionStatus.cs
│ │ │ └── NotificationType.cs
│ │ ├── LinkedInDemo.cs
│ │ ├── LinkedInSystem.cs
│ │ ├── Models/
│ │ │ ├── Comment.cs
│ │ │ ├── Connection.cs
│ │ │ ├── Education.cs
│ │ │ ├── Experience.cs
│ │ │ ├── Like.cs
│ │ │ ├── Member.cs
│ │ │ ├── NewsFeed.cs
│ │ │ ├── Notification.cs
│ │ │ ├── Post.cs
│ │ │ └── Profile.cs
│ │ ├── Observer/
│ │ │ ├── INotificationObserver.cs
│ │ │ └── Subject.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── ConnectionService.cs
│ │ │ ├── NewsFeedService.cs
│ │ │ ├── NotificationService.cs
│ │ │ └── SearchService.cs
│ │ ├── Strategy/
│ │ │ ├── ChronologicalSortStrategy.cs
│ │ │ └── IFeedSortingStrategy.cs
│ │ └── linkedIn.csproj
│ ├── loggingframework/
│ │ ├── Appenders/
│ │ │ ├── ConsoleAppender.cs
│ │ │ ├── FileAppender.cs
│ │ │ └── ILogAppender.cs
│ │ ├── AsyncLogProcessor.cs
│ │ ├── Enum/
│ │ │ └── LogLevel.cs
│ │ ├── Formatters/
│ │ │ ├── ILogFormatter.cs
│ │ │ └── SimpleTextFormatter.cs
│ │ ├── LogManager.cs
│ │ ├── Logger.cs
│ │ ├── LoggingFrameworkDemo.cs
│ │ ├── Models/
│ │ │ └── LogMessage.cs
│ │ ├── README.md
│ │ └── loggingframework.csproj
│ ├── lrucache/
│ │ ├── DoublyLinkedList.cs
│ │ ├── LRUCache.cs
│ │ ├── LRUCacheDemo.cs
│ │ ├── Node.cs
│ │ ├── README.md
│ │ └── lrucache.csproj
│ ├── movieticketbookingsystem/
│ │ ├── BookingManager.cs
│ │ ├── Enums/
│ │ │ ├── PaymentStatus.cs
│ │ │ ├── SeatStatus.cs
│ │ │ └── SeatType.cs
│ │ ├── Models/
│ │ │ ├── Booking.cs
│ │ │ ├── Cinema.cs
│ │ │ ├── City.cs
│ │ │ ├── Movie.cs
│ │ │ ├── Payment.cs
│ │ │ ├── Screen.cs
│ │ │ ├── Seat.cs
│ │ │ ├── Show.cs
│ │ │ └── User.cs
│ │ ├── MovieBookingDemo.cs
│ │ ├── MovieBookingService.cs
│ │ ├── Observer/
│ │ │ ├── IMovieObserver.cs
│ │ │ ├── MovieSubject.cs
│ │ │ └── UserObserver.cs
│ │ ├── README.md
│ │ ├── SeatLockManager.cs
│ │ ├── Strategies/
│ │ │ ├── Payment/
│ │ │ │ ├── CreditCardPaymentStrategy.cs
│ │ │ │ └── IPaymentStrategy.cs
│ │ │ └── Pricing/
│ │ │ ├── IPricingStrategy.cs
│ │ │ ├── WeekdayPricingStrategy.cs
│ │ │ └── WeekendPricingStrategy.cs
│ │ └── movieticketbookingsystem.csproj
│ ├── musicstreamingservice/
│ │ ├── Commands/
│ │ │ ├── ICommand.cs
│ │ │ ├── NextTrackCommand.cs
│ │ │ ├── PauseCommand.cs
│ │ │ └── PlayCommand.cs
│ │ ├── Enums/
│ │ │ ├── PlayerStatus.cs
│ │ │ └── SubscriptionTier.cs
│ │ ├── Models/
│ │ │ ├── Album.cs
│ │ │ ├── Artist.cs
│ │ │ ├── IPlayable.cs
│ │ │ ├── Player.cs
│ │ │ ├── Playlist.cs
│ │ │ ├── Song.cs
│ │ │ └── User.cs
│ │ ├── MusicStreamingDemo.cs
│ │ ├── MusicStreamingSystem.cs
│ │ ├── Observer/
│ │ │ ├── IArtistObserver.cs
│ │ │ └── Subject.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── RecommendationService.cs
│ │ │ └── SearchService.cs
│ │ ├── States/
│ │ │ ├── PausedState.cs
│ │ │ ├── PlayerState.cs
│ │ │ ├── PlayingState.cs
│ │ │ └── StoppedState.cs
│ │ ├── Strategies/
│ │ │ ├── Playback/
│ │ │ │ ├── FreePlaybackStrategy.cs
│ │ │ │ ├── PlaybackStrategy.cs
│ │ │ │ └── PremiumPlaybackStrategy.cs
│ │ │ └── Recommendation/
│ │ │ ├── GenreBasedRecommendationStrategy.cs
│ │ │ └── RecommendationStrategy.cs
│ │ └── musicstreamingservice.csproj
│ ├── obj/
│ │ ├── Debug/
│ │ │ └── net8.0/
│ │ │ ├── .NETCoreApp,Version=v8.0.AssemblyAttributes.cs
│ │ │ ├── apphost
│ │ │ ├── c#.AssemblyInfo.cs
│ │ │ ├── c#.AssemblyInfoInputs.cache
│ │ │ ├── c#.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── c#.GlobalUsings.g.cs
│ │ │ ├── c#.assets.cache
│ │ │ ├── c#.csproj.CoreCompileInputs.cache
│ │ │ ├── c#.csproj.FileListAbsolute.txt
│ │ │ ├── c#.genruntimeconfig.cache
│ │ │ ├── c#.pdb
│ │ │ └── c#.sourcelink.json
│ │ ├── c#.csproj.nuget.dgspec.json
│ │ ├── c#.csproj.nuget.g.props
│ │ ├── c#.csproj.nuget.g.targets
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
│ ├── onlineauctionsystem/
│ │ ├── AuctionService.cs
│ │ ├── AuctionSystemDemo.cs
│ │ ├── Enum/
│ │ │ └── AuctionState.cs
│ │ ├── Models/
│ │ │ ├── Auction.cs
│ │ │ ├── Bid.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IAuctionObserver.cs
│ │ ├── README.md
│ │ └── onlineauctionsystem.csproj
│ ├── onlineshoppingservice/
│ │ ├── Decorators/
│ │ │ ├── GiftWrapDecorator.cs
│ │ │ └── ProductDecorator.cs
│ │ ├── Enums/
│ │ │ ├── OrderStatus.cs
│ │ │ └── ProductCategory.cs
│ │ ├── Exceptions/
│ │ │ └── OutOfStockException.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ ├── Address.cs
│ │ │ ├── CartItem.cs
│ │ │ ├── Customer.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderLineItem.cs
│ │ │ ├── Product.cs
│ │ │ └── ShoppingCart.cs
│ │ ├── Observer/
│ │ │ ├── IOrderObserver.cs
│ │ │ └── Subject.cs
│ │ ├── OnlineShoppingDemo.cs
│ │ ├── OnlineShoppingSystem.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── InventoryService.cs
│ │ │ ├── OrderService.cs
│ │ │ ├── PaymentService.cs
│ │ │ └── SearchService.cs
│ │ ├── States/
│ │ │ ├── CancelledState.cs
│ │ │ ├── DeliveredState.cs
│ │ │ ├── IOrderState.cs
│ │ │ ├── PlacedState.cs
│ │ │ └── ShippedState.cs
│ │ ├── Strategy/
│ │ │ ├── CreditCardPaymentStrategy.cs
│ │ │ ├── IPaymentStrategy.cs
│ │ │ └── UPIPaymentStrategy.cs
│ │ └── onlineshoppingservice.csproj
│ ├── onlinestockbrokeragesystem/
│ │ ├── Commands/
│ │ │ ├── BuyStockCommand.cs
│ │ │ ├── IOrderCommand.cs
│ │ │ └── SellStockCommand.cs
│ │ ├── Enums/
│ │ │ ├── OrderStatus.cs
│ │ │ ├── OrderType.cs
│ │ │ └── TransactionType.cs
│ │ ├── Exceptions/
│ │ │ ├── InsufficientFundsException.cs
│ │ │ └── InsufficientStockException.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderBuilder.cs
│ │ │ ├── Stock.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IStockObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── CancelledState.cs
│ │ │ ├── FilledState.cs
│ │ │ ├── IOrderState.cs
│ │ │ └── OpenState.cs
│ │ ├── StockBrokerageSystem.cs
│ │ ├── StockBrokerageSystemDemo.cs
│ │ ├── StockExchange.cs
│ │ ├── Strategy/
│ │ │ ├── IExecutionStrategy.cs
│ │ │ ├── LimitOrderStrategy.cs
│ │ │ └── MarketOrderStrategy.cs
│ │ └── onlinestockbrokeragesystem.csproj
│ ├── parkinglot/
│ │ ├── Enums/
│ │ │ └── VehicleSize.cs
│ │ ├── Models/
│ │ │ ├── ParkingFloor.cs
│ │ │ ├── ParkingSpot.cs
│ │ │ ├── ParkingTicket.cs
│ │ │ └── Vehicle.cs
│ │ ├── ParkingLot.cs
│ │ ├── ParkingLotDemo.cs
│ │ ├── README.md
│ │ ├── Strategies/
│ │ │ ├── Fee/
│ │ │ │ ├── FlatRateFeeStrategy.cs
│ │ │ │ ├── IFeeStrategy.cs
│ │ │ │ └── VehicleBasedFeeStrategy.cs
│ │ │ └── Parking/
│ │ │ ├── BestFitStrategy.cs
│ │ │ ├── FarthestFirstStrategy.cs
│ │ │ ├── IParkingStrategy.cs
│ │ │ └── NearestFirstStrategy.cs
│ │ └── parkinglot.csproj
│ ├── pubsubsystem/
│ │ ├── Models/
│ │ │ ├── Message.cs
│ │ │ └── Topic.cs
│ │ ├── PubSubDemo.cs
│ │ ├── PubSubService.cs
│ │ ├── README.md
│ │ ├── Subscribers/
│ │ │ ├── AlertSubscriber.cs
│ │ │ ├── ISubscriber.cs
│ │ │ └── NewsSubscriber.cs
│ │ └── pubsubsystem.csproj
│ ├── restaurantmanagementsystem/
│ │ ├── Commands/
│ │ │ ├── ICommand.cs
│ │ │ ├── PrepareOrderCommand.cs
│ │ │ └── ServeOrderCommand.cs
│ │ ├── Decorators/
│ │ │ ├── BillDecorator.cs
│ │ │ ├── ServiceChargeDecorator.cs
│ │ │ └── TaxDecorator.cs
│ │ ├── Enum/
│ │ │ └── TableStatus.cs
│ │ ├── Models/
│ │ │ ├── BaseBill.cs
│ │ │ ├── Bill.cs
│ │ │ ├── Chef.cs
│ │ │ ├── IBillComponent.cs
│ │ │ ├── Menu.cs
│ │ │ ├── MenuItem.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderItem.cs
│ │ │ ├── Restaurant.cs
│ │ │ ├── Staff.cs
│ │ │ ├── Table.cs
│ │ │ └── Waiter.cs
│ │ ├── Observer/
│ │ │ └── IOrderObserver.cs
│ │ ├── README.md
│ │ ├── RestaurantManagementSystemDemo.cs
│ │ ├── RestaurantManagementSystemFacade.cs
│ │ ├── States/
│ │ │ ├── IOrderItemState.cs
│ │ │ ├── OrderedState.cs
│ │ │ ├── PreparingState.cs
│ │ │ ├── ReadyForPickupState.cs
│ │ │ └── ServedState.cs
│ │ └── restaurantmanagementsystem.csproj
│ ├── ridesharingservice/
│ │ ├── Enums/
│ │ │ ├── DriverStatus.cs
│ │ │ ├── RideType.cs
│ │ │ └── TripStatus.cs
│ │ ├── Models/
│ │ │ ├── Driver.cs
│ │ │ ├── Location.cs
│ │ │ ├── Rider.cs
│ │ │ ├── Trip.cs
│ │ │ ├── User.cs
│ │ │ └── Vehicle.cs
│ │ ├── Observer/
│ │ │ └── ITripObserver.cs
│ │ ├── README.md
│ │ ├── RideSharingService.cs
│ │ ├── RideSharingServiceDemo.cs
│ │ ├── States/
│ │ │ ├── AssignedState.cs
│ │ │ ├── CompletedState.cs
│ │ │ ├── ITripState.cs
│ │ │ ├── InProgressState.cs
│ │ │ └── RequestedState.cs
│ │ ├── Strategies/
│ │ │ ├── Matching/
│ │ │ │ ├── IDriverMatchingStrategy.cs
│ │ │ │ └── NearestDriverMatchingStrategy.cs
│ │ │ └── Pricing/
│ │ │ ├── FlatRatePricingStrategy.cs
│ │ │ ├── IPricingStrategy.cs
│ │ │ └── VehicleBasedPricingStrategy.cs
│ │ └── ridesharingservice.csproj
│ ├── snakeandladdergame/
│ │ ├── Enums/
│ │ │ └── GameStatus.cs
│ │ ├── Game.cs
│ │ ├── Models/
│ │ │ ├── Board.cs
│ │ │ ├── BoardEntity.cs
│ │ │ ├── Dice.cs
│ │ │ ├── Ladder.cs
│ │ │ ├── Player.cs
│ │ │ └── Snake.cs
│ │ ├── README.md
│ │ ├── SnakeAndLadderDemo.cs
│ │ └── snakeandladdergame.csproj
│ ├── socialnetworkingservice/
│ │ ├── Models/
│ │ │ ├── Comment.cs
│ │ │ ├── CommentableEntity.cs
│ │ │ ├── Post.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── IPostObserver.cs
│ │ │ └── UserNotifier.cs
│ │ ├── README.md
│ │ ├── Repositories/
│ │ │ ├── PostRepository.cs
│ │ │ └── UserRepository.cs
│ │ ├── Services/
│ │ │ ├── NewsFeedService.cs
│ │ │ ├── PostService.cs
│ │ │ └── UserService.cs
│ │ ├── SocialNetworkFacade.cs
│ │ ├── SocialNetworkingDemo.cs
│ │ ├── Strategy/
│ │ │ ├── ChronologicalStrategy.cs
│ │ │ └── INewsFeedGenerationStrategy.cs
│ │ └── socialnetworkingservice.csproj
│ ├── splitwise/
│ │ ├── Models/
│ │ │ ├── BalanceSheet.cs
│ │ │ ├── Expense.cs
│ │ │ ├── Group.cs
│ │ │ ├── Split.cs
│ │ │ ├── Transaction.cs
│ │ │ └── User.cs
│ │ ├── README.md
│ │ ├── SplitwiseDemo.cs
│ │ ├── SplitwiseService.cs
│ │ ├── Strategy/
│ │ │ ├── EqualSplitStrategy.cs
│ │ │ ├── ExactSplitStrategy.cs
│ │ │ ├── PercentageSplitStrategy.cs
│ │ │ └── SplitStrategy.cs
│ │ └── splitwise.csproj
│ ├── stackoverflow/
│ │ ├── Enums/
│ │ │ ├── EventType.cs
│ │ │ └── VoteType.cs
│ │ ├── Models/
│ │ │ ├── Answer.cs
│ │ │ ├── Comment.cs
│ │ │ ├── Content.cs
│ │ │ ├── Post.cs
│ │ │ ├── Question.cs
│ │ │ ├── Tag.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── Event.cs
│ │ │ ├── IPostObserver.cs
│ │ │ └── ReputationManager.cs
│ │ ├── README.md
│ │ ├── StackOverflowDemo.cs
│ │ ├── StackOverflowService.cs
│ │ ├── Strategy/
│ │ │ ├── ISearchStrategy.cs
│ │ │ ├── KeywordSearchStrategy.cs
│ │ │ ├── TagSearchStrategy.cs
│ │ │ └── UserSearchStrategy.cs
│ │ └── stackoverflow.csproj
│ ├── taskmanagementsystem/
│ │ ├── Enums/
│ │ │ ├── TaskPriority.cs
│ │ │ └── TaskStatus.cs
│ │ ├── Models/
│ │ │ ├── ActivityLog.cs
│ │ │ ├── Comment.cs
│ │ │ ├── Tag.cs
│ │ │ ├── Task.cs
│ │ │ ├── TaskList.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── ActivityLogger.cs
│ │ │ └── ITaskObserver.cs
│ │ ├── README.md
│ │ ├── State/
│ │ │ ├── DoneState.cs
│ │ │ ├── InProgressState.cs
│ │ │ ├── TaskState.cs
│ │ │ └── TodoState.cs
│ │ ├── Strategy/
│ │ │ ├── SortByDueDate.cs
│ │ │ ├── SortByPriority.cs
│ │ │ └── TaskSortStrategy.cs
│ │ ├── TaskManagementSystem.cs
│ │ ├── TaskManagementSystemDemo.cs
│ │ └── taskmanagementsystem.csproj
│ ├── tictactoe/
│ │ ├── Enums/
│ │ │ ├── GameStatus.cs
│ │ │ └── Symbol.cs
│ │ ├── Exceptions/
│ │ │ └── InvalidMoveException.cs
│ │ ├── Models/
│ │ │ ├── Board.cs
│ │ │ ├── Cell.cs
│ │ │ ├── Game.cs
│ │ │ └── Player.cs
│ │ ├── Observer/
│ │ │ ├── GameSubject.cs
│ │ │ ├── IGameObserver.cs
│ │ │ └── Scoreboard.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── DrawState.cs
│ │ │ ├── IGameState.cs
│ │ │ ├── InProgressState.cs
│ │ │ └── WinnerState.cs
│ │ ├── Strategy/
│ │ │ ├── ColumnWinningStrategy.cs
│ │ │ ├── DiagonalWinningStrategy.cs
│ │ │ ├── IWinningStrategy.cs
│ │ │ └── RowWinningStrategy.cs
│ │ ├── TicTacToeDemo.cs
│ │ ├── TicTacToeSystem.cs
│ │ └── tictactoe.csproj
│ ├── trafficsignalsystem/
│ │ ├── Enums/
│ │ │ ├── Direction.cs
│ │ │ └── LightColor.cs
│ │ ├── IntersectionController.cs
│ │ ├── Observer/
│ │ │ ├── CentralMonitor.cs
│ │ │ └── ITrafficObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── Intersection/
│ │ │ │ ├── EastWestGreenState.cs
│ │ │ │ ├── IIntersectionState.cs
│ │ │ │ └── NorthSouthGreenState.cs
│ │ │ └── Light/
│ │ │ ├── GreenState.cs
│ │ │ ├── ISignalState.cs
│ │ │ ├── RedState.cs
│ │ │ └── YellowState.cs
│ │ ├── TrafficControlSystem.cs
│ │ ├── TrafficLight.cs
│ │ ├── TrafficSystemDemo.cs
│ │ └── trafficsignalsystem.csproj
│ ├── vendingmachine/
│ │ ├── Enum/
│ │ │ └── Coin.cs
│ │ ├── Models/
│ │ │ ├── Inventory.cs
│ │ │ └── Item.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── DispensingState.cs
│ │ │ ├── HasMoneyState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── ItemSelectedState.cs
│ │ │ └── VendingMachineState.cs
│ │ ├── VendingMachine.cs
│ │ ├── VendingMachineDemo.cs
│ │ └── vendingmachine.csproj
│ └── votingsystem/
│ └── README.md
├── golang/
│ ├── airlinemanagementsystem/
│ │ ├── README.md
│ │ ├── aircraft.go
│ │ ├── airline_management_system.go
│ │ ├── airline_management_system_demo.go
│ │ ├── booking.go
│ │ ├── booking_manager.go
│ │ ├── flight.go
│ │ ├── flight_search.go
│ │ ├── passenger.go
│ │ ├── payment.go
│ │ ├── payment_processor.go
│ │ ├── seat.go
│ │ └── types.go
│ ├── app.log
│ ├── atm/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── atm.go
│ │ ├── atm_demo.go
│ │ ├── banking_service.go
│ │ ├── card.go
│ │ ├── cash_dispenser.go
│ │ ├── deposit_transaction.go
│ │ ├── errors.go
│ │ ├── transaction.go
│ │ └── withdrawal_transaction.go
│ ├── carrentalsystem/
│ │ ├── README.md
│ │ ├── car.go
│ │ ├── car_rental_system_demo.go
│ │ ├── credit_card_processor.go
│ │ ├── customer.go
│ │ ├── payment_processor.go
│ │ ├── paypal_processor.go
│ │ ├── rental_system.go
│ │ └── reservation.go
│ ├── chessgame/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── chess_game.go
│ │ ├── chess_game_demo.go
│ │ ├── color.go
│ │ ├── errors.go
│ │ ├── move.go
│ │ ├── piece.go
│ │ ├── pieces.go
│ │ └── player.go
│ ├── coffeevendingmachine/
│ │ ├── README.md
│ │ ├── coffee.go
│ │ ├── coffee_machine.go
│ │ ├── coffee_vending_machine_demo.go
│ │ ├── ingredient.go
│ │ └── payment.go
│ ├── concertticketbookingsystem/
│ │ ├── README.md
│ │ ├── booking.go
│ │ ├── concert.go
│ │ ├── concert_booking_system.go
│ │ ├── concert_booking_system_demo.go
│ │ ├── errors.go
│ │ ├── seat.go
│ │ ├── types.go
│ │ ├── user.go
│ │ └── utils.go
│ ├── courseregistrationsystem/
│ │ ├── README.md
│ │ ├── course.go
│ │ ├── course_registration_system.go
│ │ ├── course_registration_system_demo.go
│ │ ├── registration.go
│ │ └── student.go
│ ├── cricinfo/
│ │ ├── README.md
│ │ ├── ball.go
│ │ ├── cricinfo.go
│ │ ├── cricinfo_system.go
│ │ ├── innings.go
│ │ ├── match.go
│ │ ├── match_service.go
│ │ ├── over.go
│ │ ├── player.go
│ │ ├── scorecard.go
│ │ ├── scorecard_service.go
│ │ ├── team.go
│ │ └── types.go
│ ├── digitalwalletservice/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── bank_account.go
│ │ ├── credit_card.go
│ │ ├── currency_converter.go
│ │ ├── digital_wallet.go
│ │ ├── digital_wallet_demo.go
│ │ ├── errors.go
│ │ ├── payment_method.go
│ │ ├── transaction.go
│ │ ├── types.go
│ │ └── user.go
│ ├── elevatorsystem/
│ │ ├── README.md
│ │ ├── direction.go
│ │ ├── elevator.go
│ │ ├── elevator_controller.go
│ │ ├── elevator_controller_demo.go
│ │ └── request.go
│ ├── fooddeliveryservice/
│ │ ├── README.md
│ │ ├── customer.go
│ │ ├── delivery_agent.go
│ │ ├── food_delivery_service.go
│ │ ├── food_delivery_service_demo.go
│ │ ├── menu_item.go
│ │ ├── order.go
│ │ ├── restaurant.go
│ │ └── types.go
│ ├── go.mod
│ ├── hotelmanagementsystem/
│ │ ├── README.md
│ │ ├── guest.go
│ │ ├── hotel_management.go
│ │ ├── hotel_management_demo.go
│ │ ├── payment.go
│ │ ├── reservation.go
│ │ ├── room.go
│ │ └── types.go
│ ├── librarymanagementsystem/
│ │ ├── README.md
│ │ ├── book.go
│ │ ├── library_management_system_demo.go
│ │ ├── library_manager.go
│ │ └── member.go
│ ├── linkedin/
│ │ ├── README.md
│ │ ├── connection.go
│ │ ├── education.go
│ │ ├── experience.go
│ │ ├── job_posting.go
│ │ ├── linkedin_service.go
│ │ ├── linkedin_service_demo.go
│ │ ├── message.go
│ │ ├── notification.go
│ │ ├── profile.go
│ │ ├── skill.go
│ │ ├── types.go
│ │ └── user.go
│ ├── loggingframework/
│ │ ├── README.md
│ │ ├── console_appender.go
│ │ ├── database_appender.go
│ │ ├── file_appender.go
│ │ ├── log_appender.go
│ │ ├── log_level.go
│ │ ├── log_message.go
│ │ ├── logger.go
│ │ ├── logger_config.go
│ │ └── logging_framework_demo.go
│ ├── lrucache/
│ │ ├── README.md
│ │ ├── lru_cache.go
│ │ └── lru_cache_demo.go
│ ├── main.go
│ ├── movieticketbookingsystem/
│ │ ├── README.md
│ │ ├── booking.go
│ │ ├── movie.go
│ │ ├── movie_ticket_booking_system.go
│ │ ├── movie_ticket_booking_system_demo.go
│ │ ├── seat.go
│ │ ├── show.go
│ │ ├── theater.go
│ │ ├── types.go
│ │ └── user.go
│ ├── musicstreamingservice/
│ │ ├── README.md
│ │ ├── album.go
│ │ ├── artist.go
│ │ ├── music_library.go
│ │ ├── music_player.go
│ │ ├── music_recommender.go
│ │ ├── music_streaming_service.go
│ │ ├── music_streaming_service_demo.go
│ │ ├── playlist.go
│ │ ├── song.go
│ │ ├── user.go
│ │ └── userManager.go
│ ├── onlineauctionsystem/
│ │ ├── README.md
│ │ ├── auction_listing.go
│ │ ├── auction_status.go
│ │ ├── auction_system.go
│ │ ├── bid.go
│ │ ├── main.go
│ │ └── user.go
│ ├── onlineshoppingservice/
│ │ ├── README.md
│ │ ├── credit_card_payment.go
│ │ ├── online_shopping_service.go
│ │ ├── online_shopping_service_demo.go
│ │ ├── order.go
│ │ ├── order_item.go
│ │ ├── order_status.go
│ │ ├── payment.go
│ │ ├── product.go
│ │ ├── shopping_cart.go
│ │ └── user.go
│ ├── onlinestockbrokeragesystem/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── buy_order.go
│ │ ├── exceptions.go
│ │ ├── order.go
│ │ ├── portfolio.go
│ │ ├── sell_order.go
│ │ ├── stock.go
│ │ ├── stock_broker.go
│ │ ├── stock_broker_demo.go
│ │ ├── types.go
│ │ └── user.go
│ ├── parkinglot/
│ │ ├── README.md
│ │ ├── car.go
│ │ ├── level.go
│ │ ├── motorcycle.go
│ │ ├── parking_lot.go
│ │ ├── parking_lot_demo.go
│ │ ├── parking_spot.go
│ │ ├── truck.go
│ │ └── vehicle.go
│ ├── pubsubsystem/
│ │ ├── README.md
│ │ ├── message.go
│ │ ├── print_subscriber.go
│ │ ├── publisher.go
│ │ ├── pubsub_system_demo.go
│ │ ├── subscriber.go
│ │ └── topic.go
│ ├── restaurantmanagementsystem/
│ │ ├── README.md
│ │ ├── menu_item.go
│ │ ├── order.go
│ │ ├── order_status.go
│ │ ├── payment.go
│ │ ├── payment_method.go
│ │ ├── payment_status.go
│ │ ├── reservation.go
│ │ ├── restaurant.go
│ │ ├── restaurant_management_demo.go
│ │ └── staff.go
│ ├── ridesharingservice/
│ │ ├── README.md
│ │ ├── driver.go
│ │ ├── driver_status.go
│ │ ├── location.go
│ │ ├── passenger.go
│ │ ├── ride.go
│ │ ├── ride_service.go
│ │ ├── ride_sharing_service_demo.go
│ │ └── ride_status.go
│ ├── snakeandladdergame/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── dice.go
│ │ ├── game_manager.go
│ │ ├── ladder.go
│ │ ├── player.go
│ │ ├── snake.go
│ │ ├── snake_and_ladder_demo.go
│ │ └── snake_and_ladder_game.go
│ ├── socialnetworkingservice/
│ │ ├── README.md
│ │ ├── comment.go
│ │ ├── notification.go
│ │ ├── post.go
│ │ ├── social_networking_service.go
│ │ ├── social_networking_service_demo.go
│ │ ├── types.go
│ │ └── user.go
│ ├── splitwise/
│ │ ├── README.md
│ │ ├── equal_split.go
│ │ ├── expense.go
│ │ ├── group.go
│ │ ├── percent_split.go
│ │ ├── split.go
│ │ ├── splitwise_demo.go
│ │ ├── splitwise_service.go
│ │ ├── transaction.go
│ │ └── user.go
│ ├── stackOverFlow/
│ │ ├── README.md
│ │ ├── answer.go
│ │ ├── stackoverflow.go
│ │ ├── stackoverflow_demo.go
│ │ └── types.go
│ ├── taskmanagementsystem/
│ │ ├── README.md
│ │ ├── task.go
│ │ ├── task_management_system_demo.go
│ │ ├── task_manager.go
│ │ ├── task_status.go
│ │ └── user.go
│ ├── tictactoe/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── game.go
│ │ ├── player.go
│ │ └── tictactoe_demo.go
│ ├── trafficsignalsystem/
│ │ ├── README.md
│ │ ├── road.go
│ │ ├── signal.go
│ │ ├── traffic_controller.go
│ │ ├── traffic_light.go
│ │ └── traffic_signal_system_demo.go
│ ├── vendingmachine/
│ │ ├── README.md
│ │ ├── coin.go
│ │ ├── inventory.go
│ │ ├── note.go
│ │ ├── product.go
│ │ ├── state.go
│ │ ├── vending_machine.go
│ │ └── vending_machine_demo.go
│ └── votingsystem/
│ └── README.md
├── java/
│ ├── .gitignore
│ ├── pom.xml
│ ├── src/
│ │ ├── LLDRunner.java
│ │ ├── airlinemanagementsystem/
│ │ │ ├── Aircraft.java
│ │ │ ├── AirlineManagementSystem.java
│ │ │ ├── AirlineManagementSystemDemo.java
│ │ │ ├── Passenger.java
│ │ │ ├── README.md
│ │ │ ├── booking/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── BookingManager.java
│ │ │ │ └── BookingStatus.java
│ │ │ ├── flight/
│ │ │ │ ├── Flight.java
│ │ │ │ ├── FlightSearch.java
│ │ │ │ └── FlightStatus.java
│ │ │ ├── payment/
│ │ │ │ ├── Payment.java
│ │ │ │ ├── PaymentProcessor.java
│ │ │ │ └── PaymentStatus.java
│ │ │ └── seat/
│ │ │ ├── Seat.java
│ │ │ ├── SeatStatus.java
│ │ │ └── SeatType.java
│ │ ├── atm/
│ │ │ ├── ATMDemo.java
│ │ │ ├── ATMSystem.java
│ │ │ ├── README.md
│ │ │ ├── chainofresponsibility/
│ │ │ │ ├── DispenseChain.java
│ │ │ │ ├── NoteDispenser.java
│ │ │ │ ├── NoteDispenser100.java
│ │ │ │ ├── NoteDispenser20.java
│ │ │ │ └── NoteDispenser50.java
│ │ │ ├── entities/
│ │ │ │ ├── Account.java
│ │ │ │ ├── BankService.java
│ │ │ │ ├── Card.java
│ │ │ │ └── CashDispenser.java
│ │ │ ├── enums/
│ │ │ │ └── OperationType.java
│ │ │ └── state/
│ │ │ ├── ATMState.java
│ │ │ ├── AuthenticatedState.java
│ │ │ ├── HasCardState.java
│ │ │ └── IdleState.java
│ │ ├── carrentalsystem/
│ │ │ ├── Car.java
│ │ │ ├── CarRentalSystem.java
│ │ │ ├── CarRentalSystemDemo.java
│ │ │ ├── CarStatus.java
│ │ │ ├── CarType.java
│ │ │ ├── Customer.java
│ │ │ ├── README.md
│ │ │ ├── Reservation.java
│ │ │ └── payment/
│ │ │ ├── CreditCardPaymentProcessor.java
│ │ │ ├── PayPalPaymentProcessor.java
│ │ │ └── PaymentProcessor.java
│ │ ├── chessgame/
│ │ │ ├── Board.java
│ │ │ ├── Cell.java
│ │ │ ├── ChessGame.java
│ │ │ ├── ChessGameDemo.java
│ │ │ ├── Color.java
│ │ │ ├── InvalidMoveException.java
│ │ │ ├── Move.java
│ │ │ ├── Player.java
│ │ │ ├── README.md
│ │ │ └── pieces/
│ │ │ ├── Bishop.java
│ │ │ ├── King.java
│ │ │ ├── Knight.java
│ │ │ ├── Pawn.java
│ │ │ ├── Piece.java
│ │ │ ├── Queen.java
│ │ │ └── Rook.java
│ │ ├── coffeevendingmachine/
│ │ │ ├── CoffeeVendingMachine.java
│ │ │ ├── CoffeeVendingMachineDemo.java
│ │ │ ├── Inventory.java
│ │ │ ├── README.md
│ │ │ ├── decorator/
│ │ │ │ ├── CaramelSyrupDecorator.java
│ │ │ │ ├── Coffee.java
│ │ │ │ ├── CoffeeDecorator.java
│ │ │ │ └── ExtraSugarDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── CoffeeType.java
│ │ │ │ ├── Ingredient.java
│ │ │ │ └── ToppingType.java
│ │ │ ├── factory/
│ │ │ │ └── CoffeeFactory.java
│ │ │ ├── state/
│ │ │ │ ├── OutOfIngredientState.java
│ │ │ │ ├── PaidState.java
│ │ │ │ ├── ReadyState.java
│ │ │ │ ├── SelectingState.java
│ │ │ │ └── VendingMachineState.java
│ │ │ └── templatemethod/
│ │ │ ├── Cappuccino.java
│ │ │ ├── Espresso.java
│ │ │ └── Latte.java
│ │ ├── concertticketbookingsystem/
│ │ │ ├── Booking.java
│ │ │ ├── BookingStatus.java
│ │ │ ├── Concert.java
│ │ │ ├── ConcertTicketBookingSystem.java
│ │ │ ├── ConcertTicketBookingSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── Seat.java
│ │ │ ├── SeatNotAvailableException.java
│ │ │ ├── SeatStatus.java
│ │ │ ├── SeatType.java
│ │ │ └── User.java
│ │ ├── courseregistrationsystem/
│ │ │ ├── CourseRegistrationDemo.java
│ │ │ ├── CourseRegistrationService.java
│ │ │ ├── CourseRegistrationSystemFacade.java
│ │ │ ├── README.md
│ │ │ ├── chain/
│ │ │ │ ├── CapacityRuleHandler.java
│ │ │ │ ├── PrerequisiteRuleHandler.java
│ │ │ │ ├── RegistrationRequest.java
│ │ │ │ ├── RegistrationRuleHandler.java
│ │ │ │ └── ScheduleConflictRuleHandler.java
│ │ │ ├── exception/
│ │ │ │ └── RegistrationException.java
│ │ │ ├── model/
│ │ │ │ ├── Course.java
│ │ │ │ ├── CourseOffering.java
│ │ │ │ ├── Professor.java
│ │ │ │ ├── Student.java
│ │ │ │ └── TimeSlot.java
│ │ │ ├── observer/
│ │ │ │ ├── CourseOfferingObserver.java
│ │ │ │ └── WaitlistManager.java
│ │ │ └── repository/
│ │ │ ├── CourseRepository.java
│ │ │ └── StudentRepository.java
│ │ ├── cricinfo/
│ │ │ ├── CommentaryManager.java
│ │ │ ├── CricInfoService.java
│ │ │ ├── CricinfoDemo.java
│ │ │ ├── README.md
│ │ │ ├── entity/
│ │ │ │ ├── Ball.java
│ │ │ │ ├── Innings.java
│ │ │ │ ├── Match.java
│ │ │ │ ├── Player.java
│ │ │ │ ├── PlayerStats.java
│ │ │ │ ├── Team.java
│ │ │ │ └── Wicket.java
│ │ │ ├── enums/
│ │ │ │ ├── ExtraType.java
│ │ │ │ ├── MatchStatus.java
│ │ │ │ ├── PlayerRole.java
│ │ │ │ └── WicketType.java
│ │ │ ├── observer/
│ │ │ │ ├── CommentaryDisplay.java
│ │ │ │ ├── MatchObserver.java
│ │ │ │ ├── ScorecardDisplay.java
│ │ │ │ └── UserNotifier.java
│ │ │ ├── repository/
│ │ │ │ ├── MatchRepository.java
│ │ │ │ └── PlayerRepository.java
│ │ │ ├── state/
│ │ │ │ ├── FinishedState.java
│ │ │ │ ├── InBreakState.java
│ │ │ │ ├── LiveState.java
│ │ │ │ ├── MatchState.java
│ │ │ │ └── ScheduledState.java
│ │ │ └── strategy/
│ │ │ ├── MatchFormatStrategy.java
│ │ │ ├── ODIFormatStrategy.java
│ │ │ └── T20FormatStrategy.java
│ │ ├── digitalwalletservice/
│ │ │ ├── Account.java
│ │ │ ├── BankAccount.java
│ │ │ ├── CreditCard.java
│ │ │ ├── Currency.java
│ │ │ ├── CurrencyConverter.java
│ │ │ ├── DigitalWallet.java
│ │ │ ├── DigitalWalletDemo.java
│ │ │ ├── InsufficientFundsException.java
│ │ │ ├── PaymentMethod.java
│ │ │ └── README.md
│ │ ├── elevatorsystem/
│ │ │ ├── Elevator.java
│ │ │ ├── ElevatorSystem.java
│ │ │ ├── ElevatorSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── enums/
│ │ │ │ ├── Direction.java
│ │ │ │ └── RequestSource.java
│ │ │ ├── models/
│ │ │ │ └── Request.java
│ │ │ ├── observer/
│ │ │ │ ├── ElevatorDisplay.java
│ │ │ │ └── ElevatorObserver.java
│ │ │ ├── state/
│ │ │ │ ├── ElevatorState.java
│ │ │ │ ├── IdleState.java
│ │ │ │ ├── MovingDownState.java
│ │ │ │ └── MovingUpState.java
│ │ │ └── strategy/
│ │ │ ├── ElevatorSelectionStrategy.java
│ │ │ └── NearestElevatorStrategy.java
│ │ ├── filedirectory/
│ │ │ ├── AbstractNode.java
│ │ │ ├── DirectoryNode.java
│ │ │ ├── FileNode.java
│ │ │ ├── FileSystem.java
│ │ │ ├── FileSystemDemo.java
│ │ │ ├── chainofresponsibility/
│ │ │ │ ├── FileSizeFilter.java
│ │ │ │ ├── FilenameFilter.java
│ │ │ │ ├── NodeFilter.java
│ │ │ │ └── NodeFilterChain.java
│ │ │ └── strategy/
│ │ │ ├── FilenameAndSizeSearchStrategy.java
│ │ │ └── NodeSearchStrategy.java
│ │ ├── fooddeliveryservice/
│ │ │ ├── FoodDeliveryService.java
│ │ │ ├── FoodDeliveryServiceDemo.java
│ │ │ ├── README.md
│ │ │ ├── entity/
│ │ │ │ ├── Address.java
│ │ │ │ ├── Customer.java
│ │ │ │ ├── DeliveryAgent.java
│ │ │ │ ├── Menu.java
│ │ │ │ ├── MenuItem.java
│ │ │ │ ├── Restaurant.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ └── OrderObserver.java
│ │ │ ├── order/
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderItem.java
│ │ │ │ └── OrderStatus.java
│ │ │ ├── search/
│ │ │ │ ├── RestaurantSearchStrategy.java
│ │ │ │ ├── SearchByCityStrategy.java
│ │ │ │ ├── SearchByMenuKeywordStrategy.java
│ │ │ │ └── SearchByProximityStrategy.java
│ │ │ └── strategy/
│ │ │ ├── DeliveryAssignmentStrategy.java
│ │ │ └── NearestAvailableAgentStrategy.java
│ │ ├── hotelmanagementsystem/
│ │ │ ├── BookingService.java
│ │ │ ├── HotelManagementDemo.java
│ │ │ ├── HotelManagerFacade.java
│ │ │ ├── PaymentService.java
│ │ │ ├── README.md
│ │ │ ├── RoomService.java
│ │ │ ├── decorator/
│ │ │ │ ├── AmenityDecorator.java
│ │ │ │ ├── Bookable.java
│ │ │ │ ├── BreakfastDecorator.java
│ │ │ │ ├── RoomBooking.java
│ │ │ │ └── SpaDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── BookingStatus.java
│ │ │ │ ├── RoomStyle.java
│ │ │ │ └── RoomType.java
│ │ │ ├── factory/
│ │ │ │ └── RoomFactory.java
│ │ │ ├── model/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── Guest.java
│ │ │ │ └── Room.java
│ │ │ ├── observer/
│ │ │ │ ├── BookingObserver.java
│ │ │ │ ├── EmailNotifier.java
│ │ │ │ └── SmsNotifier.java
│ │ │ ├── payment/
│ │ │ │ ├── CashPayment.java
│ │ │ │ ├── CreditCardPayment.java
│ │ │ │ └── Payment.java
│ │ │ ├── specification/
│ │ │ │ ├── AbstractSpecification.java
│ │ │ │ ├── AndSpecification.java
│ │ │ │ ├── RoomAvailableSpecification.java
│ │ │ │ ├── RoomStyleSpecification.java
│ │ │ │ ├── RoomTypeSpecification.java
│ │ │ │ └── Specification.java
│ │ │ └── state/
│ │ │ ├── AvailableState.java
│ │ │ ├── MaintenanceState.java
│ │ │ ├── OccupiedState.java
│ │ │ └── RoomState.java
│ │ ├── librarymanagementsystem/
│ │ │ ├── LibraryManagementDemo.java
│ │ │ ├── LibraryManagementSystem.java
│ │ │ ├── README.md
│ │ │ ├── TransactionService.java
│ │ │ ├── enums/
│ │ │ │ └── ItemType.java
│ │ │ ├── factory/
│ │ │ │ └── ItemFactory.java
│ │ │ ├── models/
│ │ │ │ ├── Book.java
│ │ │ │ ├── BookCopy.java
│ │ │ │ ├── LibraryItem.java
│ │ │ │ ├── Loan.java
│ │ │ │ ├── Magazine.java
│ │ │ │ └── Member.java
│ │ │ ├── state/
│ │ │ │ ├── AvailableState.java
│ │ │ │ ├── CheckedOutState.java
│ │ │ │ ├── ItemState.java
│ │ │ │ └── OnHoldState.java
│ │ │ └── strategy/
│ │ │ ├── SearchByAuthorStrategy.java
│ │ │ ├── SearchByTitleStrategy.java
│ │ │ └── SearchStrategy.java
│ │ ├── linkedin/
│ │ │ ├── LinkedInDemo.java
│ │ │ ├── LinkedInSystem.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Connection.java
│ │ │ │ ├── Education.java
│ │ │ │ ├── Experience.java
│ │ │ │ ├── Like.java
│ │ │ │ ├── Member.java
│ │ │ │ ├── NewsFeed.java
│ │ │ │ ├── Notification.java
│ │ │ │ ├── Post.java
│ │ │ │ └── Profile.java
│ │ │ ├── enums/
│ │ │ │ ├── ConnectionStatus.java
│ │ │ │ └── NotificationType.java
│ │ │ ├── observer/
│ │ │ │ ├── NotificationObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── ConnectionService.java
│ │ │ │ ├── NewsFeedService.java
│ │ │ │ ├── NotificationService.java
│ │ │ │ └── SearchService.java
│ │ │ └── strategy/
│ │ │ ├── ChronologicalSortStrategy.java
│ │ │ └── FeedSortingStrategy.java
│ │ ├── loggingframework/
│ │ │ ├── AsyncLogProcessor.java
│ │ │ ├── LogManager.java
│ │ │ ├── Logger.java
│ │ │ ├── LoggingFrameworkDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ └── LogMessage.java
│ │ │ ├── enums/
│ │ │ │ └── LogLevel.java
│ │ │ └── strategies/
│ │ │ ├── appender/
│ │ │ │ ├── ConsoleAppender.java
│ │ │ │ ├── FileAppender.java
│ │ │ │ └── LogAppender.java
│ │ │ └── formatter/
│ │ │ ├── LogFormatter.java
│ │ │ └── SimpleTextFormatter.java
│ │ ├── lrucache/
│ │ │ ├── DoublyLinkedList.java
│ │ │ ├── LRUCache.java
│ │ │ ├── LRUCacheDemo.java
│ │ │ ├── Node.java
│ │ │ └── README.md
│ │ ├── movieticketbookingsystem/
│ │ │ ├── BookingManager.java
│ │ │ ├── MovieBookingDemo.java
│ │ │ ├── MovieBookingService.java
│ │ │ ├── README.md
│ │ │ ├── SeatLockManager.java
│ │ │ ├── entities/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── Cinema.java
│ │ │ │ ├── City.java
│ │ │ │ ├── Movie.java
│ │ │ │ ├── Payment.java
│ │ │ │ ├── Screen.java
│ │ │ │ ├── Seat.java
│ │ │ │ ├── Show.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── PaymentStatus.java
│ │ │ │ ├── SeatStatus.java
│ │ │ │ └── SeatType.java
│ │ │ ├── observer/
│ │ │ │ ├── MovieObserver.java
│ │ │ │ ├── MovieSubject.java
│ │ │ │ └── UserObserver.java
│ │ │ └── strategy/
│ │ │ ├── payment/
│ │ │ │ ├── CreditCardPaymentStrategy.java
│ │ │ │ └── PaymentStrategy.java
│ │ │ └── pricing/
│ │ │ ├── PricingStrategy.java
│ │ │ ├── WeekdayPricingStrategy.java
│ │ │ └── WeekendPricingStrategy.java
│ │ ├── musicstreamingservice/
│ │ │ ├── MusicStreamingDemo.java
│ │ │ ├── MusicStreamingSystem.java
│ │ │ ├── README.md
│ │ │ ├── command/
│ │ │ │ ├── Command.java
│ │ │ │ ├── NextTrackCommand.java
│ │ │ │ ├── PauseCommand.java
│ │ │ │ └── PlayCommand.java
│ │ │ ├── entities/
│ │ │ │ ├── Album.java
│ │ │ │ ├── Artist.java
│ │ │ │ ├── Playable.java
│ │ │ │ ├── Player.java
│ │ │ │ ├── Playlist.java
│ │ │ │ ├── Song.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── PlayerStatus.java
│ │ │ │ └── SubscriptionTier.java
│ │ │ ├── observer/
│ │ │ │ ├── ArtistObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── RecommendationService.java
│ │ │ │ └── SearchService.java
│ │ │ ├── state/
│ │ │ │ ├── PausedState.java
│ │ │ │ ├── PlayerState.java
│ │ │ │ ├── PlayingState.java
│ │ │ │ └── StoppedState.java
│ │ │ └── strategies/
│ │ │ ├── playback/
│ │ │ │ ├── FreePlaybackStrategy.java
│ │ │ │ ├── PlaybackStrategy.java
│ │ │ │ └── PremiumPlaybackStrategy.java
│ │ │ └── recommendation/
│ │ │ ├── GenreBasedRecommendationStrategy.java
│ │ │ └── RecommendationStrategy.java
│ │ ├── onlineauctionsystem/
│ │ │ ├── AuctionService.java
│ │ │ ├── AuctionSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Auction.java
│ │ │ │ ├── Bid.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ └── AuctionStatus.java
│ │ │ └── observer/
│ │ │ └── AuctionObserver.java
│ │ ├── onlinelearningplatform/
│ │ │ └── README.md
│ │ ├── onlineshoppingservice/
│ │ │ ├── OnlineShoppingDemo.java
│ │ │ ├── OnlineShoppingSystem.java
│ │ │ ├── README.md
│ │ │ ├── decorator/
│ │ │ │ ├── GiftWrapDecorator.java
│ │ │ │ └── ProductDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── OrderStatus.java
│ │ │ │ └── ProductCategory.java
│ │ │ ├── exceptions/
│ │ │ │ └── OutOfStockException.java
│ │ │ ├── models/
│ │ │ │ ├── Account.java
│ │ │ │ ├── Address.java
│ │ │ │ ├── CartItem.java
│ │ │ │ ├── Customer.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderLineItem.java
│ │ │ │ ├── Product.java
│ │ │ │ └── ShoppingCart.java
│ │ │ ├── observer/
│ │ │ │ ├── OrderObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── InventoryService.java
│ │ │ │ ├── OrderService.java
│ │ │ │ ├── PaymentService.java
│ │ │ │ └── SearchService.java
│ │ │ ├── state/
│ │ │ │ ├── CancelledState.java
│ │ │ │ ├── DeliveredState.java
│ │ │ │ ├── OrderState.java
│ │ │ │ ├── PlacedState.java
│ │ │ │ └── ShippedState.java
│ │ │ └── strategy/
│ │ │ ├── CreditCardPaymentStrategy.java
│ │ │ ├── PaymentStrategy.java
│ │ │ └── UPIPaymentStrategy.java
│ │ ├── onlinestockbrokeragesystem/
│ │ │ ├── BuyOrder.java
│ │ │ ├── README.md
│ │ │ ├── SellOrder.java
│ │ │ ├── StockBrokerageSystem.java
│ │ │ ├── StockBrokerageSystemDemo.java
│ │ │ ├── StockExchange.java
│ │ │ ├── command/
│ │ │ │ ├── BuyStockCommand.java
│ │ │ │ ├── OrderCommand.java
│ │ │ │ └── SellStockCommand.java
│ │ │ ├── entities/
│ │ │ │ ├── Account.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderBuilder.java
│ │ │ │ ├── Stock.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── OrderStatus.java
│ │ │ │ ├── OrderType.java
│ │ │ │ └── TransactionType.java
│ │ │ ├── exceptions/
│ │ │ │ ├── InsufficientFundsException.java
│ │ │ │ └── InsufficientStockException.java
│ │ │ ├── observer/
│ │ │ │ └── StockObserver.java
│ │ │ ├── state/
│ │ │ │ ├── CancelledState.java
│ │ │ │ ├── FilledState.java
│ │ │ │ ├── OpenState.java
│ │ │ │ └── OrderState.java
│ │ │ └── strategy/
│ │ │ ├── ExecutionStrategy.java
│ │ │ ├── LimitOrderStrategy.java
│ │ │ └── MarketOrderStrategy.java
│ │ ├── parkinglot/
│ │ │ ├── ParkingLot.java
│ │ │ ├── ParkingLotDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── ParkingFloor.java
│ │ │ │ ├── ParkingSpot.java
│ │ │ │ └── ParkingTicket.java
│ │ │ ├── strategy/
│ │ │ │ ├── fee/
│ │ │ │ │ ├── FeeStrategy.java
│ │ │ │ │ ├── FlatRateFeeStrategy.java
│ │ │ │ │ └── VehicleBasedFeeStrategy.java
│ │ │ │ └── parking/
│ │ │ │ ├── BestFitStrategy.java
│ │ │ │ ├── FarthestFirstStrategy.java
│ │ │ │ ├── NearestFirstStrategy.java
│ │ │ │ └── ParkingStrategy.java
│ │ │ └── vehicle/
│ │ │ ├── Bike.java
│ │ │ ├── Car.java
│ │ │ ├── Truck.java
│ │ │ ├── Vehicle.java
│ │ │ └── VehicleSize.java
│ │ ├── pubsubsystem/
│ │ │ ├── PubSubDemo.java
│ │ │ ├── PubSubService.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Message.java
│ │ │ │ └── Topic.java
│ │ │ └── subscriber/
│ │ │ ├── AlertSubscriber.java
│ │ │ ├── NewsSubscriber.java
│ │ │ └── Subscriber.java
│ │ ├── restaurantmanagementsystem/
│ │ │ ├── README.md
│ │ │ ├── RestaurantManagementSystem.java
│ │ │ ├── RestaurantManagementSystemDemo.java
│ │ │ ├── RestaurantManagementSystemFacade.java
│ │ │ ├── command/
│ │ │ │ ├── Command.java
│ │ │ │ ├── PrepareOrderCommand.java
│ │ │ │ └── ServeOrderCommand.java
│ │ │ ├── decorator/
│ │ │ │ ├── BaseBill.java
│ │ │ │ ├── Bill.java
│ │ │ │ ├── BillComponent.java
│ │ │ │ ├── BillDecorator.java
│ │ │ │ ├── ServiceChargeDecorator.java
│ │ │ │ └── TaxDecorator.java
│ │ │ ├── enums/
│ │ │ │ └── TableStatus.java
│ │ │ ├── model/
│ │ │ │ ├── Chef.java
│ │ │ │ ├── Menu.java
│ │ │ │ ├── MenuItem.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderItem.java
│ │ │ │ ├── Restaurant.java
│ │ │ │ ├── Staff.java
│ │ │ │ ├── Table.java
│ │ │ │ └── Waiter.java
│ │ │ ├── observer/
│ │ │ │ └── OrderObserver.java
│ │ │ └── state/
│ │ │ ├── OrderItemState.java
│ │ │ ├── OrderedState.java
│ │ │ ├── PreparingState.java
│ │ │ ├── ReadyForPickupState.java
│ │ │ └── ServedState.java
│ │ ├── ridesharingservice/
│ │ │ ├── README.md
│ │ │ ├── RideSharingService.java
│ │ │ ├── RideSharingServiceDemo.java
│ │ │ ├── entities/
│ │ │ │ ├── Driver.java
│ │ │ │ ├── Location.java
│ │ │ │ ├── Trip.java
│ │ │ │ ├── User.java
│ │ │ │ └── Vehicle.java
│ │ │ ├── enums/
│ │ │ │ ├── DriverStatus.java
│ │ │ │ ├── RideType.java
│ │ │ │ └── TripStatus.java
│ │ │ ├── observer/
│ │ │ │ ├── Rider.java
│ │ │ │ └── TripObserver.java
│ │ │ ├── state/
│ │ │ │ ├── AssignedState.java
│ │ │ │ ├── CompletedState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ ├── RequestedState.java
│ │ │ │ └── TripState.java
│ │ │ └── strategy/
│ │ │ ├── matching/
│ │ │ │ ├── DriverMatchingStrategy.java
│ │ │ │ └── NearestDriverMatchingStrategy.java
│ │ │ └── pricing/
│ │ │ ├── FlatRatePricingStrategy.java
│ │ │ ├── PricingStrategy.java
│ │ │ └── VehicleBasedPricingStrategy.java
│ │ ├── snakeandladdergame/
│ │ │ ├── Game.java
│ │ │ ├── README.md
│ │ │ ├── SnakeAndLadderDemo.java
│ │ │ ├── enums/
│ │ │ │ └── GameStatus.java
│ │ │ └── models/
│ │ │ ├── Board.java
│ │ │ ├── BoardEntity.java
│ │ │ ├── Dice.java
│ │ │ ├── Ladder.java
│ │ │ ├── Player.java
│ │ │ └── Snake.java
│ │ ├── socialnetworkingservice/
│ │ │ ├── README.md
│ │ │ ├── SocialNetworkDemo.java
│ │ │ ├── SocialNetworkFacade.java
│ │ │ ├── model/
│ │ │ │ ├── Comment.java
│ │ │ │ ├── CommentableEntity.java
│ │ │ │ ├── Post.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ ├── PostObserver.java
│ │ │ │ └── UserNotifier.java
│ │ │ ├── repository/
│ │ │ │ ├── PostRepository.java
│ │ │ │ └── UserRepository.java
│ │ │ ├── service/
│ │ │ │ ├── NewsFeedService.java
│ │ │ │ ├── PostService.java
│ │ │ │ └── UserService.java
│ │ │ └── strategy/
│ │ │ ├── ChronologicalStrategy.java
│ │ │ └── NewsFeedGenerationStrategy.java
│ │ ├── splitwise/
│ │ │ ├── README.md
│ │ │ ├── SplitwiseDemo.java
│ │ │ ├── SplitwiseService.java
│ │ │ ├── entities/
│ │ │ │ ├── BalanceSheet.java
│ │ │ │ ├── Expense.java
│ │ │ │ ├── Group.java
│ │ │ │ ├── Split.java
│ │ │ │ ├── Transaction.java
│ │ │ │ └── User.java
│ │ │ └── strategy/
│ │ │ ├── EqualSplitStrategy.java
│ │ │ ├── ExactSplitStrategy.java
│ │ │ ├── PercentageSplitStrategy.java
│ │ │ └── SplitStrategy.java
│ │ ├── stackoverflow/
│ │ │ ├── README.md
│ │ │ ├── StackOverflowDemo.java
│ │ │ ├── StackOverflowService.java
│ │ │ ├── entities/
│ │ │ │ ├── Answer.java
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Content.java
│ │ │ │ ├── Event.java
│ │ │ │ ├── Post.java
│ │ │ │ ├── Question.java
│ │ │ │ ├── Tag.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── EventType.java
│ │ │ │ └── VoteType.java
│ │ │ ├── observer/
│ │ │ │ ├── PostObserver.java
│ │ │ │ └── ReputationManager.java
│ │ │ └── strategy/
│ │ │ ├── KeywordSearchStrategy.java
│ │ │ ├── SearchStrategy.java
│ │ │ ├── TagSearchStrategy.java
│ │ │ └── UserSearchStrategy.java
│ │ ├── taskmanagementsystem/
│ │ │ ├── README.md
│ │ │ ├── TaskManagementSystem.java
│ │ │ ├── TaskManagementSystemDemo.java
│ │ │ ├── enums/
│ │ │ │ ├── TaskPriority.java
│ │ │ │ └── TaskStatus.java
│ │ │ ├── models/
│ │ │ │ ├── ActivityLog.java
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Tag.java
│ │ │ │ ├── Task.java
│ │ │ │ ├── TaskList.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ ├── ActivityLogger.java
│ │ │ │ └── TaskObserver.java
│ │ │ ├── state/
│ │ │ │ ├── DoneState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ ├── TaskState.java
│ │ │ │ └── TodoState.java
│ │ │ └── strategy/
│ │ │ ├── SortByDueDate.java
│ │ │ ├── SortByPriority.java
│ │ │ └── TaskSortStrategy.java
│ │ ├── tictactoe/
│ │ │ ├── Game.java
│ │ │ ├── README.md
│ │ │ ├── TicTacToeDemo.java
│ │ │ ├── TicTacToeSystem.java
│ │ │ ├── enums/
│ │ │ │ ├── GameStatus.java
│ │ │ │ └── Symbol.java
│ │ │ ├── exceptions/
│ │ │ │ └── InvalidMoveException.java
│ │ │ ├── models/
│ │ │ │ ├── Board.java
│ │ │ │ ├── Cell.java
│ │ │ │ └── Player.java
│ │ │ ├── observer/
│ │ │ │ ├── GameObserver.java
│ │ │ │ ├── GameSubject.java
│ │ │ │ └── Scoreboard.java
│ │ │ ├── state/
│ │ │ │ ├── DrawState.java
│ │ │ │ ├── GameState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ └── WinnerState.java
│ │ │ └── strategy/
│ │ │ ├── ColumnWinningStrategy.java
│ │ │ ├── DiagonalWinningStrategy.java
│ │ │ ├── RowWinningStrategy.java
│ │ │ └── WinningStrategy.java
│ │ ├── trafficsignalcontrolsystem/
│ │ │ ├── IntersectionController.java
│ │ │ ├── README.md
│ │ │ ├── TrafficControlSystem.java
│ │ │ ├── TrafficLight.java
│ │ │ ├── TrafficSystemDemo.java
│ │ │ ├── enums/
│ │ │ │ ├── Direction.java
│ │ │ │ └── LightColor.java
│ │ │ ├── observer/
│ │ │ │ ├── CentralMonitor.java
│ │ │ │ └── TrafficObserver.java
│ │ │ └── states/
│ │ │ ├── intersection/
│ │ │ │ ├── EastWestGreenState.java
│ │ │ │ ├── IntersectionState.java
│ │ │ │ └── NorthSouthGreenState.java
│ │ │ └── light/
│ │ │ ├── GreenState.java
│ │ │ ├── RedState.java
│ │ │ ├── SignalState.java
│ │ │ └── YellowState.java
│ │ ├── vendingmachine/
│ │ │ ├── README.md
│ │ │ ├── VendingMachine.java
│ │ │ ├── VendingMachineDemo.java
│ │ │ ├── entity/
│ │ │ │ ├── Inventory.java
│ │ │ │ └── Item.java
│ │ │ ├── enums/
│ │ │ │ └── Coin.java
│ │ │ └── state/
│ │ │ ├── DispensingState.java
│ │ │ ├── HasMoneyState.java
│ │ │ ├── IdleState.java
│ │ │ ├── ItemSelectedState.java
│ │ │ └── VendingMachineState.java
│ │ └── votingsystem/
│ │ ├── Candidate.java
│ │ ├── README.md
│ │ ├── VoteRecord.java
│ │ ├── Voter.java
│ │ ├── VotingSystem.java
│ │ └── VotingSystemDemo.java
│ └── test/
│ └── coffeevendingmachine/
│ └── CoffeeVendingMachineTest.java
├── python/
│ ├── .gitignore
│ ├── airlinemanagementsystem/
│ │ └── README.md
│ ├── atm/
│ │ └── README.md
│ ├── carrentalsystem/
│ │ └── README.md
│ ├── chessgame/
│ │ └── README.md
│ ├── coffeevendingmachine/
│ │ └── README.md
│ ├── concertticketbookingsystem/
│ │ └── README.md
│ ├── courseregistrationsystem/
│ │ └── README.md
│ ├── cricinfo/
│ │ └── README.md
│ ├── digitalwalletservice/
│ │ └── README.md
│ ├── elevatorsystem/
│ │ └── README.md
│ ├── fooddeliveryservice/
│ │ └── README.md
│ ├── hotelmanagementsystem/
│ │ └── README.md
│ ├── librarymanagementsystem/
│ │ └── README.md
│ ├── linkedin/
│ │ └── README.md
│ ├── loggingframework/
│ │ └── README.md
│ ├── lrucache/
│ │ └── README.md
│ ├── movieticketbookingsystem/
│ │ └── README.md
│ ├── musicstreamingservice/
│ │ └── README.md
│ ├── onlineauctionsystem/
│ │ └── README.md
│ ├── onlinestockbrokeragesystem/
│ │ └── README.md
│ ├── parkinglot/
│ │ └── README.md
│ ├── pubsubsystem/
│ │ └── README.md
│ ├── restaurantmanagementsystem/
│ │ └── README.md
│ ├── ridesharingservice/
│ │ └── README.md
│ ├── snakeandladdergame/
│ │ └── README.md
│ ├── socialnetworkingservice/
│ │ └── README.md
│ ├── splitwise/
│ │ └── README.md
│ ├── stackoverflow/
│ │ └── README.md
│ ├── taskmanagementsystem/
│ │ └── README.md
│ ├── tictactoe/
│ │ └── README.md
│ ├── trafficsignalsystem/
│ │ └── README.md
│ ├── vendingmachine/
│ │ └── README.md
│ └── votingsystem/
│ └── README.md
└── typescript/
├── .gitignore
├── README.md
├── package.json
├── src/
│ ├── CoffeeVendingMachine/
│ │ ├── CoffeeRecipe.ts
│ │ ├── CoffeeVendingMachine.ts
│ │ ├── CoffeeVendingMachineDemo.ts
│ │ ├── Dispenser.ts
│ │ ├── IngredientStore.ts
│ │ ├── Payment.ts
│ │ ├── PaymentProcessor.ts
│ │ └── README.md
│ ├── LoggingFramework/
│ │ ├── Appender/
│ │ │ ├── ConsoleLogAppender.ts
│ │ │ ├── FileLogAppender.ts
│ │ │ └── LogAppender.ts
│ │ ├── LogFormatter/
│ │ │ ├── LogFormatter.ts
│ │ │ └── SimpleLogFormatter.ts
│ │ ├── LogLevel.ts
│ │ ├── LogManager.ts
│ │ ├── LogMessage.ts
│ │ ├── Logger.ts
│ │ ├── LoggingFrameworkDemo.ts
│ │ └── README.md
│ ├── ParkingLot/
│ │ ├── Floor.ts
│ │ ├── Main.ts
│ │ ├── ParkingLot.ts
│ │ ├── Spot.ts
│ │ ├── Vehicle.ts
│ │ ├── readme.md
│ │ └── types.ts
│ ├── StackOverflow/
│ │ ├── Answer.ts
│ │ ├── Comment.ts
│ │ ├── Commentable.ts
│ │ ├── Question.ts
│ │ ├── README.md
│ │ ├── ReputationType.ts
│ │ ├── StackOverflow.ts
│ │ ├── StackOverflowDemo.ts
│ │ ├── Tag.ts
│ │ ├── User.ts
│ │ ├── Votable.ts
│ │ ├── Vote.ts
│ │ └── VoteTypeEnum.ts
│ ├── TaskManagement/
│ │ ├── ActivityLog.ts
│ │ ├── Comment.ts
│ │ ├── README.md
│ │ ├── SortingStrategy/
│ │ │ ├── SortByDueDate.ts
│ │ │ ├── SortByPriority.ts
│ │ │ └── TaskSortingStrategy.ts
│ │ ├── Task.ts
│ │ ├── TaskList.ts
│ │ ├── TaskManagementSystem.ts
│ │ ├── TaskManagementSystemDemo.ts
│ │ ├── TaskPriorityEnum.ts
│ │ ├── TaskStatusEnum.ts
│ │ └── User.ts
│ ├── TrafficSignalSystem/
│ │ ├── Direction.ts
│ │ ├── Intersection.ts
│ │ ├── README.md
│ │ ├── SignalState/
│ │ │ ├── GreenState.ts
│ │ │ ├── RedState.ts
│ │ │ ├── SignalState.ts
│ │ │ └── YellowState.ts
│ │ ├── TrafficLight.ts
│ │ ├── TrafficSignalController.ts
│ │ └── TrafficSignalSystemDemo.ts
│ ├── VendingMachine/
│ │ ├── Coin.ts
│ │ ├── Inventory.ts
│ │ ├── Item.ts
│ │ ├── README.md
│ │ ├── VendingMachine.ts
│ │ ├── VendingMachineDemo.ts
│ │ └── VendingMachineState/
│ │ ├── DispensingState.ts
│ │ ├── HasMoneyState.ts
│ │ ├── IdleState.ts
│ │ ├── ItemSelectedState.ts
│ │ └── VendingMachineState.ts
│ └── lldrunner.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.idea/
.vscode/
solutions/java/.idea/
solutions/java/out/
solutions/c++/.idea/
solutions/c#/bin/
solutions/c#/obj/
*.py
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: README.md
================================================
<p align="center">
<img src="images/lld-repo-logo.png" width="350" height="200">
</p>
<p align="center">
<a href="https://blog.algomaster.io/">Join Free Newsletter</a>
</p>
This repository contains resources to learn Low Level Design (LLD) / Object Oriented Design (OOD) and prepare for interviews. It covers OOP fundamentals, design patterns, UML, concurrency and commonly asked interview questions.
👉 For a better and more comprehensive experience, checkout the [LLD page at AlgoMaster.io](https://algomaster.io/learn/lld)
## 🧱 OOP Fundamentals
- [Classes and Objects](https://algomaster.io/learn/lld/classes-and-objects)
- [Enums](https://algomaster.io/learn/lld/enums)
- [Interfaces](https://algomaster.io/learn/lld/interfaces)
- [Encapsulation](https://algomaster.io/learn/lld/encapsulation)
- [Abstraction](https://algomaster.io/learn/lld/abstraction)
- [Inheritance](https://algomaster.io/learn/lld/inheritance)
- [Polymorphism](https://algomaster.io/learn/lld/polymorphism)
## 🔗 Class Relationships
- [Association](https://algomaster.io/learn/lld/association)
- [Aggregation](https://algomaster.io/learn/lld/aggregation)
- [Composition](https://algomaster.io/learn/lld/composition)
- [Dependency](https://algomaster.io/learn/lld/dependency)
## 🧭 Design Principles
- [DRY Principle](https://algomaster.io/learn/lld/dry)
- [YAGNI Principle](https://algomaster.io/learn/lld/yagni)
- [KISS Principle](https://algomaster.io/learn/lld/kiss)
- [SOLID Principles with Pictures](https://medium.com/backticks-tildes/the-s-o-l-i-d-principles-in-pictures-b34ce2f1e898)
- [SOLID Principles with Code](https://blog.algomaster.io/p/solid-principles-explained-with-code)
## 🧩 Design Patterns
| **Creational Patterns** | **Structural Patterns** | **Behavioral Patterns** |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [Singleton](https://algomaster.io/learn/lld/singleton) | [Adapter](https://algomaster.io/learn/lld/adapter) | [Iterator](https://algomaster.io/learn/lld/iterator) |
| [Factory Method](https://algomaster.io/learn/lld/factory-method) | [Bridge](https://algomaster.io/learn/lld/bridge) | [Observer](https://algomaster.io/learn/lld/observer) |
| [Abstract Factory](https://algomaster.io/learn/lld/abstract-factory) | [Composite](https://algomaster.io/learn/lld/composite) | [Strategy](https://algomaster.io/learn/lld/strategy) |
| [Builder](https://algomaster.io/learn/lld/builder) | [Decorator](https://algomaster.io/learn/lld/decorator) | [Command](https://algomaster.io/learn/lld/command) |
| [Prototype](https://algomaster.io/learn/lld/prototype) | [Facade](https://algomaster.io/learn/lld/facade) | [State](https://algomaster.io/learn/lld/state) |
| | [Flyweight](https://algomaster.io/learn/lld/flyweight) | [Template Method](https://algomaster.io/learn/lld/template-method) |
| | [Proxy](https://algomaster.io/learn/lld/proxy) | [Visitor](https://algomaster.io/learn/lld/visitor) |
| | | [Mediator](https://algomaster.io/learn/lld/mediator) |
| | | [Memento](https://algomaster.io/learn/lld/memento) |
| | | [Chain of Responsibility](https://algomaster.io/learn/lld/chain-of-responsibility) |
## 🗂️ UML
- [Class Diagram](https://algomaster.io/learn/lld/class-diagram)
- [Use Case Diagram](https://algomaster.io/learn/lld/use-case-diagram)
- [Sequence Diagram](https://algomaster.io/learn/lld/sequence-diagram)
- [Activity Diagram](https://algomaster.io/learn/lld/activity-diagram)
- [State Machine Diagram](https://algomaster.io/learn/lld/state-machine-diagram)
## ⏱️ Concurrency and Multi-threading Concepts
### Concurrency 101
- [Introduction to Concurrency](https://algomaster.io/learn/concurrency-interview/introduction-to-concurrency)
- [Concurrency vs Parallelism](https://algomaster.io/learn/concurrency-interview/concurrency-vs-parallelism)
- [Processes vs Threads](https://algomaster.io/learn/concurrency-interview/processes-vs-threads)
- [Thread Lifecycle and States](https://algomaster.io/learn/concurrency-interview/thread-lifecycle-and-states)
- [Race Conditions and Critical Sections](https://algomaster.io/learn/concurrency-interview/race-conditions-and-critical-sections)
### Synchronization Primitives
- [Mutex (Mutual Exclusion)](https://algomaster.io/learn/concurrency-interview/mutex)
- [Semaphores](https://algomaster.io/learn/concurrency-interview/semaphores)
- [Condition Variables](https://algomaster.io/learn/concurrency-interview/condition-variables)
- [Coarse-grained vs Fine-grained Locking](https://algomaster.io/learn/concurrency-interview/coarse-vs-fine-grained-locking)
- [Reentrant Locks](https://algomaster.io/learn/concurrency-interview/reentrant-locks)
- [Try-Lock and Timed Locking](https://algomaster.io/learn/concurrency-interview/try-lock-and-timed-locking)
- [Compare-and-Swap (CAS)](https://algomaster.io/learn/concurrency-interview/compare-and-swap)
### Concurrency Challenges
- [Deadlock](https://algomaster.io/learn/concurrency-interview/deadlock)
- [Livelock](https://algomaster.io/learn/concurrency-interview/livelock)
### Concurrency Patterns
- [Signaling Pattern](https://algomaster.io/learn/concurrency-interview/signaling-pattern)
- [Thread Pool Pattern](https://algomaster.io/learn/concurrency-interview/thread-pool-pattern)
- [Producer-Consumer Pattern](https://algomaster.io/learn/concurrency-interview/producer-consumer-pattern)
- [Reader-Writer Pattern](https://algomaster.io/learn/concurrency-interview/reader-writer-pattern)
## ✅ [How to Answer a LLD Interview Problem](https://blog.algomaster.io/p/how-to-answer-a-lld-interview-problem)
<img src="images/interview-template.png" width="350" height="250">
## 💻 Low Level Design Interview Problems
### Easy Problems
- [Design Parking Lot](problems/parking-lot.md)
- [Design Stack Overflow](problems/stack-overflow.md)
- [Design a Vending Machine](problems/vending-machine.md)
- [Design Logging Framework](problems/logging-framework.md)
- [Design Traffic Signal Control System](problems/traffic-signal.md)
- [Design Coffee Vending Machine](problems/coffee-vending-machine.md)
- [Design a Task Management System](problems/task-management-system.md)
### Medium Problems
- [Design ATM](problems/atm.md)
- [Design LinkedIn](problems/linkedin.md)
- [Design LRU Cache](problems/lru-cache.md)
- [Design Tic Tac Toe Game](problems/tic-tac-toe.md)
- [Design Pub Sub System](problems/pub-sub-system.md)
- [Design an Elevator System](problems/elevator-system.md)
- [Design Car Rental System](problems/car-rental-system.md)
- [Design an Online Auction System](problems/online-auction-system.md)
- [Design Hotel Management System](problems/hotel-management-system.md)
- [Design a Digital Wallet Service](problems/digital-wallet-service.md)
- [Design Airline Management System](problems/airline-management-system.md)
- [Design a Library Management System](problems/library-management-system.md)
- [Design a Social Network like Facebook](problems/social-networking-service.md)
- [Design Restaurant Management System](problems/restaurant-management-system.md)
- [Design a Concert Ticket Booking System](problems/concert-ticket-booking-system.md)
### Hard Problems
- [Design CricInfo](problems/cricinfo.md)
- [Design Splitwise](problems/splitwise.md)
- [Design Chess Game](problems/chess-game.md)
- [Design a Snake and Ladder game](problems/snake-and-ladder.md)
- [Design Ride-Sharing Service like Uber](problems/ride-sharing-service.md)
- [Design Course Registration System](problems/course-registration-system.md)
- [Design Movie Ticket Booking System](problems/movie-ticket-booking-system.md)
- [Design Online Shopping System like Amazon](problems/online-shopping-service.md)
- [Design Online Stock Brokerage System](problems/online-stock-brokerage-system.md)
- [Design Music Streaming Service like Spotify](problems/music-streaming-service.md)
- [Design Online Food Delivery Service like Swiggy](problems/food-delivery-service.md)
## ⏱️ Concurrency and Multi-threading Problems
- [Print FooBar Alternately](https://algomaster.io/learn/concurrency-interview/print-foobar-alternately)
- [Print Zero Even Odd](https://algomaster.io/learn/concurrency-interview/print-zero-even-odd)
- [Fizz Buzz Multithreaded](https://algomaster.io/learn/concurrency-interview/fizz-buzz-multithreaded)
- [Building H2O Molecule](https://algomaster.io/learn/concurrency-interview/building-h2o)
- [Design Thread-Safe Cache with TTL](https://algomaster.io/learn/concurrency-interview/design-thread-safe-cache-with-ttl)
- [Design Concurrent HashMap](https://algomaster.io/learn/concurrency-interview/design-concurrent-hashmap)
- [Design Thread-Safe Blocking Queue](https://algomaster.io/learn/concurrency-interview/design-thread-safe-blocking-queue)
- [Design Concurrent Bloom Filter](https://algomaster.io/learn/concurrency-interview/design-concurrent-bloom-filter)
- [Multi-threaded Merge Sort](https://algomaster.io/learn/concurrency-interview/multi-threaded-merge-sort)
## 📇 Courses
- [Master LLD Interviews - AlgoMaster.io](https://algomaster.io/learn/lld/course-introduction)
- [Master Concurrency Interviews - AlgoMaster.io](https://algomaster.io/learn/concurrency-interview)
## 📚 Books
- [Head First Design Patterns](https://www.amazon.in/dp/9385889753)
- [Clean Code](https://www.amazon.in/dp/B001GSTOAM)
- [Refactoring: Improving the Design of Existing Code](https://www.amazon.in/dp/0134757599)
## 📩 Newsletter
- [AlgoMaster Newsletter](https://blog.algomaster.io/)
## Additional resources
- [Coursera - Object-Oriented Design](https://www.coursera.org/learn/object-oriented-design)
- [Coursera - Design Patterns](https://www.coursera.org/learn/design-patterns)
- [Github - Awesome Design Patterns](https://github.com/DovAmir/awesome-design-patterns)
## 🤝 Contributing
Contributions are welcome! If you'd like to add a new problem, improve existing content, or fix errors:
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature-name`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin feature/your-feature-name`
5. Submit a pull request
Please make sure to update Readme files and documentation as appropriate.
---
<p align="center">
<i>If you find this resource helpful, please give it a star and share it with others!</i>
</p>
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Chain of Responsibilites/main.js
================================================
const {
InternetConnectionTeam,
InternetSupportTeam,
PhoneConnectionTeam,
PhoneSupportTeam,
} = require("./supportRequest");
const phoneSupport = new PhoneSupportTeam(null);
const phoneConnection = new PhoneConnectionTeam(phoneSupport);
const internetSupport = new InternetSupportTeam(phoneConnection);
const internetConnection = new InternetConnectionTeam(internetSupport);
console.log("Problem 1 - internet connection");
internetConnection.handleRequest("internet", "newConnection");
console.log("Problem 2 - phone connection");
internetConnection.handleRequest("phone", "problem");
console.log("Problem 3 - phone support");
internetConnection.handleRequest("phone", "problem");
console.log("Problem 4 - Invalid support");
internetConnection.handleRequest("Laptop", "problem");
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Chain of Responsibilites/supportRequest.js
================================================
// Creating a chain for attaining support team
class supportHandler {
constructor(nextHandler) {
this.nextHandler = nextHandler;
}
// Method to handle the request
handleRequest(request, type) {
if (this.nextHandler) {
console.log("Passing to the next executive team to resolve your issue");
this.nextHandler.handleRequest(request, type);
} else {
console.log("No further handlers available to process the request.");
}
}
}
// First level internet support team for connection
class InternetConnectionTeam extends supportHandler {
handleRequest(request, type) {
if (request === "internet" && type === "newConnection") {
console.log("Your newConnection request is taken. Thank you! 🙂");
} else if (request === "internet" && type === "problem") {
console.log(
"Seems you have an issue; we will redirect to the support team"
);
super.handleRequest(request, type); // Transferring to the next team
} else {
console.log(
"Unknown request type in InternetConnectionTeam. Passing to next team."
);
super.handleRequest(request, type); // Transfer to the next team
}
}
}
// Second level internet support team for problem
class InternetSupportTeam extends supportHandler {
handleRequest(request, type) {
if (request === "internet" && type === "problem") {
console.log("Your internet request is taken. Thank you! 🙂");
} else {
console.log(
"Unknown request type in InternetSupportTeam. Passing to next team."
);
super.handleRequest(request, type); // Transferring to the next team
}
}
}
// Third level connection
class PhoneConnectionTeam extends supportHandler {
handleRequest(request, type) {
if (request === "phone" && type === "newConnection") {
console.log("Your newConnection request is taken. Thank you! 🙂");
} else if (request === "phone" && type === "problem") {
console.log(
"Seems you have an issue; we will redirect to the support team"
);
super.handleRequest(request, type); // Transferring to the next team
} else {
console.log(
"Unknown request type in PhoneConnectionTeam. Passing to next team."
);
super.handleRequest(request, type); // Transferring to the next team
}
}
}
// Last level phone support team for problem
class PhoneSupportTeam extends supportHandler {
handleRequest(request, type) {
if (request === "phone" && type === "problem") {
console.log("Your phone request is taken. Thank you! 🙂");
} else {
console.log(
"Unknown request type in PhoneSupportTeam. This is the last support level."
);
}
}
}
// Main module export
module.exports = {
InternetConnectionTeam,
InternetSupportTeam,
PhoneConnectionTeam,
PhoneSupportTeam,
};
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/command.js
================================================
// Abstract Command
class Command {
execute() {}
}
// Concrete Command
class LightOnCommand extends Command {
constructor(light) {
super();
this.light = light;
}
execute() {
this.light.turnOn();
}
}
class LightOffCommand extends Command {
constructor(light) {
super();
this.light = light;
}
execute() {
this.light.turnOff();
}
}
// Concrete Command to turn on the fan
class FanOnCommand extends Command {
constructor(fan) {
super();
this.fan = fan;
}
execute() {
this.fan.turnOn();
}
}
// Concrete Command to turn off the fan
class FanOffCommand extends Command {
constructor(fan) {
super();
this.fan = fan;
}
execute() {
this.fan.turnOff();
}
}
module.exports = {
LightOnCommand,
LightOffCommand,
FanOnCommand,
FanOffCommand,
};
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/invoker.js
================================================
// Invoker class
class RemoteControl {
setCommand(command) {
this.command = command;
}
pressButton() {
this.command.execute();
}
}
module.exports = {RemoteControl}
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/main.js
================================================
// Client code
const {
LightOnCommand,
LightOffCommand,
FanOnCommand,
FanOffCommand,
} = require("./command");
const{Light, Fan} = require('./receiver')
const {RemoteControl} = require ('./invoker')
const light = new Light();
const fan = new Fan();
const lightOn = new LightOnCommand(light);
const lightOff = new LightOffCommand(light);
const fanOn = new FanOnCommand(fan);
const fanOff = new FanOffCommand(fan);
const remote = new RemoteControl();
// Turning on the light
remote.setCommand(lightOn);
remote.pressButton(); // Output: "The light is on."
// Turning off the light
remote.setCommand(lightOff);
remote.pressButton(); // Output: "The light is off."
// Turning on the fan
remote.setCommand(fanOn);
remote.pressButton(); // Output: "The fan is on."
// Turning off the fan
remote.setCommand(fanOff);
remote.pressButton(); // Output: "The fan is off."
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/receiver.js
================================================
// Receiver for Light
class Light {
turnOn() {
console.log("The light is on.");
}
turnOff() {
console.log("The light is off.");
}
}
// Receiver for Fan
class Fan {
turnOn() {
console.log("The fan is on.");
}
turnOff() {
console.log("The fan is off.");
}
}
module.exports = { Light, Fan };
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/aggregate.js
================================================
const { LibraryIterator } = require("./iterator");
const Book = require("./book");
class Aggregate {
createIterator() {
throw new Error("Method 'createIterator()' must be implemented.");
}
}
class ConcreteAggregate extends Aggregate {
constructor() {
super();
this.books = [];
}
addBook(book) {
this.books.push(book);
}
createIterator() {
return new LibraryIterator(this.books);
}
}
module.exports = ConcreteAggregate;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/book.js
================================================
class Book {
constructor(title, author) {
this.title = title;
this.author = author;
}
getDetails() {
return `${this.title} by ${this.author}`;
}
}
module.exports = Book;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/iterator.js
================================================
class Iterator {
next() {
throw new Error("Method 'next()' must be implemented.");
}
hasNext() {
throw new Error("Method 'hasNext()' must be implemented.");
}
}
// Concrete Iterator
class LibraryIterator extends Iterator {
constructor(collection) {
super();
this.collection = collection;
this.index = 0;
}
hasNext() {
return this.index < this.collection.length;
}
next() {
console.log("Current index: " + this.index);
return this.collection[this.index++];
}
}
module.exports = { Iterator, LibraryIterator };
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/main.js
================================================
const ConcreteAggregate = require("./aggregate");
const Book = require("./book");
const library = new ConcreteAggregate();
// Adding books to the library
library.addBook(new Book("To Kill a Mockingbird", "Harper Lee"));
library.addBook(new Book("1984", "George Orwell"));
library.addBook(new Book("The Great Gatsby", "F. Scott Fitzgerald"));
library.addBook(new Book("Moby Dick", "Herman Melville"));
// Creating an iterator for the library
const iterator = library.createIterator();
// Iterating through the collection of books
while (iterator.hasNext()) {
const book = iterator.next();
console.log(book.getDetails());
}
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/main.js
================================================
// Client code to handle users registration and messages communication
const User = require("./user");
const ChatRoom = require("./mediator");
// Object for chatRoom (mediator)
const chatRoom = new ChatRoom();
// Objects for users
const user1 = new User("User1", chatRoom);
const user2 = new User("User2", chatRoom);
const user3 = new User("User3", chatRoom);
// Register users with chatRoom
chatRoom.register(user1);
chatRoom.register(user2);
chatRoom.register(user3);
// Send message
user1.send("Hello everyone!");
user2.send("Hi User1!");
user3.send("Hi User2!");
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/mediator.js
================================================
// Abstract Mediator
class Mediator {
register(user) {
throw new Error("Method 'register()' must be implemented");
}
send(message, user) {
throw new Error("Method 'send()' must be implemented");
}
}
// Concrete Mediator
class ChatRoom extends Mediator {
constructor() {
super();
this.users = [];
}
register(user) {
this.users.push(user);
}
send(message, from) {
this.users.forEach((user) => {
if (user !== from) {
// send senderMessage only to other users
user.receive(message, from);
}
});
}
}
module.exports = ChatRoom;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/user.js
================================================
class User {
constructor(name, mediator) {
this.name = name;
this.mediator = mediator;
}
send(message) {
console.log(`${this.name} sent: ${message}`);
this.mediator.send(message, this);
}
receive(message) {
console.log(`${this.name} receives message: ${message}`);
}
}
module.exports = User;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/canvas.js
================================================
// Import CanvasMemento from memento.js
const CanvasMemento = require("./memento"); // <-- Add this line
class DrawingCanvas {
constructor() {
this.shapes = []; // The current shapes drawn on the canvas
}
// Method to draw a new shape
addShape(shape) {
this.shapes.push(shape);
}
// Method to remove the last added shape (simulating undo)
removeLastShape() {
this.shapes.pop();
}
// Create a memento (save the current state)
save() {
return new CanvasMemento([...this.shapes]); // Copy the current shapes to a new Memento
}
// Restore the canvas state from a memento
restore(memento) {
this.shapes = memento.getState(); // Replace current shapes with the saved shapes
}
// Print all shapes (to simulate displaying them on the canvas)
show() {
console.log("Current shapes on canvas:", this.shapes);
}
}
module.exports = DrawingCanvas;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/careTaker.js
================================================
// CareTaker -> Manages mementos
class History {
constructor() {
this.mementos = []; // List of saved mementos
}
// Save a memento
saveMemento(memento) {
this.mementos.push(memento);
}
// Get a memento
getMemento(index) {
return this.mementos[index];
}
// Remove the last memento
removeMemento() {
return this.mementos.pop();
}
getLatestMemento() {
return this.mementos.length > 0
? this.mementos[this.mementos.length - 1]
: null;
}
removeLastMemento() {
if (this.mementos.length > 0) {
this.mementos.pop();
}
}
}
module.exports = History;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/main.js
================================================
const DrawingCanvas = require('./canvas');
const CanvasMemento = require('./memento');
const History = require('./careTaker');
// Create a new drawing canvas (Originator)
const canvas = new DrawingCanvas();
// Create a new History (Caretaker)
const history = new History();
// Draw some shapes on the canvas
canvas.addShape("Circle");
canvas.addShape("Square");
// Show current state of canvas
console.log("Initial Drawing:");
canvas.show(); // Output: Circle, Square
// Save the current state of the canvas
history.saveMemento(canvas.save()); // Save: Circle, Square
// Draw more shapes
canvas.addShape("Triangle");
canvas.addShape("Hexagon");
// Show current state of canvas
console.log("\nAfter Drawing More Shapes:");
canvas.show(); // Output: Circle, Square, Triangle, Hexagon
// Save the current state again
history.saveMemento(canvas.save()); // Save: Circle, Square, Triangle, Hexagon
// Draw another shape
canvas.addShape("Pentagon");
// Show current state of canvas
console.log("\nAfter Adding Pentagon:");
canvas.show(); // Output: Circle, Square, Triangle, Hexagon, Pentagon
// Undo the last action by restoring the previous memento
canvas.restore(history.getLatestMemento());
history.removeLastMemento(); // Remove the latest snapshot
console.log("\nAfter Undo (Restoring Previous State):");
canvas.show(); // Output: Circle, Square, Triangle, Hexagon
// Undo another action
canvas.restore(history.getLatestMemento());
history.removeLastMemento(); // Remove the latest snapshot
console.log("\nAfter Another Undo:");
canvas.show(); // Output: Circle, Square
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/memento.js
================================================
// Memento -> Stores the snapshot of canvas state
class CanvasMemento {
constructor(state) {
this.state = state; // The saved shapes at this point
}
// Returns the saved state
getState() {
return this.state;
}
}
module.exports = CanvasMemento;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/careTaker.js
================================================
// careTaker.js
class CareTaker {
constructor() {
this.mementos = [];
}
saveMemento(memento) {
this.mementos.push(memento);
}
getMemento(index) {
return this.mementos[index];
}
}
module.exports = CareTaker;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/main.js
================================================
const TextEditor = require("./orginator");
const Caretaker = require("./careTaker");
// Create a TextEditor instance
const textEditor = new TextEditor();
const caretaker = new Caretaker();
// Write some content
textEditor.write("Hello, ");
caretaker.saveMemento(textEditor.save()); // Save the current state
textEditor.write("world!");
console.log(textEditor.getContent()); // Output: "Hello, world!"
caretaker.saveMemento(textEditor.save()); // Save the current state again
textEditor.write(" How are you?");
console.log(textEditor.getContent()); // Output: "Hello, world! How are you?"
// Restore to the previous state
textEditor.restore(caretaker.getMemento(1));
console.log(textEditor.getContent()); // Output: "Hello, world!"
// Restore to the initial state
textEditor.restore(caretaker.getMemento(0));
console.log(textEditor.getContent()); // Output: "Hello, "
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/memento.js
================================================
// Memento
class Memento {
constructor(state) {
this.state = state;
}
getState() {
return this.state;
}
}
module.exports = Memento;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/orginator.js
================================================
// Orginator file
const Memento = require("./memento");
class TextEditor {
constructor() {
this.content = "";
}
write(content) {
this.content += content;
}
getContent() {
return this.content;
}
save() {
return new Memento(this.content);
}
restore(memento) {
this.content = memento.getState();
}
}
module.exports = TextEditor;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/main.js
================================================
const { WebUI, MobileUI } = require("./observer");
const WeatherStation = require("./publisher");
// Create a WeatherStation instance
const weatherStation = new WeatherStation();
// Create observers
const webUI = new WebUI();
const mobileUI = new MobileUI();
// Register observers with the weather station
weatherStation.addObserver(webUI);
weatherStation.addObserver(mobileUI);
// Change the temperature
weatherStation.setTemperature(25); // Notify the data all observers
weatherStation.setTemperature(30); // Notify the updated data all observers
// Adding another observer
const webUI2 = new WebUI();
weatherStation.addObserver(webUI2);
weatherStation.setTemperature(35);
// Removing an observer
weatherStation.removeObserver(webUI);
weatherStation.setTemperature(40);
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/observer.js
================================================
class Observer {
update(temperature) {
throw new Error("Method 'update()' must be implemented");
}
}
class WebUI extends Observer {
update(temperature) {
console.log(`Temperature showing in web UI: ${temperature}`);
}
}
class MobileUI extends Observer {
update(temperature) {
console.log(`Temperature showing in mobile UI: ${temperature}`);
}
}
module.exports = {
WebUI,
MobileUI,
};
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/publisher.js
================================================
class WeatherStation {
constructor() {
this.observers = [];
this.temperature = 0;
}
//Method to add Subscribers to the list
addObserver(observer) {
this.observers.push(observer);
}
// Remove Subscribers from the list
removeObserver(observer) {
this.observers = this.observers.filter((obs) => obs !== observer);
}
// Notify all subscribers
notifyObservers() {
this.observers.forEach((observer) => observer.update(this.temperature));
}
//Method to set the temperature
setTemperature(temperature) {
this.temperature = temperature;
this.notifyObservers();
}
}
module.exports = WeatherStation;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/State Design Pattern/context.js
================================================
const {Idle} = require("./state");
// Context Class
class Phone {
constructor() {
this.state = new Idle(); // Inital state
}
setState(state) {
this.state = state;
}
alert() {
this.state.alert();
}
answer() {
this.state.answer(this);
}
hangup() {
this.state.hangup(this);
}
}
module.exports = Phone;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/State Design Pattern/main.js
================================================
const Phone = require("./context");
const {Ringing} = require("./state");
const phone = new Phone();
phone.alert(); // Output: Phone is idle.
phone.answer(); // Output: No incoming call to answer.
phone.setState(new Ringing());
phone.alert(); // Output: Phone is ringing...
phone.answer(); // Output: Answering the call.
phone.alert(); // Output: Phone is in a call.
phone.hangup(); // Output: Hanging up the call.
phone.alert(); // Output: Phone is idle.
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/State Design Pattern/state.js
================================================
// Abstract class for phoneState
class PhoneState {
alert() {}
answer() {}
hangup() {}
}
// Concerte Class for phoneState
// State-1 : Phone is in Ringing State
class Ringing extends PhoneState {
alert() {
console.log("Phone is ringing...");
}
answer(context) {
console.log("Phone is answering...");
context.setState(new InCall());
}
hangup() {
console.log("Cannot hangup while ringing");
}
}
// State-2 : Phone is in InCall State
class InCall extends PhoneState {
alert() {
console.log("Phone is in call...");
}
answer() {
console.log("Cannot answer while in call");
}
hangup(context) {
console.log("Phone is hanging up...");
context.setState(new Idle());
}
}
// State-3 : Phone is in Idle State
class Idle extends PhoneState {
alert() {
console.log("Phone is idle...");
}
answer() {
console.log("Phone is answering...");
this.hangup();
}
hangup() {
console.log("Cannot hangup while idle");
}
}
module.exports = { Ringing, InCall, Idle };
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/main.js
================================================
const ShoppinCart = require("./shoppingCart_Context");
const { Cash, UPI, Card, InternetBanking } = require("./paymentStrategy");
// Creating a shopping cart Instance
const shoppingCart = new ShoppinCart();
// Adding items to the shopping cart
shoppingCart.addItem({ name: "Laptop", price: 500 });
shoppingCart.addItem({ name: "Mobile", price: 200 });
shoppingCart.addItem({ name: "TV", price: 1000 });
// View cart after adding items
shoppingCart.viewCart();
// Checkout in method - 1
shoppingCart.setPaymentMethod(new Card(123456789, 123));
shoppingCart.checkout();
// Checkout in method - 2
shoppingCart.setPaymentMethod(new Cash(123));
shoppingCart.checkout();
// Checkout in method - 3
shoppingCart.setPaymentMethod(new UPI(123456789, 123));
shoppingCart.checkout();
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/paymentStrategy.js
================================================
// Strategy class
// Abstract class
class PaymentGateway {
pay(amount) {
throw new Error("Method 'pay()' must be implemented!");
}
}
// Concrete class for paymentGateway
// Cash payment method
class Cash extends PaymentGateway {
pay(amount) {
console.log(`Payment of ${amount} done using Cash`);
}
}
// UPI payment method
class UPI extends PaymentGateway {
constructor(UPI_ID, UPI_PIN) {
super();
this.UPI_ID = UPI_ID;
this.UPI_PIN = UPI_PIN;
}
pay(amount) {
console.log(
`Payment of ${amount} done using UPI with ID ${this.UPI_ID} and PIN ${this.UPI_PIN}`
);
}
}
// Card payment method
class Card extends PaymentGateway {
constructor(cardNumber, CVV) {
super();
this.cardNumber = cardNumber;
this.CVV = CVV;
}
pay(amount) {
console.log(
`Payment of ${amount} done using Card Number ${this.cardNumber} and CVV ${this.CVV}`
);
}
}
// Internet Banking payment method
class InternetBanking extends PaymentGateway {
constructor(accountNumber, IFSC) {
super();
this.accountNumber = accountNumber;
this.IFSC = IFSC;
}
pay(amount) {
console.log(
`Payment of ${amount} done using Internet Banking with Account Number ${this.accountNumber} and IFSC ${this.IFSC}`
);
}
}
module.exports = { Cash, UPI, Card, InternetBanking };
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/shoppingCart_Context.js
================================================
// Context file as shoppingCart class
class ShoppinCart {
constructor() {
this.items = [];
this.paymentMethod = null;
}
// Adding items to the shopping cart
addItem(item) {
this.items.push(item);
}
// View cart after adding items
viewCart() {
console.log("Your cart contains: ");
this.items.forEach((item, index) => {
console.log(`${index + 1}. ${item.name} - $${item.price}`);
});
}
// Selecting the payment method
setPaymentMethod(paymentMethod) {
this.paymentMethod = paymentMethod;
}
// Checkout
checkout() {
// Adding reduce method to calculate the total bill
const Total = this.items.reduce((total, item) => total + item.price, 0);
// Checks if paymentMethod is choosen to proceed for checkout
if (this.paymentMethod) {
console.log(`Total Bill: $${Total}`);
this.paymentMethod.pay(Total);
} else {
console.log("Please confirm your payment method");
}
}
}
module.exports = ShoppinCart;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beverages.js
================================================
// Abstract class in Template Pattern
class Food {
prepareFood() {
this.boilWater();
this.brew();
this.pourInCup();
this.addCondiments();
this.noNeedVegetables(); // Setting as optional from template pattern
}
boilWater() {
console.log("Boiling the water...");
}
brew() {
throw new error("Method 'brew()' must be implemented");
}
pourInCup() {
console.log("Pouring into cup...");
}
addCondiments() {
throw new error("Method 'addCondiments()' must be implemented");
}
// private method
noNeedVegetables() {
if (this.shouldAddVegetables()) {
this.addVegetables();
}
}
addVegetables() {
console.log("No vegetables added here!");
}
// Default is set to false
shouldAddVegetables() {
return false;
}
}
module.exports = Food;
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beveragesTypes.js
================================================
// Concrete classes for Food
// Make using of superClasses from templatePattern and modifying here (subClasses)
const Food = require("./beverages");
class Tea extends Food {
brew() {
console.log("Steeping the tea...");
}
addCondiments() {
console.log("Adding lemon...");
}
addVegetables() {
console.log("Adding mint leaves to tea...");
}
shouldAddVegetables() {
return true; // Tea includes vegetables
}
}
class Coffee extends Food {
brew() {
console.log("Dripping coffee through filter...");
}
addCondiments() {
console.log("Adding sugar and milk...");
}
}
module.exports = { Tea, Coffee };
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/main.js
================================================
const { Tea, Coffee } = require("./beveragesTypes");
// Meal 1
console.log("Preparing Tea..");
const tea = new Tea();
tea.prepareFood();
console.log(""); // For spacing
// Meal 2
console.log("Preparing Coffee..");
const coffee = new Coffee();
coffee.prepareFood();
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/element.js
================================================
// element.js
class Shape {
accept(visitor) {
throw new Error("This method should be overridden!");
}
}
class Circle extends Shape {
constructor(radius) {
super();
this.radius = radius;
}
accept(visitor) {
visitor.visitCircle(this);
}
}
class Rectangle extends Shape {
constructor(width, height) {
super();
this.width = width;
this.height = height;
}
accept(visitor) {
visitor.visitRectangle(this);
}
}
module.exports = {Circle,Rectangle};
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/main.js
================================================
const { Circle, Rectangle } = require("./element");
const { AreaVisitor, PerimeterVisitor } = require("./visitor");
const shapes = [
new Circle(5),
new Rectangle(10, 20),
];
// Create visitors
const areaVisitor = new AreaVisitor();
const perimeterVisitor = new PerimeterVisitor();
// Calculate areas
console.log("Calculating Areas:");
shapes.forEach((shape) => {
shape.accept(areaVisitor);
});
// Calculate perimeters
console.log("\nCalculating Perimeters:");
shapes.forEach((shape) => {
shape.accept(perimeterVisitor);
});
================================================
FILE: design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/visitor.js
================================================
// Visitor Interface
class ShapeVisitor {
visitCircle(circle) {
throw new Error(`This circle method should be overridden!`);
}
visitRectangle(rectangle) {
throw new Error(`This rectangke method should be overridden!`);
}
}
// Concrete visitor classes
class AreaVisitor extends ShapeVisitor {
visitCircle(circle) {
const area = Math.PI * circle.radius * circle.radius;
console.log(`Aread of circle: ${area}`);
}
visitRectangle(rectangle) {
const area = rectangle.width * rectangle.height;
console.log(`Area of rectangle: ${area}`);
}
}
class PerimeterVisitor extends ShapeVisitor {
visitCircle(circle) {
const perimeter = 2 * Math.PI * circle.radius;
console.log(`Perimeter of circle: ${perimeter}`);
}
visitRectangle(rectangle) {
const perimeter = 2 * (rectangle.width + rectangle.height);
console.log(`Perimeter of rectangle: ${perimeter}`);
}
}
module.exports = { AreaVisitor, PerimeterVisitor };
================================================
FILE: design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/abstract.js
================================================
// Abstract product
class Chair {
sitOn() {
throw new error("Sitting on chair");
}
}
class Sofa {
lieOn() {
throw new error("Lying on sofa");
}
}
// Concrete product for modernStyle
class ModernChair extends Chair {
sitOn() {
console.log("Sitting on modern chair");
}
}
class ModernSofa extends Sofa {
lieOn() {
console.log("Lying on modern sofa");
}
}
// Concrete product for classicStyle
class ClassicChair extends Chair {
sitOn() {
console.log("Sitting on classic chair");
}
}
class ClassicSofa extends Sofa {
lieOn() {
console.log("Lying on classic sofa");
}
}
// Abstract factory
class FurnitureFactory {
createChair() {
throw new error("Creating chair");
}
createSofa() {
throw new error("Creating sofa");
}
}
// Concrete factory for modernStyle
class ModernFurnitureFactory extends FurnitureFactory {
createChair() {
return new ModernChair();
}
createSofa() {
return new ModernSofa();
}
}
// Concrete factory for classicStyle
class ClassicFurnitureFactory extends FurnitureFactory {
createChair() {
return new ClassicChair();
}
createSofa() {
return new ClassicSofa();
}
}
module.exports = {
ModernFurnitureFactory,
ClassicFurnitureFactory,
};
================================================
FILE: design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/main.js
================================================
const {
ModernFurnitureFactory,
ClassicFurnitureFactory,
} = require("./abstract");
function createFurniture(factory) {
const chair = factory.createChair();
const sofa = factory.createSofa();
chair.sitOn();
sofa.lieOn();
}
// Use the Modern Furniture Factory
const modernFactory = new ModernFurnitureFactory();
createFurniture(modernFactory);
// Use the Victorian Furniture Factory
const classicFactory = new ClassicFurnitureFactory();
createFurniture(classicFactory);
================================================
FILE: design-patterns/Javascript/Creational Pattern/Builder Design Pattern/app.js
================================================
const ComputerBuilder = require("./computerBuilder");
const myComputer = new ComputerBuilder("Intel", "4GB")
.addStorage("1TB")
.addMoniter("LG")
.build(); // Finally build the computer
console.log(myComputer);
================================================
FILE: design-patterns/Javascript/Creational Pattern/Builder Design Pattern/computerBuilder.js
================================================
class Computer {
constructor(builder) {
this.cpu = builder.cpu;
this.ram = builder.ram;
this.hardDisk = builder.hardDisk;
this.moniter = builder.moniter;
}
}
class ComputerBuilder {
constructor(cpu, ram) {
this.cpu = cpu;
this.ram = ram;
}
// Methods with chaining
addStorage(hardDisk) {
this.hardDisk = hardDisk;
return this;
}
addMoniter(moniter) {
this.moniter = moniter;
return this;
}
build() {
return new Computer(this); // Pass the builder methods to the computer
}
}
module.exports = ComputerBuilder;
================================================
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/factory.js
================================================
const { cheesePizza, pepperoniPizza } = require("./pizza");
class pizzaFactory {
static createPizza(pizzaType) {
if (pizzaType === "cheese") {
return new cheesePizza();
} else if (pizzaType === "pepperoni") {
return new pepperoniPizza();
} else {
throw new Error("Invalid pizza type");
}
}
}
module.exports = pizzaFactory;
================================================
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/main.js
================================================
const pizzaFactory = require("./factory");
function main() {
const pizzaType = process.argv[2] || "cheese";
try {
const pizza = pizzaFactory.createPizza(pizzaType);
pizza.prepare();
pizza.bake();
pizza.cut();
pizza.box();
} catch (error) {
console.log(error.message);
}
}
main();
================================================
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/pizza.js
================================================
class Pizza {
prepare() {
throw new error('Method "prepare()" must be implemented');
}
bake() {
console.log("Baking for 25 minutes");
}
cut() {
console.log("Cutting the pizza");
}
box() {
console.log("boxing the pizza");
}
}
class cheesePizza extends Pizza {
prepare() {
console.log("Preparing cheese pizza");
}
}
class pepperoniPizza extends Pizza {
prepare() {
console.log("Preparing pepperoni pizza");
}
}
module.exports = {
cheesePizza,
pepperoniPizza,
};
================================================
FILE: design-patterns/Javascript/Creational Pattern/Prototype Design Pattern/app.js
================================================
class Car{
constructor(model, year, color){
this.model = model;
this.year = year;
this.color = color;
}
clone(){ // Clone method to clone the current object
return new Car(this.model, this.year, this.color); // Return the new object with same properties
}
getDetails(){
return `Model: ${this.model}, Year: ${this.year}, Color: ${this.color}`
}
}
const prototypeCar = new Car("Mustang", 2019, "red");
const cloneCar1 = prototypeCar.clone(); // 1st clone
cloneCar1.color = "blue";
const cloneCar2 = prototypeCar.clone(); // 2nd clone
cloneCar2.color = "green";
console.log(prototypeCar.getDetails());
console.log(cloneCar1.getDetails());
console.log(cloneCar2.getDetails());
================================================
FILE: design-patterns/Javascript/Creational Pattern/Singleton Design Pattern/app.js
================================================
// Importing
const singleton = require("./singleton");
const Singleton1 = require("./singleton");
const Singleton2 = require("./singleton");
Singleton1.increment();
console.log(Singleton1.getData());
console.log(Singleton2.getData());
console.log(Singleton1 === Singleton2); // True
================================================
FILE: design-patterns/Javascript/Creational Pattern/Singleton Design Pattern/singleton.js
================================================
//Variable to hold the instance
let instance = null;
class Singleton {
constructor() {
if (instance) {
//check if instance already exists
return instance; //return existing instance
}
this.data = 0;
instance = this;
}
// Method to modify data
increment() {
this.data += 1;
}
// Method to get the current data
getData() {
return this.data;
}
}
module.exports = new Singleton();
================================================
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/adapter.js
================================================
// usbAdapter.js
// No need to import USB_A_Connector here
class USB_Adapter {
constructor(connector) {
this.connector = connector; // Store the USB-A connector instance
}
plugIn() {
return this.connector.connect(); // Use the method of the passed instances
}
}
module.exports = USB_Adapter;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/main.js
================================================
const USB_A_Connector = require("./usbA_connector");
const Adapter = require("./adapter");
// Creating instances for imported classes
const usbAConnector = new USB_A_Connector();
const adapter = new Adapter(usbAConnector);
console.log(adapter.plugIn());
================================================
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbA_connector.js
================================================
// USB A plug class
// Old system
class USB_A_Connector {
connect() {
return "USB-A connector connected";
}
}
module.exports = USB_A_Connector;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbC_device.js
================================================
// Device class to connect USB A cable
// New system
class USB_C_Device {
plugIn() {
return "USB C device connected";
}
}
module.exports = USB_C_Device;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/device.js
================================================
// Device.js
// The Device interface
class Device {
turnOn() {
throw new Error("Method 'turnOn()' must be implemented.");
}
turnOff() {
throw new Error("Method 'turnOff()' must be implemented.");
}
}
// Concrete class for TV
class TV extends Device {
turnOn() {
console.log("TV is now ON.");
}
turnOff() {
console.log("TV is now OFF.");
}
}
// Concrete class for Radio
class Radio extends Device {
turnOn() {
console.log("Radio is now ON.");
}
turnOff() {
console.log("Radio is now OFF.");
}
}
// Exporting the device classes
module.exports = {
TV,
Radio,
};
================================================
FILE: design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/main.js
================================================
// main.js
const { TV, Radio } = require("./device");
const RemoteControl = require("./remoteControl");
// Creating instances of devices
const tv = new TV();
const radio = new Radio();
// Creating a remote control for the TV
const tvRemote = new RemoteControl(tv);
tvRemote.pressOn();
tvRemote.pressOff();
// Creating a remote control for the Radio
const radioRemote = new RemoteControl(radio);
radioRemote.pressOn();
radioRemote.pressOff();
================================================
FILE: design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/remoteControl.js
================================================
// RemoteControl.js
class RemoteControl {
constructor(device) {
this.device = device; // This is the bridge to the device
}
pressOn() {
this.device.turnOn(); // Call the device's turnOn method
}
pressOff() {
this.device.turnOff(); // Call the device's turnOff method
}
}
module.exports = RemoteControl;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/app.js
================================================
const File = require("./file");
const Folder = require("./folder");
// Let's create some files with random file extensions
const file1 = new File("File1.js");
const file2 = new File("File2.py");
const file3 = new File("File3.cpp");
const file4 = new File("File4.txt");
const file5 = new File("File5.docx");
const file6 = new File("File6.xlsx");
const file7 = new File("File7.pptx");
const file8 = new File("File8.pdf");
const file9 = new File("File9.png");
const file10 = new File("File10.jpg");
// Let's create a folder to add files
const folder1 = new Folder("Folder1");
folder1.add(file1);
folder1.add(file2);
folder1.add(file4);
const folder2 = new Folder("Folder2");
folder2.add(file3);
folder2.add(file8);
const folder3 = new Folder("Folder3");
folder3.add(file5);
folder3.add(file9);
folder3.add(file10);
const folder4 = new Folder("Folder4");
folder4.add(file6);
folder4.add(file7);
// Let's create a root folder
const rootFolder = new Folder("Root");
rootFolder.add(folder1);
rootFolder.add(folder2);
rootFolder.add(folder3);
rootFolder.add(folder4);
// Let's show the details from the root folder
rootFolder.showDetails();
================================================
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/component.js
================================================
// Abstract Class or Component class
class Component {
showDetails() {
throw new error("This method is overriden by subclasses");
}
}
module.exports = Component;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/file.js
================================================
const Component = require("./component");
class File extends Component {
constructor(name) {
super();
this.name = name;
}
showDetails() {
console.log(`File: ${this.name}`);
}
}
module.exports = File;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/folder.js
================================================
const Component = require("./component");
// Composite: Folder that can hold files or other folders
class Folder extends Component {
constructor(name) {
super();
this.name = name;
this.files = [];
}
add(file) {
this.files.push(file);
}
showDetails() {
console.log(`Folder: ${this.name}`);
this.files.forEach((file) => file.showDetails());
}
}
module.exports = Folder;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/additional.js
================================================
// Additional behavior class
class Cream {
constructor(coffee) {
this.coffee = coffee;
}
cost() {
return this.coffee.cost() + 5; // Add cost of cream to the base coffee class
}
}
class Sugar {
constructor(coffee) {
this.coffee = coffee; // Store the coffee instance
}
cost() {
return this.coffee.cost() + 2; // Add cost of sugar to the base coffee class
}
}
class Ice{
constructor(coffee) {
this.coffee = coffee; // Store the coffee instance
}
cost() {
return this.coffee.cost() + 1; // Add cost of ice to the base coffee class
}
}
module.exports = {Cream, Sugar, Ice};
================================================
FILE: design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/coffee.js
================================================
// Base class component
class Coffee {
cost() {
return 10; // Base price of coffee is 10
}
}
module.exports = Coffee;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/main.js
================================================
const Coffee = require("./coffee");
const {Cream, Sugar, Ice} = require("./additional");
// Create an instance of coffee
let myCoffee = new Coffee();
console.log(`Base amount: ${myCoffee.cost()}`); // Get base cost of coffee
myCoffee = new Sugar(myCoffee);
console.log(`Sugar amount: ${myCoffee.cost()}`); // Add cost of sugar
myCoffee = new Cream(myCoffee);
console.log(`Cream amount: ${myCoffee.cost()}`); // Add cost of cream
myCoffee = new Ice(myCoffee);
console.log(`Ice amount: ${myCoffee.cost()}`); // Add cost of ice
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/dvdPlayer.js
================================================
// Class for DVD player functionality
class DVDPlayer {
on() {
console.log("DVD player is on");
}
play(movie) {
console.log(`Playing ${movie}`);
}
off() {
console.log("DVD player is off");
}
}
module.exports = DVDPlayer;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/lights.js
================================================
// Class for lights functionality
class Lights {
on() {
console.log("Lights on, take you're seat!");
}
off() {
console.log("Lights off, get ready to see the show!");
}
}
module.exports = Lights;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/main.js
================================================
// client code for facade design pattern
const MovieFacade = require("./movieFacade");
const movieFacade = new MovieFacade();
// By getting the required data, we can proceed all the functionality using facade design pattern.
movieFacade.watchMovie("Goat 🍾🎉");
movieFacade.getSnacks("Popcorn");
movieFacade.endMovie();
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/movieFacade.js
================================================
const SoundSystem = require("./soundSystem");
const DVDPlayer = require("./dvdPlayer");
const Projector = require("./projector");
const Lights = require("./lights");
const Snacks = require("./snacks");
class MovieFacade {
constructor() {
this.soundSystem = new SoundSystem();
this.dvdPlayer = new DVDPlayer();
this.projector = new Projector();
this.lights = new Lights();
this.snacks = new Snacks();
}
watchMovie(movie) {
console.log(`Starting to watch a movie ${movie}`);
this.lights.on();
this.projector.on();
this.projector.connect("DVD Player");
this.dvdPlayer.on();
this.soundSystem.on();
this.dvdPlayer.play(movie);
this.soundSystem.setVolume("High");
}
getSnacks(snacks) {
console.log("1st part of the movie is great! Let's order some snacks");
this.snacks.noteOrder(snacks);
this.snacks.prepare();
this.snacks.serve(snacks);
}
endMovie() {
console.log("End of the movie, shutting down");
this.lights.off();
this.projector.off();
this.dvdPlayer.off();
this.soundSystem.off();
}
}
module.exports = MovieFacade;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/projector.js
================================================
// Class for projector functionality
class Projector {
on() {
console.log("Projector on");
}
connect(source) {
console.log(`Connecting projector to ${source}`);
}
off() {
console.log("Projector off");
}
}
module.exports = Projector;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/snacks.js
================================================
// Class for snacks functionality
class Snacks {
noteOrder(snacks) {
console.log(`Ordering ${snacks}`);
}
prepare() {
console.log("Preparing snacks 🍿");
}
serve(snacks) {
console.log(`Here is your ${snacks} sir!, enjoy your movie 😊`);
}
}
module.exports = Snacks;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/soundSystem.js
================================================
// Class for sound system functionality
class SoundSystem {
on() {
console.log("Sound system is on");
}
setVolume(volume) {
console.log(`Setting volume to ${volume}`);
}
off() {
console.log("Sound system is off");
}
}
module.exports = SoundSystem;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circle.js
================================================
// Intrinsic state
class Circle{
constructor(color){
this.color = color;
}
draw(size, x, y){
console.log(`Drawing a circle of size ${size} at position (${x}, ${y})`);
}
}
module.exports = Circle;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circleFactory.js
================================================
// circleFactory.js
const Circle = require("./circle");
class CircleFactory {
constructor() {
this.circles = {}; // Store the created circles
}
getCircle(color) {
// Check if the circle exists
if (!this.circles[color]) {
// Create a new circle if it doesn't exist
this.circles[color] = new Circle(color);
}
return this.circles[color];
}
}
module.exports = CircleFactory;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/main.js
================================================
const CircleFactory = require("./circleFactory");
const circleFactory = new CircleFactory();
const redCircle = circleFactory.getCircle("red");
redCircle.draw("big", 20, 30);
const blueCircle = circleFactory.getCircle("blue");
blueCircle.draw("medium", 200, 300);
const greenCircle = circleFactory.getCircle("red");
greenCircle.draw("medium", 200, 300); // Here it won't create a new object as it already exists.
console.log(
`Total unique circle instance created are: ${
Object.keys(circleFactory.circles).length
}`
);
================================================
FILE: design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/main.js
================================================
const proxyImage = require("./proxyImage");
const image = new proxyImage("test.jpg");
console.log('First call to display:');
image.display();
console.log('Second call to display:');
image.display();
================================================
FILE: design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/proxyImage.js
================================================
// Proxy object
const realImage = require("./real_Image");
class ProxyImage {
constructor(fileName) {
this.fileName = fileName;
this.realImage = null; // LAZY LOADING (Image not loaded yet)
}
display() {
// Loading the image only if requested
if (!this.realImage) {
this.realImage = new realImage(this.fileName);
}
this.realImage.display();
}
}
module.exports = ProxyImage;
================================================
FILE: design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/real_Image.js
================================================
class realImage {
constructor(fileName) {
this.fileName = fileName;
this.loadFromDisk();
}
loadFromDisk() {
console.log(`Loading image from disk: ${this.fileName}`);
}
display() {
console.log(`Displaying image: ${this.fileName}`);
}
}
module.exports = realImage;
================================================
FILE: design-patterns/cpp/adapter/in_house_payment_processor.cpp
================================================
#include "in_house_payment_processor.h"
#include <iostream>
#include <chrono>
#include <sstream>
void InHousePaymentProcessor::processPayment(double amount, const std::string& currency) {
std::cout << "InHousePaymentProcessor: Processing payment of " << amount << " " << currency << std::endl;
// Process payment logic
auto now = std::chrono::system_clock::now();
auto now_ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
transactionId = "TXN_" + std::to_string(now_ms.count());
isPaymentSuccessful = true;
std::cout << "InHousePaymentProcessor: Payment successful. Txn ID: " << transactionId << std::endl;
}
bool InHousePaymentProcessor::isPaymentSuccessful() {
return isPaymentSuccessful;
}
std::string InHousePaymentProcessor::getTransactionId() {
return transactionId;
}
================================================
FILE: design-patterns/cpp/adapter/in_house_payment_processor.h
================================================
#pragma once
#include "payment_processor.h"
#include <string>
class InHousePaymentProcessor : public PaymentProcessor {
public:
void processPayment(double amount, const std::string& currency) override;
bool isPaymentSuccessful() override;
std::string getTransactionId() override;
private:
std::string transactionId;
bool isPaymentSuccessful = false;
};
================================================
FILE: design-patterns/cpp/adapter/legacy_gateway.cpp
================================================
#include "legacy_gateway.h"
#include <iostream>
#include <chrono>
void LegacyGateway::executeTransaction(double totalAmount, const std::string& currency) {
std::cout << "LegacyGateway: Executing transaction for " << currency << " " << totalAmount << std::endl;
auto now = std::chrono::high_resolution_clock::now();
transactionReference = now.time_since_epoch().count();
isPaymentSuccessful = true;
std::cout << "LegacyGateway: Transaction executed successfully. Txn ID: " << transactionReference << std::endl;
}
bool LegacyGateway::checkStatus(long transactionReference) {
std::cout << "LegacyGateway: Checking status for ref: " << transactionReference << std::endl;
return isPaymentSuccessful;
}
long LegacyGateway::getReferenceNumber() {
return transactionReference;
}
================================================
FILE: design-patterns/cpp/adapter/legacy_gateway.h
================================================
#pragma once
#include <string>
class LegacyGateway {
public:
void executeTransaction(double totalAmount, const std::string& currency);
bool checkStatus(long transactionReference);
long getReferenceNumber();
private:
long transactionReference;
bool isPaymentSuccessful = false;
};
================================================
FILE: design-patterns/cpp/adapter/legacy_gateway_adapter.cpp
================================================
#include "legacy_gateway_adapter.h"
#include <iostream>
LegacyGatewayAdapter::LegacyGatewayAdapter(LegacyGateway* legacyGateway)
: legacyGateway(legacyGateway) {}
void LegacyGatewayAdapter::processPayment(double amount, const std::string& currency) {
std::cout << "LegacyGatewayAdapter: Processing payment of " << amount << " " << currency << std::endl;
legacyGateway->executeTransaction(amount, currency);
std::cout << "LegacyGatewayAdapter: Payment processed successfully. Txn ID: "
<< legacyGateway->getReferenceNumber() << std::endl;
}
bool LegacyGatewayAdapter::isPaymentSuccessful() {
return legacyGateway->checkStatus(legacyGateway->getReferenceNumber());
}
std::string LegacyGatewayAdapter::getTransactionId() {
return std::to_string(legacyGateway->getReferenceNumber());
}
================================================
FILE: design-patterns/cpp/adapter/legacy_gateway_adapter.h
================================================
#pragma once
#include "payment_processor.h"
#include "legacy_gateway.h"
class LegacyGatewayAdapter : public PaymentProcessor {
public:
explicit LegacyGatewayAdapter(LegacyGateway* legacyGateway);
void processPayment(double amount, const std::string& currency) override;
bool isPaymentSuccessful() override;
std::string getTransactionId() override;
private:
LegacyGateway* legacyGateway;
};
================================================
FILE: design-patterns/cpp/adapter/main.cpp
================================================
#include "in_house_payment_processor.h"
#include "legacy_gateway.h"
#include "legacy_gateway_adapter.h"
#include <iostream>
int main() {
std::cout << "Adapter Pattern Demo\n" << std::endl;
// Using the new payment processor
std::cout << "Using InHousePaymentProcessor:" << std::endl;
PaymentProcessor* processor = new InHousePaymentProcessor();
processor->processPayment(100.0, "USD");
std::cout << "Payment successful: " << (processor->isPaymentSuccessful() ? "Yes" : "No") << std::endl;
std::cout << "Transaction ID: " << processor->getTransactionId() << std::endl;
delete processor;
std::cout << "\nUsing LegacyGateway through adapter:" << std::endl;
LegacyGateway* legacyGateway = new LegacyGateway();
PaymentProcessor* adapter = new LegacyGatewayAdapter(legacyGateway);
adapter->processPayment(200.0, "EUR");
std::cout << "Payment successful: " << (adapter->isPaymentSuccessful() ? "Yes" : "No") << std::endl;
std::cout << "Transaction ID: " << adapter->getTransactionId() << std::endl;
delete adapter;
delete legacyGateway;
return 0;
}
================================================
FILE: design-patterns/cpp/adapter/payment_processor.h
================================================
#pragma once
#include <string>
class PaymentProcessor {
public:
virtual ~PaymentProcessor() = default;
virtual void processPayment(double amount, const std::string& currency) = 0;
virtual bool isPaymentSuccessful() = 0;
virtual std::string getTransactionId() = 0;
};
================================================
FILE: design-patterns/cpp/bridge/circle.cpp
================================================
#include "circle.h"
Circle::Circle(Renderer* renderer, float radius)
: Shape(renderer), radius(radius) {}
void Circle::draw() {
renderer->renderCircle(radius);
}
================================================
FILE: design-patterns/cpp/bridge/circle.h
================================================
#pragma once
#include "shape.h"
class Circle : public Shape {
public:
Circle(Renderer* renderer, float radius);
void draw() override;
private:
float radius;
};
================================================
FILE: design-patterns/cpp/bridge/main.cpp
================================================
#include "vector_renderer.h"
#include "raster_renderer.h"
#include "circle.h"
#include "rectangle.h"
#include <iostream>
int main() {
VectorRenderer vectorRenderer;
RasterRenderer rasterRenderer;
Circle vectorCircle(&vectorRenderer, 5.0f);
Rectangle vectorRectangle(&vectorRenderer, 4.0f, 3.0f);
Circle rasterCircle(&rasterRenderer, 7.0f);
Rectangle rasterRectangle(&rasterRenderer, 6.0f, 2.0f);
std::cout << "Vector Circle: ";
vectorCircle.draw();
std::cout << "Vector Rectangle: ";
vectorRectangle.draw();
std::cout << "Raster Circle: ";
rasterCircle.draw();
std::cout << "Raster Rectangle: ";
rasterRectangle.draw();
return 0;
}
================================================
FILE: design-patterns/cpp/bridge/raster_renderer.cpp
================================================
#include "raster_renderer.h"
#include <iostream>
void RasterRenderer::renderCircle(float radius) {
std::cout << "Drawing circle as raster with radius: " << radius << std::endl;
}
void RasterRenderer::renderRectangle(float width, float height) {
std::cout << "Drawing rectangle as raster with width: " << width << ", height: " << height << std::endl;
}
================================================
FILE: design-patterns/cpp/bridge/raster_renderer.h
================================================
#pragma once
#include "renderer.h"
class RasterRenderer : public Renderer {
public:
void renderCircle(float radius) override;
void renderRectangle(float width, float height) override;
};
================================================
FILE: design-patterns/cpp/bridge/rectangle.cpp
================================================
#include "rectangle.h"
Rectangle::Rectangle(Renderer* renderer, float width, float height)
: Shape(renderer), width(width), height(height) {}
void Rectangle::draw() {
renderer->renderRectangle(width, height);
}
================================================
FILE: design-patterns/cpp/bridge/rectangle.h
================================================
#pragma once
#include "shape.h"
class Rectangle : public Shape {
public:
Rectangle(Renderer* renderer, float width, float height);
void draw() override;
private:
float width;
float height;
};
================================================
FILE: design-patterns/cpp/bridge/renderer.h
================================================
#pragma once
class Renderer {
public:
virtual ~Renderer() = default;
virtual void renderCircle(float radius) = 0;
virtual void renderRectangle(float width, float height) = 0;
};
================================================
FILE: design-patterns/cpp/bridge/shape.cpp
================================================
#include "shape.h"
Shape::Shape(Renderer* renderer) : renderer(renderer) {}
================================================
FILE: design-patterns/cpp/bridge/shape.h
================================================
#pragma once
#include "renderer.h"
class Shape {
protected:
Renderer* renderer;
public:
explicit Shape(Renderer* renderer);
virtual ~Shape() = default;
virtual void draw() = 0;
};
================================================
FILE: design-patterns/cpp/bridge/vector_renderer.cpp
================================================
================================================
FILE: design-patterns/cpp/bridge/vector_renderer.h
================================================
#pragma once
#include "renderer.h"
class VectorRenderer : public Renderer {
public:
void renderCircle(float radius) override;
void renderRectangle(float width, float height) override;
};
================================================
FILE: design-patterns/cpp/builder/http_request.cpp
================================================
================================================
FILE: design-patterns/cpp/builder/http_request.h
================================================
#pragma once
#include <string>
#include <map>
#include <iostream>
class HttpRequest {
public:
class Builder;
std::string getUrl() const;
std::string getMethod() const;
const std::map<std::string, std::string>& getHeaders() const;
const std::map<std::string, std::string>& getQueryParams() const;
std::string getBody() const;
int getTimeout() const;
friend std::ostream& operator<<(std::ostream& os, const HttpRequest& req);
private:
std::string url;
std::string method;
std::map<std::string, std::string> headers;
std::map<std::string, std::string> queryParams;
std::string body;
int timeout;
HttpRequest(const Builder& builder);
};
================================================
FILE: design-patterns/cpp/builder/http_request_builder.cpp
================================================
#include "http_request_builder.h"
#include <iostream>
#include <algorithm>
HttpRequest::Builder::Builder(const std::string& url) : url(url) {
if (url.empty()) {
throw std::invalid_argument("URL cannot be empty.");
}
}
HttpRequest::Builder& HttpRequest::Builder::method(const std::string& m) {
method = m.empty() ? "GET" : m;
std::transform(method.begin(), method.end(), method.begin(), ::toupper);
return *this;
}
HttpRequest::Builder& HttpRequest::Builder::header(const std::string& key, const std::string& value) {
if (!key.empty() && !value.empty()) headers[key] = value;
return *this;
}
HttpRequest::Builder& HttpRequest::Builder::queryParam(const std::string& key, const std::string& value) {
if (!key.empty() && !value.empty()) queryParams[key] = value;
return *this;
}
HttpRequest::Builder& HttpRequest::Builder::body(const std::string& b) {
body = b;
return *this;
}
HttpRequest::Builder& HttpRequest::Builder::timeout(int timeoutMillis) {
if (timeoutMillis > 0) timeout = timeoutMillis;
return *this;
}
HttpRequest HttpRequest::Builder::build() {
if ((method == "POST" || method == "PUT") && body.empty()) {
std::cout << "Warning: Building " << method << " request without a body for URL: " << url << std::endl;
}
return HttpRequest(*this);
}
================================================
FILE: design-patterns/cpp/builder/http_request_builder.h
================================================
================================================
FILE: design-patterns/cpp/builder/main.cpp
================================================
#include "http_request.h"
#include "http_request_builder.h"
#include <iostream>
int main() {
// Example 1: Simple GET request
HttpRequest getRequest = HttpRequest::Builder("https://api.example.com/users")
.method("GET")
.header("Accept", "application/json")
.timeout(5000)
.build();
std::cout << "GET Request: " << getRequest << std::endl;
// Example 2: POST request with body and custom headers
HttpRequest postRequest = HttpRequest::Builder("https://api.example.com/posts")
.method("POST")
.header("Content-Type", "application/json")
.header("X-Auth-Token", "some_secret_token")
.body("{\"title\":\"New Post\",\"content\":\"Hello Builder!\"}")
.queryParam("userId", "123")
.build();
std::cout << "POST Request: " << postRequest << std::endl;
// Example 3: Request with only required URL (defaults for others)
HttpRequest defaultRequest = HttpRequest::Builder("https://api.example.com/status").build();
std::cout << "Default Request: " << defaultRequest << std::endl;
// Example 4: Illustrating potential warning from builder
HttpRequest putNoBodyRequest = HttpRequest::Builder("https://api.example.com/resource/1")
.method("PUT")
// .body("updated data") // Body intentionally omitted
.build();
std::cout << "PUT Request (no body): " << putNoBodyRequest << std::endl;
// Example of trying to build with invalid required parameter
try {
HttpRequest invalidRequest = HttpRequest::Builder("").build();
} catch (const std::invalid_argument& e) {
std::cerr << "Error creating request: " << e.what() << std::endl;
}
}
================================================
FILE: design-patterns/cpp/chainofresponsibility/auth_handler.h
================================================
#pragma once
#include "base_handler.h"
#include <iostream>
class AuthHandler : public BaseHandler {
public:
void handle(Request& request) override {
if (request.user.empty()) {
std::cout << "AuthHandler: ❌ User not authenticated." << std::endl;
return;
}
std::cout << "AuthHandler: ✅ Authenticated." << std::endl;
forward(request);
}
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/authorization_handler.h
================================================
#pragma once
#include "base_handler.h"
#include <iostream>
class AuthorizationHandler : public BaseHandler {
public:
void handle(Request& request) override {
if (request.userRole != "ADMIN") {
std::cout << "AuthorizationHandler: ❌ Access denied." << std::endl;
return;
}
std::cout << "AuthorizationHandler: ✅ Authorized." << std::endl;
forward(request);
}
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/base_handler.cpp
================================================
#include "base_handler.h"
void BaseHandler::setNext(RequestHandler* nextHandler) {
next = nextHandler;
}
void BaseHandler::forward(Request& request) {
if (next) {
next->handle(request);
}
}
================================================
FILE: design-patterns/cpp/chainofresponsibility/base_handler.h
================================================
#pragma once
#include "request_handler.h"
class BaseHandler : public RequestHandler {
protected:
RequestHandler* next = nullptr;
public:
void setNext(RequestHandler* next) override;
void forward(Request& request);
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/business_logic_handler.h
================================================
#pragma once
#include "base_handler.h"
#include <iostream>
class BusinessLogicHandler : public BaseHandler {
public:
void handle(Request& request) override {
std::cout << "BusinessLogicHandler: 🚀 Processing request..." << std::endl;
// Core application logic goes here
}
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/main.cpp
================================================
#include "auth_handler.h"
#include "authorization_handler.h"
#include "rate_limit_handler.h"
#include "validation_handler.h"
#include "business_logic_handler.h"
#include "request.h"
#include <iostream>
int main() {
// Create handlers
AuthHandler auth;
AuthorizationHandler authorization;
RateLimitHandler rateLimit;
ValidationHandler validation;
BusinessLogicHandler businessLogic;
// Build the chain
auth.setNext(&authorization);
authorization.setNext(&rateLimit);
rateLimit.setNext(&validation);
validation.setNext(&businessLogic);
// Send a request through the chain
Request request("john", "ADMIN", 10, "{ \"data\": \"valid\" }");
auth.handle(request);
std::cout << "\n--- Trying an invalid request ---" << std::endl;
Request badRequest("", "USER", 150, "");
auth.handle(badRequest);
return 0;
}
================================================
FILE: design-patterns/cpp/chainofresponsibility/rate_limit_handler.h
================================================
#pragma once
#include "base_handler.h"
#include <iostream>
class RateLimitHandler : public BaseHandler {
public:
void handle(Request& request) override {
if (request.requestCount >= 100) {
std::cout << "RateLimitHandler: ❌ Rate limit exceeded." << std::endl;
return;
}
std::cout << "RateLimitHandler: ✅ Within rate limit." << std::endl;
forward(request);
}
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/request.cpp
================================================
#include "request.h"
Request::Request(const std::string& user, const std::string& role, int requestCount, const std::string& payload)
: user(user), userRole(role), requestCount(requestCount), payload(payload) {}
================================================
FILE: design-patterns/cpp/chainofresponsibility/request.h
================================================
#pragma once
#include <string>
class Request {
public:
std::string user;
std::string userRole;
int requestCount;
std::string payload;
Request(const std::string& user, const std::string& role, int requestCount, const std::string& payload);
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/request_handler.h
================================================
#pragma once
#include "request.h"
class RequestHandler {
public:
virtual ~RequestHandler() = default;
virtual void setNext(RequestHandler* next) = 0;
virtual void handle(Request& request) = 0;
};
================================================
FILE: design-patterns/cpp/chainofresponsibility/validation_handler.h
================================================
#pragma once
#include "base_handler.h"
#include <iostream>
class ValidationHandler : public BaseHandler {
public:
void handle(Request& request) override {
if (request.payload.empty() || request.payload.find_first_not_of(" \t\n\r") == std::string::npos) {
std::cout << "ValidationHandler: ❌ Invalid payload." << std::endl;
return;
}
std::cout << "ValidationHandler: ✅ Payload valid." << std::endl;
forward(request);
}
};
================================================
FILE: design-patterns/cpp/composite/file.cpp
================================================
#include "file.h"
#include <iostream>
File::File(const std::string& name, int size) : name(name), size(size) {}
int File::getSize() const {
return size;
}
void File::printStructure(const std::string& indent) const {
std::cout << indent << "- " << name << " (" << size << " KB)" << std::endl;
}
void File::delete() {
std::cout << "Deleting file: " << name << std::endl;
}
================================================
FILE: design-patterns/cpp/composite/file.h
================================================
#pragma once
#include "file_system_item.h"
#include <string>
class File : public FileSystemItem {
public:
File(const std::string& name, int size);
int getSize() const override;
void printStructure(const std::string& indent) const override;
void delete() override;
private:
std::string name;
int size;
};
================================================
FILE: design-patterns/cpp/composite/file_system_item.h
================================================
#pragma once
#include <string>
class FileSystemItem {
public:
virtual ~FileSystemItem() = default;
virtual int getSize() const = 0;
virtual void printStructure(const std::string& indent) const = 0;
virtual void delete() = 0;
};
================================================
FILE: design-patterns/cpp/composite/folder.cpp
================================================
================================================
FILE: design-patterns/cpp/composite/folder.h
================================================
#pragma once
#include "file_system_item.h"
#include <string>
#include <vector>
#include <memory>
class Folder : public FileSystemItem {
public:
explicit Folder(const std::string& name);
void addItem(std::shared_ptr<FileSystemItem> item);
int getSize() const override;
void printStructure(const std::string& indent) const override;
void delete() override;
private:
std::string name;
std::vector<std::shared_ptr<FileSystemItem>> children;
};
================================================
FILE: design-patterns/cpp/composite/main.cpp
================================================
#include "file.h"
#include "folder.h"
#include <iostream>
#include <memory>
int main() {
auto file1 = std::make_shared<File>("readme.txt", 5);
auto file2 = std::make_shared<File>("photo.jpg", 1500);
auto file3 = std::make_shared<File>("data.csv", 300);
auto documents = std::make_shared<Folder>("Documents");
documents->addItem(file1);
documents->addItem(file3);
auto pictures = std::make_shared<Folder>("Pictures");
pictures->addItem(file2);
auto home = std::make_shared<Folder>("Home");
home->addItem(documents);
home->addItem(pictures);
std::cout << "---- File Structure ----" << std::endl;
home->printStructure("");
std::cout << "\nTotal Size: " << home->getSize() << " KB" << std::endl;
std::cout << "\n---- Deleting All ----" << std::endl;
home->delete();
return 0;
}
================================================
FILE: design-patterns/cpp/decorator/bold_decorator.cpp
================================================
#include "bold_decorator.h"
#include <iostream>
BoldDecorator::BoldDecorator(TextView* inner) : TextDecorator(inner) {}
void BoldDecorator::render() {
std::cout << "<b>";
inner->render();
std::cout << "</b>";
}
================================================
FILE: design-patterns/cpp/decorator/bold_decorator.h
================================================
#pragma once
#include "text_decorator.h"
class BoldDecorator : public TextDecorator {
public:
explicit BoldDecorator(TextView* inner);
void render() override;
};
================================================
FILE: design-patterns/cpp/decorator/italic_decorator.cpp
================================================
#include "italic_decorator.h"
#include <iostream>
ItalicDecorator::ItalicDecorator(TextView* inner) : TextDecorator(inner) {}
void ItalicDecorator::render() {
std::cout << "<i>";
inner->render();
std::cout << "</i>";
}
================================================
FILE: design-patterns/cpp/decorator/italic_decorator.h
================================================
#pragma once
#include "text_decorator.h"
class ItalicDecorator : public TextDecorator {
public:
explicit ItalicDecorator(TextView* inner);
void render() override;
};
================================================
FILE: design-patterns/cpp/decorator/main.cpp
================================================
#include "plain_text_view.h"
#include "bold_decorator.h"
#include "italic_decorator.h"
#include "underline_decorator.h"
#include <iostream>
int main() {
TextView* plain = new PlainTextView("Hello, world!");
std::cout << "Plain: ";
plain->render();
std::cout << std::endl;
std::cout << "Bold: ";
TextView* bold = new BoldDecorator(plain);
bold->render();
std::cout << std::endl;
std::cout << "Italic + Bold: ";
TextView* italicBold = new ItalicDecorator(bold);
italicBold->render();
std::cout << std::endl;
std::cout << "Underline + Italic + Bold: ";
TextView* fullStyle = new UnderlineDecorator(italicBold);
fullStyle->render();
std::cout << std::endl;
// Clean up
delete fullStyle;
delete italicBold;
delete bold;
delete plain;
return 0;
}
================================================
FILE: design-patterns/cpp/decorator/plain_text_view.cpp
================================================
#include "plain_text_view.h"
#include <iostream>
PlainTextView::PlainTextView(const std::string& text) : text(text) {}
void PlainTextView::render() {
std::cout << text;
}
================================================
FILE: design-patterns/cpp/decorator/plain_text_view.h
================================================
#pragma once
#include "text_view.h"
#include <string>
class PlainTextView : public TextView {
public:
explicit PlainTextView(const std::string& text);
void render() override;
private:
std::string text;
};
================================================
FILE: design-patterns/cpp/decorator/text_decorator.cpp
================================================
#include "text_decorator.h"
TextDecorator::TextDecorator(TextView* inner) : inner(inner) {}
================================================
FILE: design-patterns/cpp/decorator/text_decorator.h
================================================
#pragma once
#include "text_view.h"
class TextDecorator : public TextView {
protected:
TextView* inner;
public:
explicit TextDecorator(TextView* inner);
};
================================================
FILE: design-patterns/cpp/decorator/text_view.h
================================================
#pragma once
class TextView {
public:
virtual ~TextView() = default;
virtual void render() = 0;
};
================================================
FILE: design-patterns/cpp/decorator/underline_decorator.cpp
================================================
#include "underline_decorator.h"
#include <iostream>
UnderlineDecorator::UnderlineDecorator(TextView* inner) : TextDecorator(inner) {}
void UnderlineDecorator::render() {
std::cout << "<u>";
inner->render();
std::cout << "</u>";
}
================================================
FILE: design-patterns/cpp/decorator/underline_decorator.h
================================================
#pragma once
#include "text_decorator.h"
class UnderlineDecorator : public TextDecorator {
public:
explicit UnderlineDecorator(TextView* inner);
void render() override;
};
================================================
FILE: design-patterns/cpp/facade/build_system.cpp
================================================
#include "build_system.h"
bool BuildSystem::compileProject() {
std::cout << "BuildSystem: Compiling project..." << std::endl;
simulateDelay(2000);
std::cout << "BuildSystem: Build successful." << std::endl;
return true;
}
std::string BuildSystem::getArtifactPath() {
std::string path = "target/myapplication-1.0.jar";
std::cout << "BuildSystem: Artifact located at " << path << std::endl;
return path;
}
void BuildSystem::simulateDelay(int ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}
================================================
FILE: design-patterns/cpp/facade/build_system.h
================================================
#pragma once
#include <string>
#include <chrono>
#include <thread>
#include <iostream>
class BuildSystem {
public:
bool compileProject();
std::string getArtifactPath();
private:
void simulateDelay(int ms);
};
================================================
FILE: design-patterns/cpp/facade/deployment_facade.cpp
================================================
#include "deployment_facade.h"
#include <iostream>
DeploymentFacade::DeploymentFacade()
: vcs(std::make_unique<VersionControlSystem>())
, buildSystem(std::make_unique<BuildSystem>())
, testingFramework(std::make_unique<TestingFramework>())
, deploymentTarget(std::make_unique<DeploymentTarget>()) {}
bool DeploymentFacade::deployApplication(const std::string& branch, const std::string& serverAddress) {
std::cout << "\nFACADE: --- Initiating FULL DEPLOYMENT for branch: " << branch << " to " << serverAddress << " ---" << std::endl;
bool success = true;
try {
// Step 1: Pull latest code
vcs->pullLatestChanges(branch);
// Step 2: Build the project
if (!buildSystem->compileProject()) {
std::cerr << "FACADE: DEPLOYMENT FAILED - Build compilation failed." << std::endl;
return false;
}
std::string artifactPath = buildSystem->getArtifactPath();
// Step 3: Run tests
if (!testingFramework->runUnitTests()) {
std::cerr << "FACADE: DEPLOYMENT FAILED - Unit tests failed." << std::endl;
return false;
}
if (!testingFramework->runIntegrationTests()) {
std::cerr << "FACADE: DEPLOYMENT FAILED - Integration tests failed." << std::endl;
return false;
}
// Step 4: Deploy to production
deploymentTarget->transferArtifact(artifactPath, serverAddress);
deploymentTarget->activateNewVersion(serverAddress);
std::cout << "FACADE: APPLICATION DEPLOYED SUCCESSFULLY TO " << serverAddress << "!" << std::endl;
} catch (const std::exception& e) {
std::cerr << "FACADE: DEPLOYMENT FAILED - An unexpected error occurred: " << e.what() << std::endl;
success = false;
}
return success;
}
bool DeploymentFacade::deployHotfix(const std::string& branch, const std::string& serverAddress) {
std::cout << "\nFACADE: --- Initiating HOTFIX DEPLOYMENT for branch: " << branch << " to " << serverAddress << " ---" << std::endl;
bool success = true;
try {
// Step 1: Pull latest code
vcs->pullLatestChanges(branch);
// Step 2: Build the project
if (!buildSystem->compileProject()) {
std::cerr << "FACADE: HOTFIX FAILED - Build compilation failed." << std::endl;
return false;
}
std::string artifactPath = buildSystem->getArtifactPath();
// Step 3: For a hotfix, we skip extensive tests
std::cout << "FACADE: Skipping full test suite for hotfix deployment (or running minimal smoke tests)." << std::endl;
// Step 4: Deploy to production
deploymentTarget->transferArtifact(artifactPath, serverAddress);
deploymentTarget->activateNewVersion(serverAddress);
std::cout << "FACADE: HOTFIX DEPLOYED SUCCESSFULLY TO " << serverAddress << "!" << std::endl;
} catch (const std::exception& e) {
std::cerr << "FACADE: HOTFIX FAILED - An unexpected error occurred: " << e.what() << std::endl;
success = false;
}
return success;
}
================================================
FILE: design-patterns/cpp/facade/deployment_facade.h
================================================
#pragma once
#include "version_control_system.h"
#include "build_system.h"
#include "testing_framework.h"
#include "deployment_target.h"
#include <string>
#include <memory>
class DeploymentFacade {
public:
DeploymentFacade();
bool deployApplication(const std::string& branch, const std::string& serverAddress);
bool deployHotfix(const std::string& branch, const std::string& serverAddress);
private:
std::unique_ptr<VersionControlSystem> vcs;
std::unique_ptr<BuildSystem> buildSystem;
std::unique_ptr<TestingFramework> testingFramework;
std::unique_ptr<DeploymentTarget> deploymentTarget;
};
================================================
FILE: design-patterns/cpp/facade/deployment_target.cpp
================================================
#include "deployment_target.h"
void DeploymentTarget::transferArtifact(const std::string& artifactPath, const std::string& server) {
std::cout << "Deployment: Transferring " << artifactPath << " to " << server << "..." << std::endl;
simulateDelay(1000);
std::cout << "Deployment: Transfer complete." << std::endl;
}
void DeploymentTarget::activateNewVersion(const std::string& server) {
std::cout << "Deployment: Activating new version on " << server << "..." << std::endl;
simulateDelay(500);
std::cout << "Deployment: Now live on " << server << "!" << std::endl;
}
void DeploymentTarget::simulateDelay(int ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}
================================================
FILE: design-patterns/cpp/facade/deployment_target.h
================================================
#pragma once
#include <string>
#include <chrono>
#include <thread>
#include <iostream>
class DeploymentTarget {
public:
void transferArtifact(const std::string& artifactPath, const std::string& server);
void activateNewVersion(const std::string& server);
private:
void simulateDelay(int ms);
};
================================================
FILE: design-patterns/cpp/facade/main.cpp
================================================
#include "deployment_facade.h"
#include <iostream>
int main() {
DeploymentFacade facade;
// Example 1: Full deployment
std::cout << "=== Full Deployment Example ===" << std::endl;
facade.deployApplication("main", "production-server");
// Example 2: Hotfix deployment
std::cout << "\n=== Hotfix Deployment Example ===" << std::endl;
facade.deployHotfix("hotfix/security-patch", "production-server");
return 0;
}
================================================
FILE: design-patterns/cpp/facade/testing_framework.cpp
================================================
#include "testing_framework.h"
bool TestingFramework::runUnitTests() {
std::cout << "Testing: Running unit tests..." << std::endl;
simulateDelay(1500);
std::cout << "Testing: Unit tests passed." << std::endl;
return true;
}
bool TestingFramework::runIntegrationTests() {
std::cout << "Testing: Running integration tests..." << std::endl;
simulateDelay(3000);
std::cout << "Testing: Integration tests passed." << std::endl;
return true;
}
void TestingFramework::simulateDelay(int ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}
================================================
FILE: design-patterns/cpp/facade/testing_framework.h
================================================
#pragma once
#include <chrono>
#include <thread>
#include <iostream>
class TestingFramework {
public:
bool runUnitTests();
bool runIntegrationTests();
private:
void simulateDelay(int ms);
};
================================================
FILE: design-patterns/cpp/facade/version_control_system.cpp
================================================
#include "version_control_system.h"
void VersionControlSystem::pullLatestChanges(const std::string& branch) {
std::cout << "VCS: Pulling latest changes from '" << branch << "'..." << std::endl;
simulateDelay();
std::cout << "VCS: Pull complete." << std::endl;
}
void VersionControlSystem::simulateDelay() {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
================================================
FILE: design-patterns/cpp/facade/version_control_system.h
================================================
#pragma once
#include <string>
#include <chrono>
#include <thread>
#include <iostream>
class VersionControlSystem {
public:
void pullLatestChanges(const std::string& branch);
private:
void simulateDelay();
};
================================================
FILE: design-patterns/cpp/factory/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.10)
project(factory)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(factory
main.cpp
email_notification.cpp
sms_notification.cpp
push_notification.cpp
notification_factory.cpp
)
================================================
FILE: design-patterns/cpp/factory/email_notification.cpp
================================================
================================================
FILE: design-patterns/cpp/factory/email_notification.h
================================================
#pragma once
#include "notification.h"
class EmailNotification : public Notification {
public:
void send(const std::string& message) override;
};
================================================
FILE: design-patterns/cpp/factory/main.cpp
================================================
#include "notification_factory.h"
#include <iostream>
int main() {
try {
// Create different types of notifications using the factory
auto emailNotification = NotificationFactory::createNotification("EMAIL");
auto smsNotification = NotificationFactory::createNotification("SMS");
auto pushNotification = NotificationFactory::createNotification("PUSH");
// Send messages using the notifications
emailNotification->send("Hello via Email!");
smsNotification->send("Hello via SMS!");
pushNotification->send("Hello via Push!");
// Try to create an invalid notification type
auto invalidNotification = NotificationFactory::createNotification("INVALID");
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
}
return 0;
}
================================================
FILE: design-patterns/cpp/factory/notification.h
================================================
#pragma once
#include <string>
class Notification {
public:
virtual ~Notification() = default;
virtual void send(const std::string& message) = 0;
};
================================================
FILE: design-patterns/cpp/factory/notification_factory.cpp
================================================
#include "notification_factory.h"
#include "email_notification.h"
#include "sms_notification.h"
#include "push_notification.h"
#include <stdexcept>
std::unique_ptr<Notification> NotificationFactory::createNotification(const std::string& type) {
if (type == "EMAIL") {
return std::make_unique<EmailNotification>();
} else if (type == "SMS") {
return std::make_unique<SMSNotification>();
} else if (type == "PUSH") {
return std::make_unique<PushNotification>();
}
throw std::invalid_argument("Unknown notification type");
}
================================================
FILE: design-patterns/cpp/factory/notification_factory.h
================================================
#pragma once
#include "notification.h"
#include <string>
#include <memory>
class NotificationFactory {
public:
static std::unique_ptr<Notification> createNotification(const std::string& type);
};
================================================
FILE: design-patterns/cpp/factory/push_notification.cpp
================================================
#include "push_notification.h"
#include <iostream>
void PushNotification::send(const std::string& message) {
std::cout << "Sending push notification: " << message << std::endl;
}
================================================
FILE: design-patterns/cpp/factory/push_notification.h
================================================
#pragma once
#include "notification.h"
class PushNotification : public Notification {
public:
void send(const std::string& message) override;
};
================================================
FILE: design-patterns/cpp/factory/sms_notification.cpp
================================================
#include "sms_notification.h"
#include <iostream>
void SMSNotification::send(const std::string& message) {
std::cout << "Sending SMS: " << message << std::endl;
}
================================================
FILE: design-patterns/cpp/factory/sms_notification.h
================================================
#pragma once
#include "notification.h"
class SMSNotification : public Notification {
public:
void send(const std::string& message) override;
};
================================================
FILE: design-patterns/cpp/flyweight/circle.cpp
================================================
#include "circle.h"
#include <iostream>
Circle::Circle(const std::string& color) : color(color) {}
void Circle::draw() {
std::cout << "Drawing Circle[ color: " << color
<< ", x: " << x
<< ", y: " << y
<< ", radius: " << radius
<< " ]" << std::endl;
}
================================================
FILE: design-patterns/cpp/flyweight/circle.h
================================================
#pragma once
#include "shape.h"
#include <string>
class Circle : public Shape {
public:
Circle(const std::string& color);
void draw() override;
private:
std::string color;
int x = 0;
int y = 0;
int radius = 0;
};
================================================
FILE: design-patterns/cpp/flyweight/main.cpp
================================================
#include "shape_factory.h"
#include <iostream>
int main() {
std::cout << "Flyweight Pattern Demo\n" << std::endl;
// Get circles of different colors
Shape* redCircle = ShapeFactory::getCircle("Red");
redCircle->draw();
Shape* greenCircle = ShapeFactory::getCircle("Green");
greenCircle->draw();
Shape* blueCircle = ShapeFactory::getCircle("Blue");
blueCircle->draw();
// Try to get a red circle again
Shape* redCircle2 = ShapeFactory::getCircle("Red");
redCircle2->draw();
std::cout << "\nTotal number of circle objects created: "
<< ShapeFactory::getCircleCount() << std::endl;
return 0;
}
================================================
FILE: design-patterns/cpp/flyweight/shape.h
================================================
#pragma once
#include <string>
class Shape {
public:
virtual ~Shape() = default;
virtual void draw() = 0;
};
================================================
FILE: design-patterns/cpp/flyweight/shape_factory.cpp
================================================
#include "shape_factory.h"
#include "circle.h"
std::unordered_map<std::string, Shape*> ShapeFactory::circleMap;
Shape* ShapeFactory::getCircle(const std::string& color) {
auto it = circleMap.find(color);
if (it == circleMap.end()) {
Circle* circle = new Circle(color);
circleMap[color] = circle;
std::cout << "Creating circle of color: " << color << std::endl;
return circle;
}
return it->second;
}
int ShapeFactory::getCircleCount() {
return circleMap.size();
}
================================================
FILE: design-patterns/cpp/flyweight/shape_factory.h
================================================
#pragma once
#include "shape.h"
#include <unordered_map>
#include <string>
#include <memory>
class ShapeFactory {
public:
static Shape* getCircle(const std::string& color);
static int getCircleCount();
private:
static std::unordered_map<std::string, Shape*> circleMap;
};
================================================
FILE: design-patterns/cpp/iterator/container.h
================================================
#pragma once
#include "iterator.h"
class Container {
public:
virtual ~Container() = default;
virtual Iterator* getIterator() = 0;
};
================================================
FILE: design-patterns/cpp/iterator/iterator.h
================================================
#pragma once
#include <string>
class Iterator {
public:
virtual ~Iterator() = default;
virtual bool hasNext() = 0;
virtual std::string next() = 0;
};
================================================
FILE: design-patterns/cpp/iterator/main.cpp
================================================
#include "name_repository.h"
#include <iostream>
int main() {
NameRepository namesRepository;
std::cout << "Names: ";
for (Iterator* iter = namesRepository.getIterator(); iter->hasNext();) {
std::string name = iter->next();
std::cout << name << " ";
}
std::cout << std::endl;
return 0;
}
================================================
FILE: design-patterns/cpp/iterator/name_iterator.cpp
================================================
#include "name_iterator.h"
NameIterator::NameIterator(const std::vector<std::string>& names)
: names(names), index(0) {}
bool NameIterator::hasNext() {
return index < names.size();
}
std::string NameIterator::next() {
if (hasNext()) {
return names[index++];
}
return "";
}
================================================
FILE: design-patterns/cpp/iterator/name_iterator.h
================================================
#pragma once
#include "iterator.h"
#include <vector>
#include <string>
class NameIterator : public Iterator {
public:
explicit NameIterator(const std::vector<std::string>& names);
bool hasNext() override;
std::string next() override;
private:
std::vector<std::string> names;
size_t index;
};
================================================
FILE: design-patterns/cpp/iterator/name_repository.cpp
================================================
#include "name_repository.h"
#include "name_iterator.h"
NameRepository::NameRepository() {
names = {"Robert", "John", "Julie", "Lora"};
}
Iterator* NameRepository::getIterator() {
return new NameIterator(names);
}
================================================
FILE: design-patterns/cpp/iterator/name_repository.h
================================================
#pragma once
#include "container.h"
#include <vector>
#include <string>
class NameRepository : public Container {
public:
NameRepository();
Iterator* getIterator() override;
private:
std::vector<std::string> names;
};
================================================
FILE: design-patterns/cpp/mediator/button.cpp
================================================
#include "button.h"
#include <iostream>
Button::Button(UIMediator* mediator) : UIComponent(mediator), enabled(false) {}
void Button::click() {
if (enabled) {
std::cout << "Login Button clicked!" << std::endl;
notifyMediator(); // Will trigger login attempt
} else {
std::cout << "Login Button is disabled." << std::endl;
}
}
void Button::setEnabled(bool value) {
enabled = value;
std::cout << "Login Button is now " << (enabled ? "ENABLED" : "DISABLED") << std::endl;
}
================================================
FILE: design-patterns/cpp/mediator/button.h
================================================
#pragma once
#include "ui_component.h"
class Button : public UIComponent {
public:
explicit Button(UIMediator* mediator);
void click();
void setEnabled(bool value);
private:
bool enabled;
};
================================================
FILE: design-patterns/cpp/mediator/form_mediator.cpp
================================================
#include "form_mediator.h"
#include <iostream>
void FormMediator::setUsernameField(TextField* field) {
usernameField = field;
}
void FormMediator::setPasswordField(TextField* field) {
passwordField = field;
}
void FormMediator::setLoginButton(Button* button) {
loginButton = button;
}
void FormMediator::setStatusLabel(Label* label) {
statusLabel = label;
}
void FormMediator::componentChanged(UIComponent* component) {
if (component == usernameField || component == passwordField) {
bool enableButton = !usernameField->getText().empty() && !passwordField->getText().empty();
loginButton->setEnabled(enableButton);
} else if (component == loginButton) {
const std::string& username = usernameField->getText();
const std::string& password = passwordField->getText();
if (username == "admin" && password == "1234") {
statusLabel->setText("✅ Login successful!");
} else {
statusLabel->setText("❌ Invalid credentials.");
}
}
}
================================================
FILE: design-patterns/cpp/mediator/form_mediator.h
================================================
#pragma once
#include "ui_mediator.h"
#include "text_field.h"
#include "button.h"
#include "label.h"
class FormMediator : public UIMediator {
public:
void setUsernameField(TextField* field);
void setPasswordField(TextField* field);
void setLoginButton(Button* button);
void setStatusLabel(Label* label);
void componentChanged(UIComponent* component) override;
private:
TextField* usernameField = nullptr;
TextField* passwordField = nullptr;
Button* loginButton = nullptr;
Label* statusLabel = nullptr;
};
================================================
FILE: design-patterns/cpp/mediator/label.cpp
================================================
#include "label.h"
#include <iostream>
Label::Label(UIMediator* mediator) : UIComponent(mediator) {}
void Label::setText(const std::string& message) {
text = message;
std::cout << "Status: " << text << std::endl;
}
================================================
FILE: design-patterns/cpp/mediator/label.h
================================================
#pragma once
#include "ui_component.h"
#include <string>
class Label : public UIComponent {
public:
explicit Label(UIMediator* mediator);
void setText(const std::string& message);
private:
std::string text;
};
================================================
FILE: design-patterns/cpp/mediator/main.cpp
================================================
#include "form_mediator.h"
#include "text_field.h"
#include "button.h"
#include "label.h"
#include <iostream>
int main() {
// Create the mediator
FormMediator mediator;
// Create UI components
TextField usernameField(&mediator);
TextField passwordField(&mediator);
Button loginButton(&mediator);
Label statusLabel(&mediator);
// Register components with the mediator
mediator.setUsernameField(&usernameField);
mediator.setPasswordField(&passwordField);
mediator.setLoginButton(&loginButton);
mediator.setStatusLabel(&statusLabel);
std::cout << "=== Login Form Demo ===\n" << std::endl;
// Test with empty fields
std::cout << "Test 1: Empty fields" << std::endl;
loginButton.click();
// Test with username only
std::cout << "\nTest 2: Username only" << std::endl;
usernameField.setText("admin");
loginButton.click();
// Test with both fields
std::cout << "\nTest 3: Both fields filled" << std::endl;
passwordField.setText("1234");
loginButton.click();
// Test with wrong credentials
std::cout << "\nTest 4: Wrong credentials" << std::endl;
usernameField.setText("user");
passwordField.setText("pass");
loginButton.click();
return 0;
}
================================================
FILE: design-patterns/cpp/mediator/text_field.cpp
================================================
#include "text_field.h"
#include <iostream>
TextField::TextField(UIMediator* mediator) : UIComponent(mediator) {}
void TextField::setText(const std::string& newText) {
text = newText;
std::cout << "TextField updated: " << newText << std::endl;
notifyMediator();
}
const std::string& TextField::getText() const {
return text;
}
================================================
FILE: design-patterns/cpp/mediator/text_field.h
================================================
#pragma once
#include "ui_component.h"
#include <string>
class TextField : public UIComponent {
public:
explicit TextField(UIMediator* mediator);
void setText(const std::string& newText);
const std::string& getText() const;
private:
std::string text;
};
================================================
FILE: design-patterns/cpp/mediator/ui_component.cpp
================================================
#include "ui_component.h"
UIComponent::UIComponent(UIMediator* mediator) : mediator(mediator) {}
void UIComponent::notifyMediator() {
mediator->componentChanged(this);
}
================================================
FILE: design-patterns/cpp/mediator/ui_component.h
================================================
#pragma once
#include "ui_mediator.h"
class UIComponent {
public:
explicit UIComponent(UIMediator* mediator);
virtual ~UIComponent() = default;
protected:
void notifyMediator();
UIMediator* mediator;
};
================================================
FILE: design-patterns/cpp/mediator/ui_mediator.h
================================================
#pragma once
// Forward declaration
class UIComponent;
class UIMediator {
public:
virtual ~UIMediator() = default;
virtual void componentChanged(UIComponent* component) = 0;
};
================================================
FILE: design-patterns/cpp/memento/main.cpp
================================================
#include "text_editor.h"
#include "text_editor_undo_manager.h"
#include <iostream>
int main() {
TextEditor editor;
TextEditorUndoManager undoManager;
std::cout << "=== Text Editor with Undo Demo ===\n" << std::endl;
// Type some text and save state
std::cout << "Typing and saving initial text:" << std::endl;
editor.type("Hello, ");
undoManager.save(editor);
// Type more text and save state
std::cout << "\nTyping and saving more text:" << std::endl;
editor.type("World!");
undoManager.save(editor);
// Type additional text
std::cout << "\nTyping additional text:" << std::endl;
editor.type(" How are you?");
// Show current content
std::cout << "\nCurrent content: " << editor.getContent() << std::endl;
// Undo last change
std::cout << "\nUndoing last change:" << std::endl;
undoManager.undo(editor);
// Show content after undo
std::cout << "\nContent after undo: " << editor.getContent() << std::endl;
// Undo again
std::cout << "\nUndoing again:" << std::endl;
undoManager.undo(editor);
// Show content after second undo
std::cout << "\nContent after second undo: " << editor.getContent() << std::endl;
// Try to undo when nothing is left
std::cout << "\nTrying to undo when nothing is left:" << std::endl;
undoManager.undo(editor);
return 0;
}
================================================
FILE: design-patterns/cpp/memento/text_editor.cpp
================================================
#include "text_editor.h"
#include <iostream>
void TextEditor::type(const std::string& newText) {
content += newText;
std::cout << "Typed: " << newText << std::endl;
}
std::string TextEditor::getContent() const {
return content;
}
TextEditorMemento TextEditor::save() const {
std::cout << "Saving state: \"" << content << "\"" << std::endl;
return TextEditorMemento(content);
}
void TextEditor::restore(const TextEditorMemento& memento) {
content = memento.getState();
std::cout << "Restored state to: \"" << content << "\"" << std::endl;
}
================================================
FILE: design-patterns/cpp/memento/text_editor.h
================================================
#pragma once
#include "text_editor_memento.h"
#include <string>
class TextEditor {
public:
void type(const std::string& newText);
std::string getContent() const;
TextEditorMemento save() const;
void restore(const TextEditorMemento& memento);
private:
std::string content;
};
================================================
FILE: design-patterns/cpp/memento/text_editor_memento.cpp
================================================
#include "text_editor_memento.h"
TextEditorMemento::TextEditorMemento(const std::string& state) : state(state) {}
std::string TextEditorMemento::getState() const {
return state;
}
================================================
FILE: design-patterns/cpp/memento/text_editor_memento.h
================================================
#pragma once
#include <string>
class TextEditorMemento {
public:
explicit TextEditorMemento(const std::string& state);
std::string getState() const;
private:
const std::string state;
};
================================================
FILE: design-patterns/cpp/memento/text_editor_undo_manager.cpp
================================================
#include "text_editor_undo_manager.h"
#include <iostream>
void TextEditorUndoManager::save(TextEditor& editor) {
history.push(editor.save());
}
void TextEditorUndoManager::undo(TextEditor& editor) {
if (!history.empty()) {
editor.restore(history.top());
history.pop();
} else {
std::cout << "Nothing to undo." << std::endl;
}
}
================================================
FILE: design-patterns/cpp/memento/text_editor_undo_manager.h
================================================
#pragma once
#include "text_editor.h"
#include <stack>
class TextEditorUndoManager {
public:
void save(TextEditor& editor);
void undo(TextEditor& editor);
private:
std::stack<TextEditorMemento> history;
};
================================================
FILE: design-patterns/cpp/observer/fitness_data.cpp
================================================
#include "fitness_data.h"
#include <iostream>
FitnessData::FitnessData() : steps(0), activeMinutes(0), calories(0) {}
void FitnessData::registerObserver(FitnessDataObserver* observer) {
observers.push_back(observer);
}
void FitnessData::removeObserver(FitnessDataObserver* observer) {
auto it = std::find(observers.begin(), observers.end(), observer);
if (it != observers.end()) {
observers.erase(it);
}
}
void FitnessData::notifyObservers() {
for (auto observer : observers) {
observer->update(*this);
}
}
void FitnessData::newFitnessDataPushed(int steps, int activeMinutes, int calories) {
this->steps = steps;
this->activeMinutes = activeMinutes;
this->calories = calories;
std::cout << "\nFitnessData: New data received — Steps: " << steps
<< ", Active Minutes: " << activeMinutes
<< ", Calories: " << calories << std::endl;
notifyObservers();
}
void FitnessData::dailyReset() {
steps = 0;
activeMinutes = 0;
calories = 0;
std::cout << "\nFitnessData: Daily reset performed." << std::endl;
notifyObservers();
}
================================================
FILE: design-patterns/cpp/observer/fitness_data.h
================================================
#pragma once
#include "fitness_data_subject.h"
#include <vector>
#include <memory>
class FitnessData : public FitnessDataSubject {
public:
FitnessData();
// Subject interface implementation
void registerObserver(FitnessDataObserver* observer) override;
void removeObserver(FitnessDataObserver* observer) override;
void notifyObservers() override;
// Fitness data methods
void newFitnessDataPushed(int steps, int activeMinutes, int calories);
void dailyReset();
// Getters
int getSteps() const { return steps; }
int getActiveMinutes() const { return activeMinutes; }
int getCalories() const { return calories; }
private:
int steps;
int activeMinutes;
int calories;
std::vector<FitnessDataObserver*> observers;
};
================================================
FILE: design-patterns/cpp/observer/fitness_data_observer.h
================================================
#pragma once
// Forward declaration
class FitnessData;
class FitnessDataObserver {
public:
virtual ~FitnessDataObserver() = default;
virtual void update(const FitnessData& data) = 0;
};
================================================
FILE: design-patterns/cpp/observer/fitness_data_subject.h
================================================
#pragma once
#include "fitness_data_observer.h"
class FitnessDataSubject {
public:
virtual ~FitnessDataSubject() = default;
virtual void registerObserver(FitnessDataObserver* observer) = 0;
virtual void removeObserver(FitnessDataObserver* observer) = 0;
virtual void notifyObservers() = 0;
};
================================================
FILE: design-patterns/cpp/observer/goal_notifier.cpp
================================================
#include "goal_notifier.h"
#include "fitness_data.h"
#include <iostream>
void GoalNotifier::update(const FitnessData& data) {
if (data.getSteps() >= 10000) {
std::cout << "GoalNotifier: Congratulations! You've reached your daily step goal!" << std::endl;
}
if (data.getActiveMinutes() >= 30) {
std::cout << "GoalNotifier: Great job! You've met your active minutes goal!" << std::endl;
}
if (data.getCalories() >= 2000) {
std::cout << "GoalNotifier: Amazing! You've burned your target calories!" << std::endl;
}
}
================================================
FILE: design-patterns/cpp/observer/goal_notifier.h
================================================
#pragma once
#include "fitness_data_observer.h"
class GoalNotifier : public FitnessDataObserver {
public:
void update(const FitnessData& data) override;
};
================================================
FILE: design-patterns/cpp/observer/live_activity_display.cpp
================================================
#include "live_activity_display.h"
#include "fitness_data.h"
#include <iostream>
void LiveActivityDisplay::update(const FitnessData& data) {
std::cout << "LiveActivityDisplay: Current Activity — Steps: " << data.getSteps()
<< ", Active Minutes: " << data.getActiveMinutes()
<< ", Calories: " << data.getCalories() << std::endl;
}
================================================
FILE: design-patterns/cpp/observer/live_activity_display.h
================================================
#pragma once
#include "fitness_data_observer.h"
class LiveActivityDisplay : public FitnessDataObserver {
public:
void update(const FitnessData& data) override;
};
================================================
FILE: design-patterns/cpp/observer/main.cpp
================================================
#include "fitness_data.h"
#include "live_activity_display.h"
#include "progress_logger.h"
#include "goal_notifier.h"
#include <iostream>
int main() {
// Create the subject
FitnessData fitnessData;
// Create observers
LiveActivityDisplay liveDisplay;
ProgressLogger logger;
GoalNotifier notifier;
// Register observers
fitnessData.registerObserver(&liveDisplay);
fitnessData.registerObserver(&logger);
fitnessData.registerObserver(¬ifier);
// Simulate fitness data updates
std::cout << "=== Fitness App Observer Demo ===\n" << std::endl;
// First update
std::cout << "Update 1:" << std::endl;
fitnessData.newFitnessDataPushed(5000, 15, 1000);
// Second update
std::cout << "\nUpdate 2:" << std::endl;
fitnessData.newFitnessDataPushed(12000, 45, 2500);
// Daily reset
std::cout << "\nDaily Reset:" << std::endl;
fitnessData.dailyReset();
return 0;
}
================================================
FILE: design-patterns/cpp/observer/progress_logger.cpp
================================================
================================================
FILE: design-patterns/cpp/observer/progress_logger.h
================================================
#pragma once
#include "fitness_data_observer.h"
class ProgressLogger : public FitnessDataObserver {
public:
void update(const FitnessData& data) override;
};
================================================
FILE: design-patterns/cpp/prototype/enemy.cpp
================================================
#include "enemy.h"
#include <iostream>
Enemy::Enemy(const std::string& type, int health, double speed, bool armored, const std::string& weapon)
: type(type), health(health), speed(speed), armored(armored), weapon(weapon) {}
Enemy* Enemy::clone() const {
return new Enemy(type, health, speed, armored, weapon);
}
void Enemy::setHealth(int health) {
this->health = health;
}
void Enemy::printStats() const {
std::cout << type << " [Health: " << health
<< ", Speed: " << speed
<< ", Armored: " << (armored ? "true" : "false")
<< ", Weapon: " << weapon << "]" << std::endl;
}
================================================
FILE: design-patterns/cpp/prototype/enemy.h
================================================
#pragma once
#include "enemy_prototype.h"
#include <string>
class Enemy : public EnemyPrototype {
public:
Enemy(const std::string& type, int health, double speed, bool armored, const std::string& weapon);
// Clone method implementation
Enemy* clone() const override;
// Setter for health
void setHealth(int health);
// Print enemy stats
void printStats() const;
private:
std::string type;
int health;
double speed;
bool armored;
std::string weapon;
};
================================================
FILE: design-patterns/cpp/prototype/enemy_prototype.h
================================================
#pragma once
class EnemyPrototype {
public:
virtual ~EnemyPrototype() = default;
virtual EnemyPrototype* clone() const = 0;
};
================================================
FILE: design-patterns/cpp/prototype/enemy_registry.cpp
================================================
================================================
FILE: design-patterns/cpp/prototype/enemy_registry.h
================================================
#pragma once
#include "enemy.h"
#include <string>
#include <unordered_map>
#include <memory>
#include <stdexcept>
class EnemyRegistry {
public:
void registerPrototype(const std::string& key, std::unique_ptr<Enemy> prototype);
std::unique_ptr<Enemy> get(const std::string& key) const;
private:
std::unordered_map<std::string, std::unique_ptr<Enemy>> prototypes;
};
================================================
FILE: design-patterns/cpp/prototype/main.cpp
================================================
================================================
FILE: design-patterns/cpp/proxy/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.10)
project(proxy_pattern)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add executable for version 1
add_executable(image_gallery_v1
image_gallery_app_v1.cpp
high_resolution_image.cpp
)
# Add executable for version 2
add_executable(image_gallery_v2
image_gallery_app_v2.cpp
high_resolution_image.cpp
image_proxy.cpp
)
================================================
FILE: design-patterns/cpp/proxy/high_resolution_image.cpp
================================================
#include "high_resolution_image.h"
#include <iostream>
HighResolutionImage::HighResolutionImage(const std::string& fileName)
: fileName(fileName) {
loadImageFromDisk();
}
void HighResolutionImage::loadImageFromDisk() {
std::cout << "Loading image: " << fileName << " from disk (Expensive Operation)..." << std::endl;
// Simulate disk read and memory allocation
std::this_thread::sleep_for(std::chrono::seconds(2)); // Simulate delay
imageData.resize(10 * 1024 * 1024); // 10MB
std::cout << "Image " << fileName << " loaded successfully." << std::endl;
}
void HighResolutionImage::display() {
std::cout << "Displaying image: " << fileName << std::endl;
// Actual rendering logic would go here
}
std::string HighResolutionImage::getFileName() const {
return fileName;
}
================================================
FILE: design-patterns/cpp/proxy/high_resolution_image.h
================================================
================================================
FILE: design-patterns/cpp/proxy/image.h
================================================
#pragma once
#include <string>
class Image {
public:
virtual ~Image() = default;
virtual void display() = 0;
virtual std::string getFileName() const = 0;
};
================================================
FILE: design-patterns/cpp/proxy/image_gallery_app_v1.cpp
================================================
#include "high_resolution_image.h"
#include <iostream>
int main() {
// Create high-resolution images directly
std::cout << "Creating high-resolution images..." << std::endl;
HighResolutionImage image1("nature.jpg");
HighResolutionImage image2("city.jpg");
HighResolutionImage image3("people.jpg");
// Display images
std::cout << "\nDisplaying images..." << std::endl;
image1.display();
image2.display();
image3.display();
// Note: All images are loaded at creation time, even if not displayed
std::cout << "\nNote: All images were loaded at creation time, even if not displayed" << std::endl;
return 0;
}
================================================
FILE: design-patterns/cpp/proxy/image_gallery_app_v2.cpp
================================================
#include "image_proxy.h"
#include <iostream>
int main() {
// Create image proxies
std::cout << "Creating image proxies..." << std::endl;
ImageProxy image1("nature.jpg");
ImageProxy image2("city.jpg");
ImageProxy image3("people.jpg");
// Note: Images are not loaded yet
std::cout << "\nNote: Images are not loaded yet, only proxies are created" << std::endl;
// Display images (this will trigger loading)
std::cout << "\nDisplaying images..." << std::endl;
image1.display(); // This will load the image
image2.display(); // This will load the image
image3.display(); // This will load the image
// Display again (should use cached images)
std::cout << "\nDisplaying images again..." << std::endl;
image1.display(); // Should use cached image
image2.display(); // Should use cached image
image3.display(); // Should use cached image
return 0;
}
================================================
FILE: design-patterns/cpp/proxy/image_proxy.cpp
================================================
#include "image_proxy.h"
#include "high_resolution_image.h"
#include <iostream>
ImageProxy::ImageProxy(const std::string& fileName)
: fileName(fileName) {
std::cout << "ImageProxy: Created for " << fileName << ". Real image not loaded yet." << std::endl;
}
void ImageProxy::display() {
// Lazy initialization: Load only when display() is called
if (!realImage) {
std::cout << "ImageProxy: display() requested for " << fileName << ". Loading high-resolution image..." << std::endl;
realImage = std::make_unique<HighResolutionImage>(fileName);
} else {
std::cout << "ImageProxy: Using cached high-resolution image for " << fileName << std::endl;
}
// Delegate the display call to the real image
realImage->display();
}
std::string ImageProxy::getFileName() const {
// Can safely return without loading the image
return fileName;
}
================================================
FILE: design-patterns/cpp/proxy/image_proxy.h
================================================
#pragma once
#include "image.h"
#include <memory>
class HighResolutionImage;
class ImageProxy : public Image {
public:
explicit ImageProxy(const std::string& fileName);
void display() override;
std::string getFileName() const override;
private:
std::string fileName;
std::unique_ptr<HighResolutionImage> realImage;
};
================================================
FILE: design-patterns/cpp/singleton/double_checked_singleton.cpp
================================================
#include "double_checked_singleton.h"
// Initialize the static instance pointer and mutex
std::atomic<DoubleCheckedSingleton*> DoubleCheckedSingleton::instance = nullptr;
std::mutex DoubleCheckedSingleton::mutex;
DoubleCheckedSingleton& DoubleCheckedSingleton::getInstance() {
// First check (not synchronized)
DoubleCheckedSingleton* p = instance.load(std::memory_order_acquire);
if (!p) {
// Lock the mutex
std::lock_guard<std::mutex> lock(mutex);
// Second check (synchronized)
p = instance.load(std::memory_order_relaxed);
if (!p) {
// Create the instance
p = new DoubleCheckedSingleton();
instance.store(p, std::memory_order_release);
}
}
return *p;
}
================================================
FILE: design-patterns/cpp/singleton/double_checked_singleton.h
================================================
#pragma once
#include <memory>
#include <mutex>
#include <atomic>
class DoubleCheckedSingleton {
public:
// Delete copy constructor and assignment operator
DoubleCheckedSingleton(const DoubleCheckedSingleton&) = delete;
DoubleCheckedSingleton& operator=(const DoubleCheckedSingleton&) = delete;
// Public method to get the instance
static DoubleCheckedSingleton& getInstance();
private:
// Private constructor to prevent instantiation
DoubleCheckedSingleton() = default;
// The single instance, initially null
static std::atomic<DoubleCheckedSingleton*> instance;
// Mutex for thread safety
static std::mutex mutex;
};
================================================
FILE: design-patterns/cpp/singleton/eager_singleton.cpp
================================================
#include "eager_singleton.h"
// Define the static instance
EagerSingleton EagerSingleton::instance;
EagerSingleton& EagerSingleton::getInstance() {
return instance;
}
================================================
FILE: design-patterns/cpp/singleton/eager_singleton.h
================================================
#pragma once
class EagerSingleton {
public:
// Delete copy constructor and assignment operator
EagerSingleton(const EagerSingleton&) = delete;
EagerSingleton& operator=(const EagerSingleton&) = delete;
// Public method to get the instance
static EagerSingleton& getInstance();
private:
// Private constructor to prevent instantiation
EagerSingleton() = default;
// The single instance, created immediately
static EagerSingleton instance;
};
================================================
FILE: design-patterns/cpp/singleton/lazy_singleton.cpp
================================================
#include "lazy_singleton.h"
// Initialize the static instance pointer
std::unique_ptr<LazySingleton> LazySingleton::instance = nullptr;
LazySingleton& LazySingleton::getInstance() {
// Check if instance is null
if (!instance) {
// If null, create a new instance
instance = std::unique_ptr<LazySingleton>(new LazySingleton());
}
// Return the instance (either newly created or existing)
return *instance;
}
================================================
FILE: design-patterns/cpp/singleton/lazy_singleton.h
================================================
#pragma once
#include <memory>
class LazySingleton {
public:
// Delete copy constructor and assignment operator
LazySingleton(const LazySingleton&) = delete;
LazySingleton& operator=(const LazySingleton&) = delete;
// Public method to get the instance
static LazySingleton& getInstance();
private:
// Private constructor to prevent instantiation
LazySingleton() = default;
// The single instance, initially null
static std::unique_ptr<LazySingleton> instance;
};
================================================
FILE: design-patterns/cpp/singleton/main.cpp
================================================
#include "eager_singleton.h"
#include "lazy_singleton.h"
#include "thread_safe_singleton.h"
#include "double_checked_singleton.h"
#include <iostream>
int main() {
std::cout << "=== Singleton Pattern Demo ===\n" << std::endl;
// Test EagerSingleton
std::cout << "Testing EagerSingleton:" << std::endl;
EagerSingleton& eager1 = EagerSingleton::getInstance();
EagerSingleton& eager2 = EagerSingleton::getInstance();
std::cout << "EagerSingleton instances are the same: "
<< (&eager1 == &eager2) << std::endl;
// Test LazySingleton
std::cout << "\nTesting LazySingleton:" << std::endl;
LazySingleton& lazy1 = LazySingleton::getInstance();
LazySingleton& lazy2 = LazySingleton::getInstance();
std::cout << "LazySingleton instances are the same: "
<< (&lazy1 == &lazy2) << std::endl;
// Test ThreadSafeSingleton
std::cout << "\nTesting ThreadSafeSingleton:" << std::endl;
ThreadSafeSingleton& threadSafe1 = ThreadSafeSingleton::getInstance();
ThreadSafeSingleton& threadSafe2 = ThreadSafeSingleton::getInstance();
std::cout << "ThreadSafeSingleton instances are the same: "
<< (&threadSafe1 == &threadSafe2) << std::endl;
// Test DoubleCheckedSingleton
std::cout << "\nTesting DoubleCheckedSingleton:" << std::endl;
DoubleCheckedSingleton& doubleChecked1 = DoubleCheckedSingleton::getInstance();
DoubleCheckedSingleton& doubleChecked2 = DoubleCheckedSingleton::getInstance();
std::cout << "DoubleCheckedSingleton instances are the same: "
<< (&doubleChecked1 == &doubleChecked2) << std::endl;
return 0;
}
================================================
FILE: design-patterns/cpp/singleton/thread_safe_singleton.cpp
================================================
#include "thread_safe_singleton.h"
// Initialize the static instance pointer and mutex
std::unique_ptr<ThreadSafeSingleton> ThreadSafeSingleton::instance = nullptr;
std::mutex ThreadSafeSingleton::mutex;
ThreadSafeSingleton& ThreadSafeSingleton::getInstance() {
// Lock the mutex for thread safety
std::lock_guard<std::mutex> lock(mutex);
// Check if instance is null
if (!instance) {
// If null, create a new instance
instance = std::unique_ptr<ThreadSafeSingleton>(new ThreadSafeSingleton());
}
// Return the instance (either newly created or existing)
return *instance;
}
================================================
FILE: design-patterns/cpp/singleton/thread_safe_singleton.h
================================================
#pragma once
#include <memory>
#include <mutex>
class ThreadSafeSingleton {
public:
// Delete copy constructor and assignment operator
ThreadSafeSingleton(const ThreadSafeSingleton&) = delete;
ThreadSafeSingleton& operator=(const ThreadSafeSingleton&) = delete;
// Public method to get the instance
static ThreadSafeSingleton& getInstance();
private:
// Private constructor to prevent instantiation
ThreadSafeSingleton() = default;
// The single instance, initially null
static std::unique_ptr<ThreadSafeSingleton> instance;
// Mutex for thread safety
static std::mutex mutex;
};
================================================
FILE: design-patterns/cpp/state/dispensing_state.cpp
================================================
#include "dispensing_state.h"
#include "vending_machine.h"
#include "idle_state.h"
#include <iostream>
void DispensingState::selectItem(VendingMachine& context, const std::string& itemCode) {
std::cout << "Please wait, item is being dispensed." << std::endl;
}
void DispensingState::insertCoin(VendingMachine& context, double amount) {
std::cout << "Please wait, item is being dispensed." << std::endl;
}
void DispensingState::dispenseItem(VendingMachine& context) {
std::cout << "Item dispensed. Thank you for your purchase!" << std::endl;
context.reset();
context.setState(std::make_unique<IdleState>());
}
================================================
FILE: design-patterns/cpp/state/dispensing_state.h
================================================
#pragma once
#include "machine_state.h"
class DispensingState : public MachineState {
public:
void selectItem(VendingMachine& context, const std::string& itemCode) override;
void insertCoin(VendingMachine& context, double amount) override;
void dispenseItem(VendingMachine& context) override;
};
================================================
FILE: design-patterns/cpp/state/has_money_state.cpp
================================================
#include "has_money_state.h"
#include "vending_machine.h"
#include "dispensing_state.h"
#include <iostream>
void HasMoneyState::selectItem(VendingMachine& context, const std::string& itemCode) {
std::cout << "Item already selected. Please dispense current item or cancel." << std::endl;
}
void HasMoneyState::insertCoin(VendingMachine& context, double amount) {
std::cout << "Additional money inserted: $" << amount << std::endl;
context.setInsertedAmount(context.getInsertedAmount() + amount);
}
void HasMoneyState::dispenseItem(VendingMachine& context) {
std::cout << "Dispensing item: " << context.getSelectedItem() << std::endl;
context.setState(std::make_unique<DispensingState>());
}
================================================
FILE: design-patterns/cpp/state/has_money_state.h
================================================
#pragma once
#include "machine_state.h"
class HasMoneyState : public MachineState {
public:
void selectItem(VendingMachine& context, const std::string& itemCode) override;
void insertCoin(VendingMachine& context, double amount) override;
void dispenseItem(VendingMachine& context) override;
};
================================================
FILE: design-patterns/cpp/state/idle_state.cpp
================================================
#include "idle_state.h"
#include "vending_machine.h"
#include "item_selected_state.h"
#include <iostream>
void IdleState::selectItem(VendingMachine& context, const std::string& itemCode) {
std::cout << "Item selected: " << itemCode << std::endl;
context.setSelectedItem(itemCode);
context.setState(std::make_unique<ItemSelectedState>());
}
void IdleState::insertCoin(VendingMachine& context, double amount) {
std::cout << "Please select an item first." << std::endl;
}
void IdleState::dispenseItem(VendingMachine& context) {
std::cout << "Please select an item first." << std::endl;
}
================================================
FILE: design-patterns/cpp/state/idle_state.h
================================================
#pragma once
#include "machine_state.h"
class IdleState : public MachineState {
public:
void selectItem(VendingMachine& context, const std::string& itemCode) override;
void insertCoin(VendingMachine& context, double amount) override;
void dispenseItem(VendingMachine& context) override;
};
================================================
FILE: design-patterns/cpp/state/item_selected_state.cpp
================================================
#include "item_selected_state.h"
#include "vending_machine.h"
#include "has_money_state.h"
#include <iostream>
void ItemSelectedState::selectItem(VendingMachine& context, const std::string& itemCode) {
std::cout << "Item already selected. Please insert money or cancel." << std::endl;
}
void ItemSelectedState::insertCoin(VendingMachine& context, double amount) {
std::cout << "Money inserted: $" << amount << std::endl;
context.setInsertedAmount(amount);
context.setState(std::make_unique<HasMoneyState>());
}
void ItemSelectedState::dispenseItem(VendingMachine& context) {
std::cout << "Please insert money first." << std::endl;
}
================================================
FILE: design-patterns/cpp/state/item_selected_state.h
================================================
#pragma once
#include "machine_state.h"
class ItemSelectedState : public MachineState {
public:
void selectItem(VendingMachine& context, const std::string& itemCode) override;
void insertCoin(VendingMachine& context, double amount) override;
void dispenseItem(VendingMachine& context) override;
};
================================================
FILE: design-patterns/cpp/state/machine_state.h
================================================
#pragma once
#include <string>
class VendingMachine; // Forward declaration
class MachineState {
public:
virtual ~MachineState() = default;
virtual void selectItem(VendingMachine& context, const std::string& itemCode) = 0;
virtual void insertCoin(VendingMachine& context, double amount) = 0;
virtual void dispenseItem(VendingMachine& context) = 0;
};
================================================
FILE: design-patterns/cpp/state/main.cpp
================================================
#include "vending_machine.h"
#include <iostream>
int main() {
VendingMachine machine;
// Test the vending machine workflow
std::cout << "=== Vending Machine Demo ===\n" << std::endl;
// Try to insert coin before selecting item
std::cout << "Attempting to insert coin before selecting item:" << std::endl;
machine.insertCoin(1.0);
// Select an item
std::cout << "\nSelecting item A1:" << std::endl;
machine.selectItem("A1");
// Insert coin
std::cout << "\nInserting coin:" << std::endl;
machine.insertCoin(1.0);
// Try to select another item
std::cout << "\nAttempting to select another item:" << std::endl;
machine.selectItem("B2");
// Insert more money
std::cout << "\nInserting more money:" << std::endl;
machine.insertCoin(0.5);
// Dispense item
std::cout << "\nDispensing item:" << std::endl;
machine.dispenseItem();
// Try to interact after dispensing
std::cout << "\nAttempting to interact after dispensing:" << std::endl;
machine.selectItem("C3");
machine.insertCoin(1.0);
machine.dispenseItem();
return 0;
}
================================================
FILE: design-patterns/cpp/state/vending_machine.cpp
================================================
#include "vending_machine.h"
#include "idle_state.h"
VendingMachine::VendingMachine()
: currentState(std::make_unique<IdleState>())
, selectedItem("")
, insertedAmount(0.0) {}
void VendingMachine::setState(std::unique_ptr<MachineState> newState) {
currentState = std::move(newState);
}
void VendingMachine::setSelectedItem(const std::string& itemCode) {
selectedItem = itemCode;
}
void VendingMachine::setInsertedAmount(double amount) {
insertedAmount = amount;
}
const std::string& VendingMachine::getSelectedItem() const {
return selectedItem;
}
double VendingMachine::getInsertedAmount() const {
return insertedAmount;
}
void VendingMachine::selectItem(const std::string& itemCode) {
currentState->selectItem(*this, itemCode);
}
void VendingMachine::insertCoin(double amount) {
currentState->insertCoin(*this, amount);
}
void VendingMachine::dispenseItem() {
currentState->dispenseItem(*this);
}
void VendingMachine::reset() {
selectedItem = "";
insertedAmount = 0.0;
currentState = std::make_unique<IdleState>();
}
================================================
FILE: design-patterns/cpp/state/vending_machine.h
================================================
#pragma once
#include "machine_state.h"
#include <memory>
#include <string>
class VendingMachine {
public:
VendingMachine();
void setState(std::unique_ptr<MachineState> newState);
void setSelectedItem(const std::string& itemCode);
void setInsertedAmount(double amount);
const std::string& getSelectedItem() const;
double getInsertedAmount() const;
void selectItem(const std::string& itemCode);
void insertCoin(double amount);
void dispenseItem();
void reset();
private:
std::unique_ptr<MachineState> currentState;
std::string selectedItem;
double insertedAmount;
};
================================================
FILE: design-patterns/cpp/strategy/distance_based_shipping.cpp
================================================
#include "distance_based_shipping.h"
#include <iostream>
#include <map>
double DistanceBasedShipping::calculateCost(const Order& order) {
std::cout << "Calculating distance-based shipping cost..." << std::endl;
// Zone-based rates
std::map<std::string, double> zoneRates = {
{"ZoneA", 5.0},
{"ZoneB", 10.0},
{"ZoneC", 15.0}
};
auto it = zoneRates.find(order.getDestinationZone());
if (it != zoneRates.end()) {
return it->second;
}
return 20.0; // Default rate for unknown zones
}
================================================
FILE: design-patterns/cpp/strategy/distance_based_shipping.h
================================================
#pragma once
#include "shipping_strategy.h"
class DistanceBasedShipping : public ShippingStrategy {
public:
double calculateCost(const Order& order) override;
};
================================================
FILE: design-patterns/cpp/strategy/ecommerce_app.cpp
================================================
================================================
FILE: design-patterns/cpp/strategy/flat_rate_shipping.cpp
================================================
#include "flat_rate_shipping.h"
#include <iostream>
double FlatRateShipping::calculateCost(const Order& order) {
std::cout << "Calculating flat rate shipping cost..." << std::endl;
return 10.0; // Fixed rate of $10
}
================================================
FILE: design-patterns/cpp/strategy/flat_rate_shipping.h
================================================
#pragma once
#include "shipping_strategy.h"
class FlatRateShipping : public ShippingStrategy {
public:
double calculateCost(const Order& order) override;
};
================================================
FILE: design-patterns/cpp/strategy/order.h
================================================
#pragma once
#include <string>
class Order {
public:
double getTotalWeight() const { return 5.0; } // kg
std::string getDestinationZone() const { return "ZoneA"; }
double getOrderValue() const { return 150.0; }
// ... other order details
};
================================================
FILE: design-patterns/cpp/strategy/shipping_cost_service.cpp
================================================
#include "shipping_cost_service.h"
ShippingCostService::ShippingCostService(std::unique_ptr<ShippingStrategy> strategy)
: strategy(std::move(strategy)) {}
void ShippingCostService::setStrategy(std::unique_ptr<ShippingStrategy> newStrategy) {
strategy = std::move(newStrategy);
}
double ShippingCostService::calculateShippingCost(const Order& order) {
return strategy->calculateCost(order);
}
================================================
FILE: design-patterns/cpp/strategy/shipping_cost_service.h
================================================
#pragma once
#include "shipping_strategy.h"
#include <memory>
class ShippingCostService {
public:
explicit ShippingCostService(std::unique_ptr<ShippingStrategy> strategy);
void setStrategy(std::unique_ptr<ShippingStrategy> strategy);
double calculateShippingCost(const Order& order);
private:
std::unique_ptr<ShippingStrategy> strategy;
};
================================================
FILE: design-patterns/cpp/strategy/shipping_strategy.h
================================================
#pragma once
#include "order.h"
class ShippingStrategy {
public:
virtual ~ShippingStrategy() = default;
virtual double calculateCost(const Order& order) = 0;
};
================================================
FILE: design-patterns/cpp/strategy/third_party_api_shipping.cpp
================================================
#include "third_party_api_shipping.h"
#include <iostream>
double ThirdPartyApiShipping::calculateCost(const Order& order) {
std::cout << "Calculating shipping cost using third-party API..." << std::endl;
// Simulate API call
return order.getOrderValue() * 0.1; // 10% of order value
}
================================================
FILE: design-patterns/cpp/strategy/third_party_api_shipping.h
================================================
#pragma once
#include "shipping_strategy.h"
class ThirdPartyApiShipping : public ShippingStrategy {
public:
double calculateCost(const Order& order) override;
};
================================================
FILE: design-patterns/cpp/strategy/weight_based_shipping.cpp
================================================
#include "weight_based_shipping.h"
#include <iostream>
double WeightBasedShipping::calculateCost(const Order& order) {
std::cout << "Calculating weight-based shipping cost..." << std::endl;
return order.getTotalWeight() * 2.0; // $2 per kg
}
================================================
FILE: design-patterns/cpp/strategy/weight_based_shipping.h
================================================
#pragma once
#include "shipping_strategy.h"
class WeightBasedShipping : public ShippingStrategy {
public:
double calculateCost(const Order& order) override;
};
================================================
FILE: design-patterns/cpp/templatemethod/CMakeLists.txt
================================================
================================================
FILE: design-patterns/cpp/templatemethod/abstract_report_exporter.cpp
================================================
#include "abstract_report_exporter.h"
#include <iostream>
void AbstractReportExporter::exportReport(const ReportData& data, const std::string& filePath) {
prepareData(data);
openFile(filePath);
writeHeader(data);
writeDataRows(data);
writeFooter(data);
closeFile(filePath);
std::cout << "Report exported to " << filePath << std::endl;
}
void AbstractReportExporter::prepareData(const ReportData& data) {
std::cout << "Preparing report data..." << std::endl;
}
void AbstractReportExporter::openFile(const std::string& filePath) {
std::cout << "Opening file: " << filePath << std::endl;
}
void AbstractReportExporter::writeFooter(const ReportData& data) {
std::cout << "Writing footer..." << std::endl;
}
void AbstractReportExporter::closeFile(const std::string& filePath) {
std::cout << "Closing file: " << filePath << std::endl;
}
================================================
FILE: design-patterns/cpp/templatemethod/abstract_report_exporter.h
================================================
#pragma once
#include "report_data.h"
#include <string>
class AbstractReportExporter {
public:
virtual ~AbstractReportExporter() = default;
// Template method
void exportReport(const ReportData& data, const std::string& filePath);
protected:
// Hook methods - optional for subclasses to override
virtual void prepareData(const ReportData& data);
virtual void openFile(const std::string& filePath);
virtual void writeHeader(const ReportData& data) = 0;
virtual void writeDataRows(const ReportData& data) = 0;
virtual void writeFooter(const ReportData& data);
virtual void closeFile(const std::string& filePath);
};
================================================
FILE: design-patterns/cpp/templatemethod/csv_report_exporter.cpp
================================================
#include "csv_report_exporter.h"
#include <iostream>
#include <sstream>
void CsvReportExporter::writeHeader(const ReportData& data) {
std::cout << "Writing CSV header..." << std::endl;
const auto& headers = data.getHeaders();
for (size_t i = 0; i < headers.size(); ++i) {
std::cout << headers[i];
if (i < headers.size() - 1) {
std::cout << ",";
}
}
std::cout << std::endl;
}
void CsvReportExporter::writeDataRows(const ReportData& data) {
std::cout << "Writing CSV data rows..." << std::endl;
for (const auto& row : data.getRows()) {
for (const auto& header : data.getHeaders()) {
const auto& value = row.at(header);
std::visit([](const auto& v) { std::cout << v; }, value);
if (&header != &data.getHeaders().back()) {
std::cout << ",";
}
}
std::cout << std::en
gitextract_z31mpvc2/
├── .gitignore
├── LICENSE
├── README.md
├── design-patterns/
│ ├── Javascript/
│ │ ├── Behavioral Pattern/
│ │ │ ├── Chain of Responsibilites/
│ │ │ │ ├── main.js
│ │ │ │ └── supportRequest.js
│ │ │ ├── Command Design Pattern/
│ │ │ │ ├── command.js
│ │ │ │ ├── invoker.js
│ │ │ │ ├── main.js
│ │ │ │ └── receiver.js
│ │ │ ├── Iterator Design Pattern/
│ │ │ │ ├── aggregate.js
│ │ │ │ ├── book.js
│ │ │ │ ├── iterator.js
│ │ │ │ └── main.js
│ │ │ ├── Mediator Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── mediator.js
│ │ │ │ └── user.js
│ │ │ ├── Memento Design Pattern/
│ │ │ │ ├── Example2/
│ │ │ │ │ ├── canvas.js
│ │ │ │ │ ├── careTaker.js
│ │ │ │ │ ├── main.js
│ │ │ │ │ └── memento.js
│ │ │ │ ├── careTaker.js
│ │ │ │ ├── main.js
│ │ │ │ ├── memento.js
│ │ │ │ └── orginator.js
│ │ │ ├── Observer Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── observer.js
│ │ │ │ └── publisher.js
│ │ │ ├── State Design Pattern/
│ │ │ │ ├── context.js
│ │ │ │ ├── main.js
│ │ │ │ └── state.js
│ │ │ ├── Strategy Design Pattern/
│ │ │ │ ├── main.js
│ │ │ │ ├── paymentStrategy.js
│ │ │ │ └── shoppingCart_Context.js
│ │ │ ├── Template Design Pattern/
│ │ │ │ ├── beverages.js
│ │ │ │ ├── beveragesTypes.js
│ │ │ │ └── main.js
│ │ │ └── Visitor Design Pattern/
│ │ │ ├── element.js
│ │ │ ├── main.js
│ │ │ └── visitor.js
│ │ ├── Creational Pattern/
│ │ │ ├── AbstractFactory Design Pattern/
│ │ │ │ ├── abstract.js
│ │ │ │ └── main.js
│ │ │ ├── Builder Design Pattern/
│ │ │ │ ├── app.js
│ │ │ │ └── computerBuilder.js
│ │ │ ├── Factory Design Pattern/
│ │ │ │ ├── factory.js
│ │ │ │ ├── main.js
│ │ │ │ └── pizza.js
│ │ │ ├── Prototype Design Pattern/
│ │ │ │ └── app.js
│ │ │ └── Singleton Design Pattern/
│ │ │ ├── app.js
│ │ │ └── singleton.js
│ │ └── Structural Pattern/
│ │ ├── Adapter Design Pattern/
│ │ │ ├── adapter.js
│ │ │ ├── main.js
│ │ │ ├── usbA_connector.js
│ │ │ └── usbC_device.js
│ │ ├── Bridge Design Pattern/
│ │ │ ├── device.js
│ │ │ ├── main.js
│ │ │ └── remoteControl.js
│ │ ├── Composite Design Pattern/
│ │ │ ├── app.js
│ │ │ ├── component.js
│ │ │ ├── file.js
│ │ │ └── folder.js
│ │ ├── Decorator Design Pattern/
│ │ │ ├── additional.js
│ │ │ ├── coffee.js
│ │ │ └── main.js
│ │ ├── Facade Design Pattern/
│ │ │ ├── dvdPlayer.js
│ │ │ ├── lights.js
│ │ │ ├── main.js
│ │ │ ├── movieFacade.js
│ │ │ ├── projector.js
│ │ │ ├── snacks.js
│ │ │ └── soundSystem.js
│ │ ├── Flyweight Design Pattern/
│ │ │ ├── circle.js
│ │ │ ├── circleFactory.js
│ │ │ └── main.js
│ │ └── Proxy Design Pattern/
│ │ ├── main.js
│ │ ├── proxyImage.js
│ │ └── real_Image.js
│ ├── cpp/
│ │ ├── adapter/
│ │ │ ├── in_house_payment_processor.cpp
│ │ │ ├── in_house_payment_processor.h
│ │ │ ├── legacy_gateway.cpp
│ │ │ ├── legacy_gateway.h
│ │ │ ├── legacy_gateway_adapter.cpp
│ │ │ ├── legacy_gateway_adapter.h
│ │ │ ├── main.cpp
│ │ │ └── payment_processor.h
│ │ ├── bridge/
│ │ │ ├── circle.cpp
│ │ │ ├── circle.h
│ │ │ ├── main.cpp
│ │ │ ├── raster_renderer.cpp
│ │ │ ├── raster_renderer.h
│ │ │ ├── rectangle.cpp
│ │ │ ├── rectangle.h
│ │ │ ├── renderer.h
│ │ │ ├── shape.cpp
│ │ │ ├── shape.h
│ │ │ ├── vector_renderer.cpp
│ │ │ └── vector_renderer.h
│ │ ├── builder/
│ │ │ ├── http_request.cpp
│ │ │ ├── http_request.h
│ │ │ ├── http_request_builder.cpp
│ │ │ ├── http_request_builder.h
│ │ │ └── main.cpp
│ │ ├── chainofresponsibility/
│ │ │ ├── auth_handler.h
│ │ │ ├── authorization_handler.h
│ │ │ ├── base_handler.cpp
│ │ │ ├── base_handler.h
│ │ │ ├── business_logic_handler.h
│ │ │ ├── main.cpp
│ │ │ ├── rate_limit_handler.h
│ │ │ ├── request.cpp
│ │ │ ├── request.h
│ │ │ ├── request_handler.h
│ │ │ └── validation_handler.h
│ │ ├── composite/
│ │ │ ├── file.cpp
│ │ │ ├── file.h
│ │ │ ├── file_system_item.h
│ │ │ ├── folder.cpp
│ │ │ ├── folder.h
│ │ │ └── main.cpp
│ │ ├── decorator/
│ │ │ ├── bold_decorator.cpp
│ │ │ ├── bold_decorator.h
│ │ │ ├── italic_decorator.cpp
│ │ │ ├── italic_decorator.h
│ │ │ ├── main.cpp
│ │ │ ├── plain_text_view.cpp
│ │ │ ├── plain_text_view.h
│ │ │ ├── text_decorator.cpp
│ │ │ ├── text_decorator.h
│ │ │ ├── text_view.h
│ │ │ ├── underline_decorator.cpp
│ │ │ └── underline_decorator.h
│ │ ├── facade/
│ │ │ ├── build_system.cpp
│ │ │ ├── build_system.h
│ │ │ ├── deployment_facade.cpp
│ │ │ ├── deployment_facade.h
│ │ │ ├── deployment_target.cpp
│ │ │ ├── deployment_target.h
│ │ │ ├── main.cpp
│ │ │ ├── testing_framework.cpp
│ │ │ ├── testing_framework.h
│ │ │ ├── version_control_system.cpp
│ │ │ └── version_control_system.h
│ │ ├── factory/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── email_notification.cpp
│ │ │ ├── email_notification.h
│ │ │ ├── main.cpp
│ │ │ ├── notification.h
│ │ │ ├── notification_factory.cpp
│ │ │ ├── notification_factory.h
│ │ │ ├── push_notification.cpp
│ │ │ ├── push_notification.h
│ │ │ ├── sms_notification.cpp
│ │ │ └── sms_notification.h
│ │ ├── flyweight/
│ │ │ ├── circle.cpp
│ │ │ ├── circle.h
│ │ │ ├── main.cpp
│ │ │ ├── shape.h
│ │ │ ├── shape_factory.cpp
│ │ │ └── shape_factory.h
│ │ ├── iterator/
│ │ │ ├── container.h
│ │ │ ├── iterator.h
│ │ │ ├── main.cpp
│ │ │ ├── name_iterator.cpp
│ │ │ ├── name_iterator.h
│ │ │ ├── name_repository.cpp
│ │ │ └── name_repository.h
│ │ ├── mediator/
│ │ │ ├── button.cpp
│ │ │ ├── button.h
│ │ │ ├── form_mediator.cpp
│ │ │ ├── form_mediator.h
│ │ │ ├── label.cpp
│ │ │ ├── label.h
│ │ │ ├── main.cpp
│ │ │ ├── text_field.cpp
│ │ │ ├── text_field.h
│ │ │ ├── ui_component.cpp
│ │ │ ├── ui_component.h
│ │ │ └── ui_mediator.h
│ │ ├── memento/
│ │ │ ├── main.cpp
│ │ │ ├── text_editor.cpp
│ │ │ ├── text_editor.h
│ │ │ ├── text_editor_memento.cpp
│ │ │ ├── text_editor_memento.h
│ │ │ ├── text_editor_undo_manager.cpp
│ │ │ └── text_editor_undo_manager.h
│ │ ├── observer/
│ │ │ ├── fitness_data.cpp
│ │ │ ├── fitness_data.h
│ │ │ ├── fitness_data_observer.h
│ │ │ ├── fitness_data_subject.h
│ │ │ ├── goal_notifier.cpp
│ │ │ ├── goal_notifier.h
│ │ │ ├── live_activity_display.cpp
│ │ │ ├── live_activity_display.h
│ │ │ ├── main.cpp
│ │ │ ├── progress_logger.cpp
│ │ │ └── progress_logger.h
│ │ ├── prototype/
│ │ │ ├── enemy.cpp
│ │ │ ├── enemy.h
│ │ │ ├── enemy_prototype.h
│ │ │ ├── enemy_registry.cpp
│ │ │ ├── enemy_registry.h
│ │ │ └── main.cpp
│ │ ├── proxy/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── high_resolution_image.cpp
│ │ │ ├── high_resolution_image.h
│ │ │ ├── image.h
│ │ │ ├── image_gallery_app_v1.cpp
│ │ │ ├── image_gallery_app_v2.cpp
│ │ │ ├── image_proxy.cpp
│ │ │ └── image_proxy.h
│ │ ├── singleton/
│ │ │ ├── double_checked_singleton.cpp
│ │ │ ├── double_checked_singleton.h
│ │ │ ├── eager_singleton.cpp
│ │ │ ├── eager_singleton.h
│ │ │ ├── lazy_singleton.cpp
│ │ │ ├── lazy_singleton.h
│ │ │ ├── main.cpp
│ │ │ ├── thread_safe_singleton.cpp
│ │ │ └── thread_safe_singleton.h
│ │ ├── state/
│ │ │ ├── dispensing_state.cpp
│ │ │ ├── dispensing_state.h
│ │ │ ├── has_money_state.cpp
│ │ │ ├── has_money_state.h
│ │ │ ├── idle_state.cpp
│ │ │ ├── idle_state.h
│ │ │ ├── item_selected_state.cpp
│ │ │ ├── item_selected_state.h
│ │ │ ├── machine_state.h
│ │ │ ├── main.cpp
│ │ │ ├── vending_machine.cpp
│ │ │ └── vending_machine.h
│ │ ├── strategy/
│ │ │ ├── distance_based_shipping.cpp
│ │ │ ├── distance_based_shipping.h
│ │ │ ├── ecommerce_app.cpp
│ │ │ ├── flat_rate_shipping.cpp
│ │ │ ├── flat_rate_shipping.h
│ │ │ ├── order.h
│ │ │ ├── shipping_cost_service.cpp
│ │ │ ├── shipping_cost_service.h
│ │ │ ├── shipping_strategy.h
│ │ │ ├── third_party_api_shipping.cpp
│ │ │ ├── third_party_api_shipping.h
│ │ │ ├── weight_based_shipping.cpp
│ │ │ └── weight_based_shipping.h
│ │ └── templatemethod/
│ │ ├── CMakeLists.txt
│ │ ├── abstract_report_exporter.cpp
│ │ ├── abstract_report_exporter.h
│ │ ├── csv_report_exporter.cpp
│ │ ├── csv_report_exporter.h
│ │ ├── excel_report_exporter.cpp
│ │ ├── excel_report_exporter.h
│ │ ├── pdf_report_exporter.cpp
│ │ ├── pdf_report_exporter.h
│ │ ├── report_app.cpp
│ │ ├── report_data.cpp
│ │ └── report_data.h
│ ├── csharp/
│ │ ├── adapter/
│ │ │ ├── CheckoutService.cs
│ │ │ ├── IPaymentProcessor.cs
│ │ │ ├── InHousePaymentProcessor.cs
│ │ │ ├── LegacyGateway.cs
│ │ │ ├── LegacyGatewayAdapter.cs
│ │ │ └── Program.cs
│ │ ├── bridge/
│ │ │ ├── Circle.cs
│ │ │ ├── IRenderer.cs
│ │ │ ├── Program.cs
│ │ │ ├── RasterRenderer.cs
│ │ │ ├── Rectangle.cs
│ │ │ ├── Shape.cs
│ │ │ └── VectorRenderer.cs
│ │ ├── builder/
│ │ │ ├── HttpRequest.cs
│ │ │ └── Program.cs
│ │ ├── chainofresponsibility/
│ │ │ ├── AuthHandler.cs
│ │ │ ├── AuthorizationHandler.cs
│ │ │ ├── BaseHandler.cs
│ │ │ ├── BusinessLogicHandler.cs
│ │ │ ├── IRequestHandler.cs
│ │ │ ├── Program.cs
│ │ │ ├── RateLimitHandler.cs
│ │ │ ├── Request.cs
│ │ │ └── ValidationHandler.cs
│ │ ├── composite/
│ │ │ ├── File.cs
│ │ │ ├── Folder.cs
│ │ │ ├── IFileSystemItem.cs
│ │ │ └── Program.cs
│ │ ├── decorator/
│ │ │ ├── BoldDecorator.cs
│ │ │ ├── ITextView.cs
│ │ │ ├── ItalicDecorator.cs
│ │ │ ├── PlainTextView.cs
│ │ │ ├── Program.cs
│ │ │ ├── TextDecorator.cs
│ │ │ └── UnderlineDecorator.cs
│ │ ├── facade/
│ │ │ ├── BuildSystem.cs
│ │ │ ├── DeploymentFacade.cs
│ │ │ ├── DeploymentTarget.cs
│ │ │ ├── Program.cs
│ │ │ ├── TestingFramework.cs
│ │ │ └── VersionControlSystem.cs
│ │ ├── factory/
│ │ │ ├── EmailNotification.cs
│ │ │ ├── INotification.cs
│ │ │ ├── NotificationServiceNaive.cs
│ │ │ ├── Program.cs
│ │ │ ├── PushNotification.cs
│ │ │ ├── SMSNotification.cs
│ │ │ └── SimpleNotificationFactory.cs
│ │ ├── flyweight/
│ │ │ ├── CharacterFlyweightFactory.cs
│ │ │ ├── CharacterGlyph.cs
│ │ │ ├── ICharacterFlyweight.cs
│ │ │ ├── Program.cs
│ │ │ └── TextEditorClient.cs
│ │ ├── iterator/
│ │ │ ├── IIterableCollection.cs
│ │ │ ├── IIterator.cs
│ │ │ ├── Playlist.cs
│ │ │ ├── PlaylistIterator.cs
│ │ │ └── Program.cs
│ │ ├── mediator/
│ │ │ ├── Button.cs
│ │ │ ├── FormMediator.cs
│ │ │ ├── IUIMediator.cs
│ │ │ ├── Label.cs
│ │ │ ├── Program.cs
│ │ │ ├── TextField.cs
│ │ │ └── UIComponent.cs
│ │ ├── memento/
│ │ │ ├── Program.cs
│ │ │ ├── TextEditor.cs
│ │ │ ├── TextEditorMemento.cs
│ │ │ └── TextEditorUndoManager.cs
│ │ ├── observer/
│ │ │ ├── FitnessData.cs
│ │ │ ├── GoalNotifier.cs
│ │ │ ├── IFitnessDataObserver.cs
│ │ │ ├── IFitnessDataSubject.cs
│ │ │ ├── LiveActivityDisplay.cs
│ │ │ ├── Program.cs
│ │ │ └── ProgressLogger.cs
│ │ ├── prototype/
│ │ │ ├── Enemy.cs
│ │ │ ├── EnemyRegistry.cs
│ │ │ ├── Game.cs
│ │ │ └── IEnemyPrototype.cs
│ │ ├── proxy/
│ │ │ ├── HighResolutionImage.cs
│ │ │ ├── IImage.cs
│ │ │ ├── ImageGalleryApp.cs
│ │ │ └── ImageProxy.cs
│ │ ├── singleton/
│ │ │ ├── BillPughSingleton.cs
│ │ │ ├── DoubleCheckedLockingSingleton.cs
│ │ │ ├── EagerSingleton.cs
│ │ │ ├── LazySingleton.cs
│ │ │ ├── SingletonDemo.cs
│ │ │ ├── StaticBlockSingleton.cs
│ │ │ └── ThreadSafeSingleton.cs
│ │ ├── state/
│ │ │ ├── DispensingState.cs
│ │ │ ├── HasMoneyState.cs
│ │ │ ├── IMachineState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── ItemSelectedState.cs
│ │ │ ├── Program.cs
│ │ │ └── VendingMachine.cs
│ │ ├── strategy/
│ │ │ ├── DistanceBasedShipping.cs
│ │ │ ├── FlatRateShipping.cs
│ │ │ ├── IShippingStrategy.cs
│ │ │ ├── Order.cs
│ │ │ ├── Program.cs
│ │ │ ├── ShippingCostService.cs
│ │ │ ├── ThirdPartyApiShipping.cs
│ │ │ └── WeightBasedShipping.cs
│ │ └── templatemethod/
│ │ ├── AbstractReportExporter.cs
│ │ ├── CsvReportExporter.cs
│ │ ├── ExcelReportExporter.cs
│ │ ├── PdfReportExporter.cs
│ │ ├── Program.cs
│ │ └── ReportData.cs
│ ├── golang/
│ │ ├── adapter/
│ │ │ ├── checkout_service.go
│ │ │ ├── go.mod
│ │ │ ├── in_house_payment_processor.go
│ │ │ ├── legacy_gateway.go
│ │ │ ├── legacy_gateway_adapter.go
│ │ │ ├── main.go
│ │ │ └── payment_processor.go
│ │ ├── bridge/
│ │ │ ├── circle.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── raster_renderer.go
│ │ │ ├── rectangle.go
│ │ │ ├── renderer.go
│ │ │ ├── shape.go
│ │ │ └── vector_renderer.go
│ │ ├── builder/
│ │ │ ├── go.mod
│ │ │ ├── http_request.go
│ │ │ ├── http_request_builder.go
│ │ │ └── main.go
│ │ ├── chainofresponsibility/
│ │ │ ├── authentication_handler.go
│ │ │ ├── authorization_handler.go
│ │ │ ├── base_handler.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── request.go
│ │ │ ├── request_handler.go
│ │ │ └── validation_handler.go
│ │ ├── composite/
│ │ │ ├── file.go
│ │ │ ├── file_system_item.go
│ │ │ ├── folder.go
│ │ │ ├── go.mod
│ │ │ └── main.go
│ │ ├── decorator/
│ │ │ ├── beverage.go
│ │ │ ├── beverage_decorator.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── milk_decorator.go
│ │ │ ├── simple_coffee.go
│ │ │ └── sugar_decorator.go
│ │ ├── facade/
│ │ │ ├── build_system.go
│ │ │ ├── deployment_facade.go
│ │ │ ├── deployment_target.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── testing_framework.go
│ │ │ └── version_control_system.go
│ │ ├── factory/
│ │ │ ├── email_notification.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── notification.go
│ │ │ ├── push_notification.go
│ │ │ ├── simple_notification_factory.go
│ │ │ └── sms_notification.go
│ │ ├── flyweight/
│ │ │ ├── character_flyweight.go
│ │ │ ├── character_flyweight_factory.go
│ │ │ ├── character_glyph.go
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ └── text_editor_client.go
│ │ ├── iterator/
│ │ │ ├── book.go
│ │ │ ├── book_collection.go
│ │ │ ├── collection.go
│ │ │ ├── go.mod
│ │ │ ├── iterator.go
│ │ │ └── main.go
│ │ ├── mediator/
│ │ │ ├── chat_mediator.go
│ │ │ ├── colleague.go
│ │ │ ├── main.go
│ │ │ ├── mediator.go
│ │ │ └── user.go
│ │ ├── memento/
│ │ │ ├── go.mod
│ │ │ ├── main.go
│ │ │ ├── text_editor.go
│ │ │ ├── text_editor_memento.go
│ │ │ └── text_editor_undo_manager.go
│ │ ├── observer/
│ │ │ ├── fitness_data.go
│ │ │ ├── fitness_data_observer.go
│ │ │ ├── fitness_data_subject.go
│ │ │ ├── go.mod
│ │ │ ├── goal_notifier.go
│ │ │ ├── live_activity_display.go
│ │ │ ├── main.go
│ │ │ └── progress_logger.go
│ │ ├── prototype/
│ │ │ ├── enemy.go
│ │ │ ├── enemy_prototype.go
│ │ │ ├── enemy_registry.go
│ │ │ ├── go.mod
│ │ │ └── main.go
│ │ ├── proxy/
│ │ │ ├── go.mod
│ │ │ ├── high_resolution_image.go
│ │ │ ├── image.go
│ │ │ ├── image_proxy.go
│ │ │ └── main.go
│ │ ├── singleton/
│ │ │ ├── double_checked_singleton.go
│ │ │ ├── eager_singleton.go
│ │ │ ├── go.mod
│ │ │ ├── lazy_singleton.go
│ │ │ ├── main.go
│ │ │ └── thread_safe_singleton.go
│ │ ├── state/
│ │ │ ├── go.mod
│ │ │ ├── has_money_state.go
│ │ │ ├── idle_state.go
│ │ │ ├── item_selected_state.go
│ │ │ ├── machine_state.go
│ │ │ ├── main.go
│ │ │ └── vending_machine.go
│ │ ├── strategy/
│ │ │ ├── credit_card_payment.go
│ │ │ ├── main.go
│ │ │ ├── payment_strategy.go
│ │ │ ├── paypal_payment.go
│ │ │ └── shopping_cart.go
│ │ └── templatemethod/
│ │ ├── csv_data_processor.go
│ │ ├── data_processor.go
│ │ ├── main.go
│ │ └── xml_data_processor.go
│ ├── java/
│ │ ├── abstractfactory/
│ │ │ ├── AppLauncher.java
│ │ │ ├── Application.java
│ │ │ ├── Button.java
│ │ │ ├── Checkbox.java
│ │ │ ├── GUIFactory.java
│ │ │ ├── MacOSButton.java
│ │ │ ├── MacOSCheckbox.java
│ │ │ ├── MacOSFactory.java
│ │ │ ├── WindowsButton.java
│ │ │ ├── WindowsCheckbox.java
│ │ │ ├── WindowsFactory.java
│ │ │ └── shoefactory/
│ │ │ ├── BumpySole.java
│ │ │ ├── CasualShoeFactory.java
│ │ │ ├── FlatSole.java
│ │ │ ├── FormalShoeFactory.java
│ │ │ ├── RoundShoeLace.java
│ │ │ ├── Shoe.java
│ │ │ ├── ShoeFactory.java
│ │ │ ├── ShoeLace.java
│ │ │ ├── ShoeManufacture.java
│ │ │ ├── Sole.java
│ │ │ ├── SportsShoeFactory.java
│ │ │ ├── TapeShoeLace.java
│ │ │ └── ThinSole.java
│ │ ├── adapter/
│ │ │ ├── CheckoutService.java
│ │ │ ├── ECommerceAppV1.java
│ │ │ ├── ECommerceAppV2.java
│ │ │ ├── InHousePaymentProcessor.java
│ │ │ ├── LegacyGateway.java
│ │ │ ├── LegacyGatewayAdapter.java
│ │ │ └── PaymentProcessor.java
│ │ ├── bridge/
│ │ │ ├── BridgeDemo.java
│ │ │ ├── Circle.java
│ │ │ ├── RasterRenderer.java
│ │ │ ├── Rectangle.java
│ │ │ ├── Renderer.java
│ │ │ ├── Shape.java
│ │ │ └── VectorRenderer.java
│ │ ├── builder/
│ │ │ ├── HttpAppBuilder.java
│ │ │ ├── HttpAppTelescoping.java
│ │ │ ├── HttpRequest.java
│ │ │ └── HttpRequestTelescoping.java
│ │ ├── chainofresponsibility/
│ │ │ ├── AuthHandler.java
│ │ │ ├── AuthorizationHandler.java
│ │ │ ├── BaseHandler.java
│ │ │ ├── BusinessLogicHandler.java
│ │ │ ├── RateLimitHandler.java
│ │ │ ├── Request.java
│ │ │ ├── RequestHandler.java
│ │ │ ├── RequestHandlerV1.java
│ │ │ ├── RequestHandlerV2.java
│ │ │ └── ValidationHandler.java
│ │ ├── command/
│ │ │ ├── Command.java
│ │ │ ├── CommandPatternDemo.java
│ │ │ ├── Light.java
│ │ │ ├── LightOffCommand.java
│ │ │ ├── LightOnCommand.java
│ │ │ ├── SetTemperatureCommand.java
│ │ │ ├── SmartButton.java
│ │ │ └── Thermostat.java
│ │ ├── composite/
│ │ │ ├── filesystem/
│ │ │ │ ├── File.java
│ │ │ │ ├── FileExplorerApp.java
│ │ │ │ ├── FileSystemItem.java
│ │ │ │ └── Folder.java
│ │ │ └── organization/
│ │ │ ├── CompositeDemo.java
│ │ │ ├── Designer.java
│ │ │ ├── Developer.java
│ │ │ ├── Employee.java
│ │ │ └── Manager.java
│ │ ├── decorator/
│ │ │ ├── BoldDecorator.java
│ │ │ ├── DecoratorDemo.java
│ │ │ ├── ItalicDecorator.java
│ │ │ ├── PlainTextView.java
│ │ │ ├── TextDecorator.java
│ │ │ ├── TextView.java
│ │ │ ├── UnderlineDecorator.java
│ │ │ └── coffee/
│ │ │ ├── Coffee.java
│ │ │ ├── CoffeeDecorator.java
│ │ │ ├── DecoratorDemo.java
│ │ │ ├── Milk.java
│ │ │ ├── SimpleCoffee.java
│ │ │ └── Sugar.java
│ │ ├── facade/
│ │ │ ├── BuildSystem.java
│ │ │ ├── DeploymentAppDirect.java
│ │ │ ├── DeploymentAppFacade.java
│ │ │ ├── DeploymentFacade.java
│ │ │ ├── DeploymentOrchestrator.java
│ │ │ ├── DeploymentTarget.java
│ │ │ ├── TestingFramework.java
│ │ │ └── VersionControlSystem.java
│ │ ├── factory/
│ │ │ ├── notification/
│ │ │ │ ├── EmailNotification.java
│ │ │ │ ├── EmailNotificationCreator.java
│ │ │ │ ├── FactoryMethodDemo.java
│ │ │ │ ├── Notification.java
│ │ │ │ ├── NotificationCreator.java
│ │ │ │ ├── NotificationServiceNaive.java
│ │ │ │ ├── PushNotification.java
│ │ │ │ ├── PushNotificationCreator.java
│ │ │ │ ├── SMSNotification.java
│ │ │ │ ├── SMSNotificationCreator.java
│ │ │ │ └── SimpleNotificationFactory.java
│ │ │ └── subscription/
│ │ │ ├── Customer.java
│ │ │ ├── DataBase.java
│ │ │ ├── FactoryApplication.java
│ │ │ ├── Gold.java
│ │ │ ├── Platinum.java
│ │ │ ├── RoyalGold.java
│ │ │ ├── Silver.java
│ │ │ ├── Subscription.java
│ │ │ └── SubscriptionFactory.java
│ │ ├── flyweight/
│ │ │ ├── CharacterFlyweight.java
│ │ │ ├── CharacterFlyweightFactory.java
│ │ │ ├── CharacterGlyph.java
│ │ │ ├── FlyweightDemo.java
│ │ │ └── TextEditorClient.java
│ │ ├── iterator/
│ │ │ ├── IterableCollection.java
│ │ │ ├── Iterator.java
│ │ │ ├── MusicPlayer.java
│ │ │ ├── Playlist.java
│ │ │ ├── PlaylistIterator.java
│ │ │ └── books/
│ │ │ ├── Book.java
│ │ │ ├── BookShelf.java
│ │ │ ├── Container.java
│ │ │ ├── Iterator.java
│ │ │ └── IteratorDemo.java
│ │ ├── mediator/
│ │ │ ├── Button.java
│ │ │ ├── FormMediator.java
│ │ │ ├── Label.java
│ │ │ ├── MediatorApp.java
│ │ │ ├── TextField.java
│ │ │ ├── UIComponent.java
│ │ │ └── UIMediator.java
│ │ ├── memento/
│ │ │ ├── TextEditor.java
│ │ │ ├── TextEditorMemento.java
│ │ │ ├── TextEditorNaive.java
│ │ │ ├── TextEditorUndoManager.java
│ │ │ ├── TextEditorUndoV1.java
│ │ │ └── TextEditorUndoV2.java
│ │ ├── observer/
│ │ │ ├── FitnessAppNaiveClient.java
│ │ │ ├── FitnessAppObserverDemo.java
│ │ │ ├── FitnessData.java
│ │ │ ├── FitnessDataNaive.java
│ │ │ ├── FitnessDataObserver.java
│ │ │ ├── FitnessDataSubject.java
│ │ │ ├── GoalNotifier.java
│ │ │ ├── LiveActivityDisplay.java
│ │ │ ├── LiveActivityDisplayNaive.java
│ │ │ ├── NotificationServiceNaive.java
│ │ │ ├── ProgressLogger.java
│ │ │ └── ProgressLoggerNaive.java
│ │ ├── prototype/
│ │ │ ├── Enemy.java
│ │ │ ├── EnemyPrototype.java
│ │ │ ├── EnemyRegistry.java
│ │ │ └── Game.java
│ │ ├── proxy/
│ │ │ ├── HighResolutionImage.java
│ │ │ ├── Image.java
│ │ │ ├── ImageGalleryAppV1.java
│ │ │ ├── ImageGalleryAppV2.java
│ │ │ └── ImageProxy.java
│ │ ├── singleton/
│ │ │ ├── BillPughSingleton.java
│ │ │ ├── DoubleCheckedLockingSingleton.java
│ │ │ ├── EagerSingleton.java
│ │ │ ├── EnumSingleton.java
│ │ │ ├── LazySingleton.java
│ │ │ ├── StaticBlockSingleton.java
│ │ │ └── ThreadSafeSingleton.java
│ │ ├── state/
│ │ │ ├── DispensingState.java
│ │ │ ├── HasMoneyState.java
│ │ │ ├── IdleState.java
│ │ │ ├── ItemSelectedState.java
│ │ │ ├── MachineState.java
│ │ │ ├── VendingMachine.java
│ │ │ ├── VendingMachineApp.java
│ │ │ └── VendingMachineNaive.java
│ │ ├── strategy/
│ │ │ ├── DistanceBasedShipping.java
│ │ │ ├── ECommerceAppV1.java
│ │ │ ├── ECommerceAppV2.java
│ │ │ ├── FlatRateShipping.java
│ │ │ ├── Order.java
│ │ │ ├── ShippingCostCalculatorNaive.java
│ │ │ ├── ShippingCostService.java
│ │ │ ├── ShippingStrategy.java
│ │ │ ├── ThirdPartyApiShipping.java
│ │ │ └── WeightBasedShipping.java
│ │ ├── templatemethod/
│ │ │ ├── AbstractReportExporter.java
│ │ │ ├── CsvReportExporter.java
│ │ │ ├── CsvReportExporterNaive.java
│ │ │ ├── ExcelReportExporter.java
│ │ │ ├── ExcelReportExporterNaive.java
│ │ │ ├── PdfReportExporter.java
│ │ │ ├── PdfReportExporterNaive.java
│ │ │ ├── ReportAppNaive.java
│ │ │ ├── ReportAppTemplateMethod.java
│ │ │ └── ReportData.java
│ │ └── visitor/
│ │ ├── AreaCalculatorVisitor.java
│ │ ├── Circle.java
│ │ ├── Rectangle.java
│ │ ├── Shape.java
│ │ ├── ShapeVisitor.java
│ │ ├── SvgExporterVisitor.java
│ │ └── VisitorPatternDemo.java
│ └── python/
│ ├── README.md
│ └── adapter/
│ └── README.md
├── oop/
│ ├── cpp/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── csharp/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── golang/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── java/
│ │ ├── AggregationVsComposition/
│ │ │ └── README.MD
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ ├── python/
│ │ ├── abstraction/
│ │ │ └── README.md
│ │ ├── aggregation/
│ │ │ └── README.md
│ │ ├── association/
│ │ │ └── README.md
│ │ ├── classesandobjects/
│ │ │ └── README.md
│ │ ├── composition/
│ │ │ └── README.md
│ │ ├── encapsulation/
│ │ │ └── README.md
│ │ ├── inheritance/
│ │ │ └── README.md
│ │ ├── interfaces/
│ │ │ └── README.md
│ │ └── polymorphism/
│ │ └── README.md
│ └── rust/
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── abstraction/
│ │ ├── README.md
│ │ └── main.rs
│ ├── aggregation/
│ │ ├── README.md
│ │ └── main.rs
│ ├── association/
│ │ ├── README.md
│ │ └── main.rs
│ ├── classes_and_objects/
│ │ ├── README.md
│ │ └── main.rs
│ ├── composition/
│ │ ├── README.md
│ │ └── main.rs
│ ├── encapsulation/
│ │ ├── README.md
│ │ └── main.rs
│ ├── inheritance/
│ │ ├── README.md
│ │ └── main.rs
│ ├── interfaces/
│ │ ├── README.md
│ │ └── main.rs
│ └── polymorphism/
│ ├── README.md
│ └── main.rs
├── problems/
│ ├── airline-management-system.md
│ ├── atm.md
│ ├── car-rental-system.md
│ ├── chess-game.md
│ ├── coffee-vending-machine.md
│ ├── concert-ticket-booking-system.md
│ ├── course-registration-system.md
│ ├── cricinfo.md
│ ├── digital-wallet-service.md
│ ├── elevator-system.md
│ ├── food-delivery-service.md
│ ├── hotel-management-system.md
│ ├── library-management-system.md
│ ├── linkedin.md
│ ├── logging-framework.md
│ ├── lru-cache.md
│ ├── movie-ticket-booking-system.md
│ ├── music-streaming-service.md
│ ├── online-auction-system.md
│ ├── online-shopping-service.md
│ ├── online-stock-brokerage-system.md
│ ├── parking-lot.md
│ ├── pub-sub-system.md
│ ├── restaurant-management-system.md
│ ├── ride-sharing-service.md
│ ├── snake-and-ladder.md
│ ├── social-networking-service.md
│ ├── splitwise.md
│ ├── stack-overflow.md
│ ├── task-management-system.md
│ ├── tic-tac-toe.md
│ ├── traffic-signal.md
│ └── vending-machine.md
└── solutions/
├── cpp/
│ ├── airlinemanagementsystem/
│ │ ├── AirlineManagementSystem.cpp
│ │ ├── AirlineManagementSystem.hpp
│ │ ├── AirlineManagementSystemDemo.cpp
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── Flight.cpp
│ │ ├── Flight.hpp
│ │ ├── Passenger.cpp
│ │ ├── Passenger.hpp
│ │ ├── README.md
│ │ ├── Seat.cpp
│ │ ├── Seat.hpp
│ │ └── airline_system
│ ├── atm/
│ │ ├── ATM.cpp
│ │ ├── ATM.hpp
│ │ ├── ATMDemo.cpp
│ │ ├── Account.cpp
│ │ ├── Account.hpp
│ │ ├── README.md
│ │ └── atm
│ ├── carrentalsystem/
│ │ ├── Car.cpp
│ │ ├── Car.hpp
│ │ ├── CarRentalSystem.cpp
│ │ ├── CarRentalSystem.hpp
│ │ ├── CarRentalSystemDemo.cpp
│ │ ├── Customer.cpp
│ │ ├── Customer.hpp
│ │ ├── README.md
│ │ ├── Rental.cpp
│ │ ├── Rental.hpp
│ │ └── car_rental
│ ├── chessgame/
│ │ ├── Board.hpp
│ │ ├── ChessDemo.cpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── Piece.cpp
│ │ ├── Piece.hpp
│ │ ├── Position.hpp
│ │ ├── README.md
│ │ └── pieces/
│ │ ├── Bishop.cpp
│ │ ├── Bishop.hpp
│ │ ├── King.cpp
│ │ ├── King.hpp
│ │ ├── Knight.cpp
│ │ ├── Knight.hpp
│ │ ├── Pawn.cpp
│ │ ├── Pawn.hpp
│ │ ├── Queen.cpp
│ │ ├── Queen.hpp
│ │ ├── Rook.cpp
│ │ └── Rook.hpp
│ ├── coffeevendingmachine/
│ │ ├── Coffee.cpp
│ │ ├── Coffee.hpp
│ │ ├── CoffeeType.hpp
│ │ ├── CoffeeVendingMachine.cpp
│ │ ├── CoffeeVendingMachine.hpp
│ │ ├── CoffeeVendingMachineDemo.cpp
│ │ ├── Inventory.cpp
│ │ ├── Inventory.hpp
│ │ ├── README.md
│ │ └── coffee_machine
│ ├── concertticketbookingsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── BookingSystem.cpp
│ │ ├── BookingSystem.hpp
│ │ ├── Concert.cpp
│ │ ├── Concert.hpp
│ │ ├── ConcertBookingDemo.cpp
│ │ ├── README.md
│ │ ├── Seat.cpp
│ │ ├── Seat.hpp
│ │ └── concert_booking
│ ├── courseregistrationsystem/
│ │ ├── Course.cpp
│ │ ├── Course.hpp
│ │ ├── README.md
│ │ ├── RegistrationSystem.cpp
│ │ ├── RegistrationSystem.hpp
│ │ ├── RegistrationSystemDemo.cpp
│ │ ├── Student.cpp
│ │ └── Student.hpp
│ ├── cricinfo/
│ │ ├── CricInfoDemo.cpp
│ │ ├── CricInfoSystem.cpp
│ │ ├── CricInfoSystem.hpp
│ │ ├── Match.cpp
│ │ ├── Match.hpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ ├── PlayerStats.hpp
│ │ ├── README.md
│ │ ├── Team.cpp
│ │ └── Team.hpp
│ ├── digitalwalletservice/
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── User.cpp
│ │ ├── User.hpp
│ │ ├── Wallet.cpp
│ │ ├── Wallet.hpp
│ │ ├── WalletDemo.cpp
│ │ ├── WalletSystem.cpp
│ │ └── WalletSystem.hpp
│ ├── elevatorsystem/
│ │ ├── Elevator.cpp
│ │ ├── Elevator.hpp
│ │ ├── ElevatorDemo.cpp
│ │ ├── ElevatorSystem.cpp
│ │ ├── ElevatorSystem.hpp
│ │ ├── README.md
│ │ ├── Request.cpp
│ │ └── Request.hpp
│ ├── fooddeliveryservice/
│ │ ├── DeliveryDemo.cpp
│ │ ├── DeliveryService.cpp
│ │ ├── DeliveryService.hpp
│ │ ├── MenuItem.cpp
│ │ ├── MenuItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── README.md
│ │ ├── Restaurant.cpp
│ │ ├── Restaurant.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── hotelmanagementsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── Guest.cpp
│ │ ├── Guest.hpp
│ │ ├── HotelDemo.cpp
│ │ ├── HotelManager.cpp
│ │ ├── HotelManager.hpp
│ │ ├── README.md
│ │ ├── Room.cpp
│ │ └── Room.hpp
│ ├── librarymanagementsystem/
│ │ ├── Book.cpp
│ │ ├── Book.hpp
│ │ ├── LibraryDemo.cpp
│ │ ├── LibraryManager.cpp
│ │ ├── LibraryManager.hpp
│ │ ├── Member.cpp
│ │ ├── Member.hpp
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ └── Transaction.hpp
│ ├── linkedin/
│ │ ├── LinkedInDemo.cpp
│ │ ├── LinkedInManager.cpp
│ │ ├── LinkedInManager.hpp
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── Profile.cpp
│ │ ├── Profile.hpp
│ │ ├── README.md
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── loggingframework/
│ │ ├── ConsoleAppender.cpp
│ │ ├── ConsoleAppender.hpp
│ │ ├── FileAppender.cpp
│ │ ├── FileAppender.hpp
│ │ ├── LogAppender.hpp
│ │ ├── LogLevel.hpp
│ │ ├── LogMessage.cpp
│ │ ├── LogMessage.hpp
│ │ ├── Logger.cpp
│ │ ├── Logger.hpp
│ │ ├── LoggingDemo.cpp
│ │ └── README.md
│ ├── lrucache/
│ │ ├── DoublyLinkedList.hpp
│ │ ├── LRUCache.hpp
│ │ ├── LRUCacheDemo.cpp
│ │ └── README.md
│ ├── movieticketbookingsystem/
│ │ ├── Booking.cpp
│ │ ├── Booking.hpp
│ │ ├── BookingDemo.cpp
│ │ ├── BookingSystem.cpp
│ │ ├── BookingSystem.hpp
│ │ ├── Movie.cpp
│ │ ├── Movie.hpp
│ │ ├── README.md
│ │ ├── Show.cpp
│ │ ├── Show.hpp
│ │ ├── Theater.cpp
│ │ └── Theater.hpp
│ ├── musicstreamingservice/
│ │ ├── Artist.cpp
│ │ ├── Artist.hpp
│ │ ├── MusicStreamingDemo.cpp
│ │ ├── MusicStreamingService.cpp
│ │ ├── MusicStreamingService.hpp
│ │ ├── Playlist.cpp
│ │ ├── Playlist.hpp
│ │ ├── README.md
│ │ ├── Song.cpp
│ │ ├── Song.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlineauctionsystem/
│ │ ├── Auction.cpp
│ │ ├── Auction.hpp
│ │ ├── AuctionSystem.cpp
│ │ ├── AuctionSystem.hpp
│ │ ├── AuctionSystemDemo.cpp
│ │ ├── Item.cpp
│ │ ├── Item.hpp
│ │ ├── README.md
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlineshoppingservice/
│ │ ├── Cart.cpp
│ │ ├── Cart.hpp
│ │ ├── CartItem.cpp
│ │ ├── CartItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── Product.cpp
│ │ ├── Product.hpp
│ │ ├── README.md
│ │ ├── ShoppingDemo.cpp
│ │ ├── ShoppingSystem.cpp
│ │ ├── ShoppingSystem.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── onlinestockbrokeragesystem/
│ │ ├── BrokerageDemo.cpp
│ │ ├── BrokerageSystem.cpp
│ │ ├── BrokerageSystem.hpp
│ │ ├── Portfolio.cpp
│ │ ├── Portfolio.hpp
│ │ ├── README.md
│ │ ├── Stock.cpp
│ │ ├── Stock.hpp
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── parkinglot/
│ │ ├── ParkingLot.cpp
│ │ ├── ParkingLot.hpp
│ │ ├── ParkingLotDemo.cpp
│ │ ├── ParkingSpot.cpp
│ │ ├── ParkingSpot.hpp
│ │ ├── README.md
│ │ ├── Vehicle.cpp
│ │ └── Vehicle.hpp
│ ├── pubsubsystem/
│ │ ├── Message.cpp
│ │ ├── Message.hpp
│ │ ├── PubSubDemo.cpp
│ │ ├── PubSubSystem.cpp
│ │ ├── PubSubSystem.hpp
│ │ ├── README.md
│ │ ├── Subscriber.cpp
│ │ ├── Subscriber.hpp
│ │ ├── Topic.cpp
│ │ └── Topic.hpp
│ ├── restaurantmanagementsystem/
│ │ ├── MenuItem.cpp
│ │ ├── MenuItem.hpp
│ │ ├── Order.cpp
│ │ ├── Order.hpp
│ │ ├── OrderItem.cpp
│ │ ├── OrderItem.hpp
│ │ ├── README.md
│ │ ├── RestaurantDemo.cpp
│ │ ├── RestaurantSystem.cpp
│ │ ├── RestaurantSystem.hpp
│ │ ├── Table.cpp
│ │ └── Table.hpp
│ ├── ridesharingservice/
│ │ ├── Location.cpp
│ │ ├── Location.hpp
│ │ ├── README.md
│ │ ├── Ride.cpp
│ │ ├── Ride.hpp
│ │ ├── RideDemo.cpp
│ │ ├── RideService.cpp
│ │ ├── RideService.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── snakeandladdergame/
│ │ ├── Board.cpp
│ │ ├── Board.hpp
│ │ ├── Dice.cpp
│ │ ├── Dice.hpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── GameDemo.cpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ └── README.md
│ ├── socialnetworkingservice/
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── README.md
│ │ ├── SocialNetwork.cpp
│ │ ├── SocialNetwork.hpp
│ │ ├── SocialNetworkDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── splitwise/
│ │ ├── Expense.cpp
│ │ ├── Expense.hpp
│ │ ├── README.md
│ │ ├── SplitwiseDemo.cpp
│ │ ├── SplitwiseSystem.cpp
│ │ ├── SplitwiseSystem.hpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── stackoverflow/
│ │ ├── Comment.cpp
│ │ ├── Comment.hpp
│ │ ├── Post.cpp
│ │ ├── Post.hpp
│ │ ├── README.md
│ │ ├── StackOverflow.cpp
│ │ ├── StackOverflow.hpp
│ │ ├── StackOverflowDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── taskmanagementsystem/
│ │ ├── README.md
│ │ ├── Task.cpp
│ │ ├── Task.hpp
│ │ ├── TaskManager.cpp
│ │ ├── TaskManager.hpp
│ │ ├── TaskManagerDemo.cpp
│ │ ├── User.cpp
│ │ └── User.hpp
│ ├── tictactoe/
│ │ ├── Board.cpp
│ │ ├── Board.hpp
│ │ ├── Game.cpp
│ │ ├── Game.hpp
│ │ ├── Player.cpp
│ │ ├── Player.hpp
│ │ ├── README.md
│ │ └── TicTacToeDemo.cpp
│ ├── trafficsignalsystem/
│ │ ├── Intersection.cpp
│ │ ├── Intersection.hpp
│ │ ├── README.md
│ │ ├── Signal.cpp
│ │ ├── Signal.hpp
│ │ ├── TrafficSystem.cpp
│ │ ├── TrafficSystem.hpp
│ │ └── TrafficSystemDemo.cpp
│ ├── vendingmachine/
│ │ ├── Product.cpp
│ │ ├── Product.hpp
│ │ ├── README.md
│ │ ├── Transaction.cpp
│ │ ├── Transaction.hpp
│ │ ├── VendingMachine.cpp
│ │ ├── VendingMachine.hpp
│ │ └── VendingMachineDemo.cpp
│ └── votingsystem/
│ └── README.md
├── csharp/
│ ├── LLDRunner.cs
│ ├── airlinemanagementsystem/
│ │ ├── Aircraft.cs
│ │ ├── AirlineManagementSystem.cs
│ │ ├── AirlineManagementSystemDemo.cs
│ │ ├── Booking.cs
│ │ ├── BookingManager.cs
│ │ ├── BookingStatus.cs
│ │ ├── Flight.cs
│ │ ├── FlightSearch.cs
│ │ ├── Passenger.cs
│ │ ├── Payment.cs
│ │ ├── PaymentProcessor.cs
│ │ ├── PaymentStatus.cs
│ │ ├── README.md
│ │ ├── Seat.cs
│ │ ├── SeatStatus.cs
│ │ └── SeatType.cs
│ ├── atm/
│ │ ├── ATM.cs
│ │ ├── ATMDemo.cs
│ │ ├── DispenserChain/
│ │ │ ├── CashDispenser.cs
│ │ │ ├── IDispenseChain.cs
│ │ │ ├── NoteDispenser.cs
│ │ │ ├── NoteDispenser100.cs
│ │ │ ├── NoteDispenser20.cs
│ │ │ └── NoteDispenser50.cs
│ │ ├── Enums/
│ │ │ └── OperationType.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ └── Card.cs
│ │ ├── README.md
│ │ ├── Service/
│ │ │ └── BankService.cs
│ │ ├── State/
│ │ │ ├── AuthenticatedState.cs
│ │ │ ├── HasCardState.cs
│ │ │ ├── IATMState.cs
│ │ │ └── IdleState.cs
│ │ └── atm.csproj
│ ├── bin/
│ │ └── Debug/
│ │ └── net8.0/
│ │ ├── c#
│ │ ├── c#.deps.json
│ │ ├── c#.pdb
│ │ └── c#.runtimeconfig.json
│ ├── c#.csproj
│ ├── c#.sln
│ ├── carrentalsystem/
│ │ ├── Car.cs
│ │ ├── CarRentalSystemDemo.cs
│ │ ├── CreditCardPaymentProcessor.cs
│ │ ├── Customer.cs
│ │ ├── IPaymentProcessor.cs
│ │ ├── PayPalPaymentProcessor.cs
│ │ ├── README.md
│ │ ├── RentalSystem.cs
│ │ └── Reservation.cs
│ ├── chessgame/
│ │ ├── Bishop.cs
│ │ ├── Board.cs
│ │ ├── ChessGame.cs
│ │ ├── ChessGameDemo.cs
│ │ ├── Color.cs
│ │ ├── InvalidMoveException.cs
│ │ ├── King.cs
│ │ ├── Knight.cs
│ │ ├── Move.cs
│ │ ├── Pawn.cs
│ │ ├── Piece.cs
│ │ ├── Player.cs
│ │ ├── Queen.cs
│ │ ├── README.md
│ │ └── Rook.cs
│ ├── coffeevendingmachine/
│ │ ├── CoffeeVendingMachine.cs
│ │ ├── CoffeeVendingMachineDemo.cs
│ │ ├── Decorator/
│ │ │ ├── CaramelSyrupDecorator.cs
│ │ │ ├── CoffeeDecorator.cs
│ │ │ └── ExtraSugarDecorator.cs
│ │ ├── Enums/
│ │ │ ├── CoffeeType.cs
│ │ │ ├── Ingredient.cs
│ │ │ └── ToppingType.cs
│ │ ├── Factory/
│ │ │ └── CoffeeFactory.cs
│ │ ├── Inventory.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── IVendingMachineState.cs
│ │ │ ├── OutOfIngredientState.cs
│ │ │ ├── PaidState.cs
│ │ │ ├── ReadyState.cs
│ │ │ └── SelectingState.cs
│ │ ├── TemplateMethod/
│ │ │ ├── Cappuccino.cs
│ │ │ ├── Coffee.cs
│ │ │ ├── Espresso.cs
│ │ │ └── Latte.cs
│ │ └── coffeevendingmachine.csproj
│ ├── concertticketbookingsystem/
│ │ ├── Booking.cs
│ │ ├── BookingStatus.cs
│ │ ├── Concert.cs
│ │ ├── ConcertTicketBookingSystem.cs
│ │ ├── ConcertTicketBookingSystemDemo.cs
│ │ ├── README.md
│ │ ├── Seat.cs
│ │ ├── SeatNotAvailableException.cs
│ │ ├── SeatStatus.cs
│ │ ├── SeatType.cs
│ │ └── User.cs
│ ├── courseregistrationsystem/
│ │ ├── Course.cs
│ │ ├── CourseRegistrationDemo.cs
│ │ ├── CourseRegistrationSystem.cs
│ │ ├── README.md
│ │ ├── Registration.cs
│ │ └── Student.cs
│ ├── cricinfo/
│ │ ├── CommentaryManager.cs
│ │ ├── CricinfoDemo.cs
│ │ ├── CricinfoService.cs
│ │ ├── Enums/
│ │ │ ├── ExtraType.cs
│ │ │ ├── MatchStatus.cs
│ │ │ ├── MatchType.cs
│ │ │ ├── PlayerRole.cs
│ │ │ └── WicketType.cs
│ │ ├── Models/
│ │ │ ├── Ball.cs
│ │ │ ├── Innings.cs
│ │ │ ├── Match.cs
│ │ │ ├── Player.cs
│ │ │ ├── PlayerStats.cs
│ │ │ ├── Team.cs
│ │ │ └── Wicket.cs
│ │ ├── Observers/
│ │ │ ├── CommentaryDisplay.cs
│ │ │ ├── IMatchObserver.cs
│ │ │ ├── ScorecardDisplay.cs
│ │ │ └── UserNotifier.cs
│ │ ├── README.md
│ │ ├── Repositories/
│ │ │ ├── MatchRepository.cs
│ │ │ └── PlayerRepository.cs
│ │ ├── States/
│ │ │ ├── FinishedState.cs
│ │ │ ├── IMatchState.cs
│ │ │ ├── InBreakState.cs
│ │ │ ├── LiveState.cs
│ │ │ └── ScheduledState.cs
│ │ ├── Strategy/
│ │ │ ├── IMatchFormatStrategy.cs
│ │ │ ├── ODIFormatStrategy.cs
│ │ │ └── T20FormatStrategy.cs
│ │ └── cricinfo.csproj
│ ├── digitalwalletservice/
│ │ ├── Account.cs
│ │ ├── BankAccount.cs
│ │ ├── CreditCard.cs
│ │ ├── Currency.cs
│ │ ├── CurrencyConverter.cs
│ │ ├── DigitalWallet.cs
│ │ ├── DigitalWalletDemo.cs
│ │ ├── InsufficientFundsException.cs
│ │ ├── PaymentMethod.cs
│ │ ├── README.md
│ │ ├── Transaction.cs
│ │ └── User.cs
│ ├── elevatorsystem/
│ │ ├── ElevatorSystem.cs
│ │ ├── ElevatorSystemDemo.cs
│ │ ├── Enums/
│ │ │ ├── Direction.cs
│ │ │ └── RequestSource.cs
│ │ ├── Models/
│ │ │ ├── Elevator.cs
│ │ │ └── Request.cs
│ │ ├── Observer/
│ │ │ ├── Display.cs
│ │ │ └── IElevatorObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── IElevatorState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── MovingDownState.cs
│ │ │ └── MovingUpState.cs
│ │ ├── Strategy/
│ │ │ ├── IElevatorSelectionStrategy.cs
│ │ │ └── NearestElevatorStrategy.cs
│ │ └── elevatorsystem.csproj
│ ├── fooddeliveryservice/
│ │ ├── Enums/
│ │ │ └── OrderStatus.cs
│ │ ├── FoodDeliveryService.cs
│ │ ├── FoodDeliveryServiceDemo.cs
│ │ ├── Models/
│ │ │ ├── Address.cs
│ │ │ ├── Customer.cs
│ │ │ ├── DeliveryAgent.cs
│ │ │ ├── Menu.cs
│ │ │ ├── MenuItem.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderItem.cs
│ │ │ ├── Restaurant.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IOrderObserver.cs
│ │ ├── README.md
│ │ ├── Strategies/
│ │ │ ├── assignment/
│ │ │ │ ├── IDeliveryAssignmentStrategy.cs
│ │ │ │ └── NearestAvailableAgentStrategy.cs
│ │ │ └── search/
│ │ │ ├── IRestaurantSearchStrategy.cs
│ │ │ ├── SearchByCityStrategy.cs
│ │ │ ├── SearchByMenuKeywordStrategy.cs
│ │ │ └── SearchByProximityStrategy.cs
│ │ └── fooddeliveryservice.csproj
│ ├── hotelmanagementsystem/
│ │ ├── CashPayment.cs
│ │ ├── CreditCardPayment.cs
│ │ ├── Guest.cs
│ │ ├── HotelManagementSystem.cs
│ │ ├── HotelManagementSystemDemo.cs
│ │ ├── Payment.cs
│ │ ├── README.md
│ │ ├── Reservation.cs
│ │ ├── ReservationStatus.cs
│ │ ├── Room.cs
│ │ ├── RoomStatus.cs
│ │ └── RoomType.cs
│ ├── librarymanagementsystem/
│ │ ├── Enum/
│ │ │ └── ItemType.cs
│ │ ├── Factory/
│ │ │ └── ItemFactory.cs
│ │ ├── LibraryManagementSystem.cs
│ │ ├── LibraryManagementSystemDemo.cs
│ │ ├── Models/
│ │ │ ├── Book.cs
│ │ │ ├── BookCopy.cs
│ │ │ ├── LibraryItem.cs
│ │ │ ├── Loan.cs
│ │ │ ├── Magazine.cs
│ │ │ ├── Member.cs
│ │ │ └── TransactionService.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── AvailableState.cs
│ │ │ ├── CheckedOutState.cs
│ │ │ ├── IItemState.cs
│ │ │ └── OnHoldState.cs
│ │ ├── Strategy/
│ │ │ ├── ISearchStrategy.cs
│ │ │ ├── SearchByAuthorStrategy.cs
│ │ │ └── SearchByTitleStrategy.cs
│ │ └── librarymanagementsystem.csproj
│ ├── linkedIn/
│ │ ├── Enums/
│ │ │ ├── ConnectionStatus.cs
│ │ │ └── NotificationType.cs
│ │ ├── LinkedInDemo.cs
│ │ ├── LinkedInSystem.cs
│ │ ├── Models/
│ │ │ ├── Comment.cs
│ │ │ ├── Connection.cs
│ │ │ ├── Education.cs
│ │ │ ├── Experience.cs
│ │ │ ├── Like.cs
│ │ │ ├── Member.cs
│ │ │ ├── NewsFeed.cs
│ │ │ ├── Notification.cs
│ │ │ ├── Post.cs
│ │ │ └── Profile.cs
│ │ ├── Observer/
│ │ │ ├── INotificationObserver.cs
│ │ │ └── Subject.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── ConnectionService.cs
│ │ │ ├── NewsFeedService.cs
│ │ │ ├── NotificationService.cs
│ │ │ └── SearchService.cs
│ │ ├── Strategy/
│ │ │ ├── ChronologicalSortStrategy.cs
│ │ │ └── IFeedSortingStrategy.cs
│ │ └── linkedIn.csproj
│ ├── loggingframework/
│ │ ├── Appenders/
│ │ │ ├── ConsoleAppender.cs
│ │ │ ├── FileAppender.cs
│ │ │ └── ILogAppender.cs
│ │ ├── AsyncLogProcessor.cs
│ │ ├── Enum/
│ │ │ └── LogLevel.cs
│ │ ├── Formatters/
│ │ │ ├── ILogFormatter.cs
│ │ │ └── SimpleTextFormatter.cs
│ │ ├── LogManager.cs
│ │ ├── Logger.cs
│ │ ├── LoggingFrameworkDemo.cs
│ │ ├── Models/
│ │ │ └── LogMessage.cs
│ │ ├── README.md
│ │ └── loggingframework.csproj
│ ├── lrucache/
│ │ ├── DoublyLinkedList.cs
│ │ ├── LRUCache.cs
│ │ ├── LRUCacheDemo.cs
│ │ ├── Node.cs
│ │ ├── README.md
│ │ └── lrucache.csproj
│ ├── movieticketbookingsystem/
│ │ ├── BookingManager.cs
│ │ ├── Enums/
│ │ │ ├── PaymentStatus.cs
│ │ │ ├── SeatStatus.cs
│ │ │ └── SeatType.cs
│ │ ├── Models/
│ │ │ ├── Booking.cs
│ │ │ ├── Cinema.cs
│ │ │ ├── City.cs
│ │ │ ├── Movie.cs
│ │ │ ├── Payment.cs
│ │ │ ├── Screen.cs
│ │ │ ├── Seat.cs
│ │ │ ├── Show.cs
│ │ │ └── User.cs
│ │ ├── MovieBookingDemo.cs
│ │ ├── MovieBookingService.cs
│ │ ├── Observer/
│ │ │ ├── IMovieObserver.cs
│ │ │ ├── MovieSubject.cs
│ │ │ └── UserObserver.cs
│ │ ├── README.md
│ │ ├── SeatLockManager.cs
│ │ ├── Strategies/
│ │ │ ├── Payment/
│ │ │ │ ├── CreditCardPaymentStrategy.cs
│ │ │ │ └── IPaymentStrategy.cs
│ │ │ └── Pricing/
│ │ │ ├── IPricingStrategy.cs
│ │ │ ├── WeekdayPricingStrategy.cs
│ │ │ └── WeekendPricingStrategy.cs
│ │ └── movieticketbookingsystem.csproj
│ ├── musicstreamingservice/
│ │ ├── Commands/
│ │ │ ├── ICommand.cs
│ │ │ ├── NextTrackCommand.cs
│ │ │ ├── PauseCommand.cs
│ │ │ └── PlayCommand.cs
│ │ ├── Enums/
│ │ │ ├── PlayerStatus.cs
│ │ │ └── SubscriptionTier.cs
│ │ ├── Models/
│ │ │ ├── Album.cs
│ │ │ ├── Artist.cs
│ │ │ ├── IPlayable.cs
│ │ │ ├── Player.cs
│ │ │ ├── Playlist.cs
│ │ │ ├── Song.cs
│ │ │ └── User.cs
│ │ ├── MusicStreamingDemo.cs
│ │ ├── MusicStreamingSystem.cs
│ │ ├── Observer/
│ │ │ ├── IArtistObserver.cs
│ │ │ └── Subject.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── RecommendationService.cs
│ │ │ └── SearchService.cs
│ │ ├── States/
│ │ │ ├── PausedState.cs
│ │ │ ├── PlayerState.cs
│ │ │ ├── PlayingState.cs
│ │ │ └── StoppedState.cs
│ │ ├── Strategies/
│ │ │ ├── Playback/
│ │ │ │ ├── FreePlaybackStrategy.cs
│ │ │ │ ├── PlaybackStrategy.cs
│ │ │ │ └── PremiumPlaybackStrategy.cs
│ │ │ └── Recommendation/
│ │ │ ├── GenreBasedRecommendationStrategy.cs
│ │ │ └── RecommendationStrategy.cs
│ │ └── musicstreamingservice.csproj
│ ├── obj/
│ │ ├── Debug/
│ │ │ └── net8.0/
│ │ │ ├── .NETCoreApp,Version=v8.0.AssemblyAttributes.cs
│ │ │ ├── apphost
│ │ │ ├── c#.AssemblyInfo.cs
│ │ │ ├── c#.AssemblyInfoInputs.cache
│ │ │ ├── c#.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── c#.GlobalUsings.g.cs
│ │ │ ├── c#.assets.cache
│ │ │ ├── c#.csproj.CoreCompileInputs.cache
│ │ │ ├── c#.csproj.FileListAbsolute.txt
│ │ │ ├── c#.genruntimeconfig.cache
│ │ │ ├── c#.pdb
│ │ │ └── c#.sourcelink.json
│ │ ├── c#.csproj.nuget.dgspec.json
│ │ ├── c#.csproj.nuget.g.props
│ │ ├── c#.csproj.nuget.g.targets
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
│ ├── onlineauctionsystem/
│ │ ├── AuctionService.cs
│ │ ├── AuctionSystemDemo.cs
│ │ ├── Enum/
│ │ │ └── AuctionState.cs
│ │ ├── Models/
│ │ │ ├── Auction.cs
│ │ │ ├── Bid.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IAuctionObserver.cs
│ │ ├── README.md
│ │ └── onlineauctionsystem.csproj
│ ├── onlineshoppingservice/
│ │ ├── Decorators/
│ │ │ ├── GiftWrapDecorator.cs
│ │ │ └── ProductDecorator.cs
│ │ ├── Enums/
│ │ │ ├── OrderStatus.cs
│ │ │ └── ProductCategory.cs
│ │ ├── Exceptions/
│ │ │ └── OutOfStockException.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ ├── Address.cs
│ │ │ ├── CartItem.cs
│ │ │ ├── Customer.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderLineItem.cs
│ │ │ ├── Product.cs
│ │ │ └── ShoppingCart.cs
│ │ ├── Observer/
│ │ │ ├── IOrderObserver.cs
│ │ │ └── Subject.cs
│ │ ├── OnlineShoppingDemo.cs
│ │ ├── OnlineShoppingSystem.cs
│ │ ├── README.md
│ │ ├── Services/
│ │ │ ├── InventoryService.cs
│ │ │ ├── OrderService.cs
│ │ │ ├── PaymentService.cs
│ │ │ └── SearchService.cs
│ │ ├── States/
│ │ │ ├── CancelledState.cs
│ │ │ ├── DeliveredState.cs
│ │ │ ├── IOrderState.cs
│ │ │ ├── PlacedState.cs
│ │ │ └── ShippedState.cs
│ │ ├── Strategy/
│ │ │ ├── CreditCardPaymentStrategy.cs
│ │ │ ├── IPaymentStrategy.cs
│ │ │ └── UPIPaymentStrategy.cs
│ │ └── onlineshoppingservice.csproj
│ ├── onlinestockbrokeragesystem/
│ │ ├── Commands/
│ │ │ ├── BuyStockCommand.cs
│ │ │ ├── IOrderCommand.cs
│ │ │ └── SellStockCommand.cs
│ │ ├── Enums/
│ │ │ ├── OrderStatus.cs
│ │ │ ├── OrderType.cs
│ │ │ └── TransactionType.cs
│ │ ├── Exceptions/
│ │ │ ├── InsufficientFundsException.cs
│ │ │ └── InsufficientStockException.cs
│ │ ├── Models/
│ │ │ ├── Account.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderBuilder.cs
│ │ │ ├── Stock.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ └── IStockObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── CancelledState.cs
│ │ │ ├── FilledState.cs
│ │ │ ├── IOrderState.cs
│ │ │ └── OpenState.cs
│ │ ├── StockBrokerageSystem.cs
│ │ ├── StockBrokerageSystemDemo.cs
│ │ ├── StockExchange.cs
│ │ ├── Strategy/
│ │ │ ├── IExecutionStrategy.cs
│ │ │ ├── LimitOrderStrategy.cs
│ │ │ └── MarketOrderStrategy.cs
│ │ └── onlinestockbrokeragesystem.csproj
│ ├── parkinglot/
│ │ ├── Enums/
│ │ │ └── VehicleSize.cs
│ │ ├── Models/
│ │ │ ├── ParkingFloor.cs
│ │ │ ├── ParkingSpot.cs
│ │ │ ├── ParkingTicket.cs
│ │ │ └── Vehicle.cs
│ │ ├── ParkingLot.cs
│ │ ├── ParkingLotDemo.cs
│ │ ├── README.md
│ │ ├── Strategies/
│ │ │ ├── Fee/
│ │ │ │ ├── FlatRateFeeStrategy.cs
│ │ │ │ ├── IFeeStrategy.cs
│ │ │ │ └── VehicleBasedFeeStrategy.cs
│ │ │ └── Parking/
│ │ │ ├── BestFitStrategy.cs
│ │ │ ├── FarthestFirstStrategy.cs
│ │ │ ├── IParkingStrategy.cs
│ │ │ └── NearestFirstStrategy.cs
│ │ └── parkinglot.csproj
│ ├── pubsubsystem/
│ │ ├── Models/
│ │ │ ├── Message.cs
│ │ │ └── Topic.cs
│ │ ├── PubSubDemo.cs
│ │ ├── PubSubService.cs
│ │ ├── README.md
│ │ ├── Subscribers/
│ │ │ ├── AlertSubscriber.cs
│ │ │ ├── ISubscriber.cs
│ │ │ └── NewsSubscriber.cs
│ │ └── pubsubsystem.csproj
│ ├── restaurantmanagementsystem/
│ │ ├── Commands/
│ │ │ ├── ICommand.cs
│ │ │ ├── PrepareOrderCommand.cs
│ │ │ └── ServeOrderCommand.cs
│ │ ├── Decorators/
│ │ │ ├── BillDecorator.cs
│ │ │ ├── ServiceChargeDecorator.cs
│ │ │ └── TaxDecorator.cs
│ │ ├── Enum/
│ │ │ └── TableStatus.cs
│ │ ├── Models/
│ │ │ ├── BaseBill.cs
│ │ │ ├── Bill.cs
│ │ │ ├── Chef.cs
│ │ │ ├── IBillComponent.cs
│ │ │ ├── Menu.cs
│ │ │ ├── MenuItem.cs
│ │ │ ├── Order.cs
│ │ │ ├── OrderItem.cs
│ │ │ ├── Restaurant.cs
│ │ │ ├── Staff.cs
│ │ │ ├── Table.cs
│ │ │ └── Waiter.cs
│ │ ├── Observer/
│ │ │ └── IOrderObserver.cs
│ │ ├── README.md
│ │ ├── RestaurantManagementSystemDemo.cs
│ │ ├── RestaurantManagementSystemFacade.cs
│ │ ├── States/
│ │ │ ├── IOrderItemState.cs
│ │ │ ├── OrderedState.cs
│ │ │ ├── PreparingState.cs
│ │ │ ├── ReadyForPickupState.cs
│ │ │ └── ServedState.cs
│ │ └── restaurantmanagementsystem.csproj
│ ├── ridesharingservice/
│ │ ├── Enums/
│ │ │ ├── DriverStatus.cs
│ │ │ ├── RideType.cs
│ │ │ └── TripStatus.cs
│ │ ├── Models/
│ │ │ ├── Driver.cs
│ │ │ ├── Location.cs
│ │ │ ├── Rider.cs
│ │ │ ├── Trip.cs
│ │ │ ├── User.cs
│ │ │ └── Vehicle.cs
│ │ ├── Observer/
│ │ │ └── ITripObserver.cs
│ │ ├── README.md
│ │ ├── RideSharingService.cs
│ │ ├── RideSharingServiceDemo.cs
│ │ ├── States/
│ │ │ ├── AssignedState.cs
│ │ │ ├── CompletedState.cs
│ │ │ ├── ITripState.cs
│ │ │ ├── InProgressState.cs
│ │ │ └── RequestedState.cs
│ │ ├── Strategies/
│ │ │ ├── Matching/
│ │ │ │ ├── IDriverMatchingStrategy.cs
│ │ │ │ └── NearestDriverMatchingStrategy.cs
│ │ │ └── Pricing/
│ │ │ ├── FlatRatePricingStrategy.cs
│ │ │ ├── IPricingStrategy.cs
│ │ │ └── VehicleBasedPricingStrategy.cs
│ │ └── ridesharingservice.csproj
│ ├── snakeandladdergame/
│ │ ├── Enums/
│ │ │ └── GameStatus.cs
│ │ ├── Game.cs
│ │ ├── Models/
│ │ │ ├── Board.cs
│ │ │ ├── BoardEntity.cs
│ │ │ ├── Dice.cs
│ │ │ ├── Ladder.cs
│ │ │ ├── Player.cs
│ │ │ └── Snake.cs
│ │ ├── README.md
│ │ ├── SnakeAndLadderDemo.cs
│ │ └── snakeandladdergame.csproj
│ ├── socialnetworkingservice/
│ │ ├── Models/
│ │ │ ├── Comment.cs
│ │ │ ├── CommentableEntity.cs
│ │ │ ├── Post.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── IPostObserver.cs
│ │ │ └── UserNotifier.cs
│ │ ├── README.md
│ │ ├── Repositories/
│ │ │ ├── PostRepository.cs
│ │ │ └── UserRepository.cs
│ │ ├── Services/
│ │ │ ├── NewsFeedService.cs
│ │ │ ├── PostService.cs
│ │ │ └── UserService.cs
│ │ ├── SocialNetworkFacade.cs
│ │ ├── SocialNetworkingDemo.cs
│ │ ├── Strategy/
│ │ │ ├── ChronologicalStrategy.cs
│ │ │ └── INewsFeedGenerationStrategy.cs
│ │ └── socialnetworkingservice.csproj
│ ├── splitwise/
│ │ ├── Models/
│ │ │ ├── BalanceSheet.cs
│ │ │ ├── Expense.cs
│ │ │ ├── Group.cs
│ │ │ ├── Split.cs
│ │ │ ├── Transaction.cs
│ │ │ └── User.cs
│ │ ├── README.md
│ │ ├── SplitwiseDemo.cs
│ │ ├── SplitwiseService.cs
│ │ ├── Strategy/
│ │ │ ├── EqualSplitStrategy.cs
│ │ │ ├── ExactSplitStrategy.cs
│ │ │ ├── PercentageSplitStrategy.cs
│ │ │ └── SplitStrategy.cs
│ │ └── splitwise.csproj
│ ├── stackoverflow/
│ │ ├── Enums/
│ │ │ ├── EventType.cs
│ │ │ └── VoteType.cs
│ │ ├── Models/
│ │ │ ├── Answer.cs
│ │ │ ├── Comment.cs
│ │ │ ├── Content.cs
│ │ │ ├── Post.cs
│ │ │ ├── Question.cs
│ │ │ ├── Tag.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── Event.cs
│ │ │ ├── IPostObserver.cs
│ │ │ └── ReputationManager.cs
│ │ ├── README.md
│ │ ├── StackOverflowDemo.cs
│ │ ├── StackOverflowService.cs
│ │ ├── Strategy/
│ │ │ ├── ISearchStrategy.cs
│ │ │ ├── KeywordSearchStrategy.cs
│ │ │ ├── TagSearchStrategy.cs
│ │ │ └── UserSearchStrategy.cs
│ │ └── stackoverflow.csproj
│ ├── taskmanagementsystem/
│ │ ├── Enums/
│ │ │ ├── TaskPriority.cs
│ │ │ └── TaskStatus.cs
│ │ ├── Models/
│ │ │ ├── ActivityLog.cs
│ │ │ ├── Comment.cs
│ │ │ ├── Tag.cs
│ │ │ ├── Task.cs
│ │ │ ├── TaskList.cs
│ │ │ └── User.cs
│ │ ├── Observer/
│ │ │ ├── ActivityLogger.cs
│ │ │ └── ITaskObserver.cs
│ │ ├── README.md
│ │ ├── State/
│ │ │ ├── DoneState.cs
│ │ │ ├── InProgressState.cs
│ │ │ ├── TaskState.cs
│ │ │ └── TodoState.cs
│ │ ├── Strategy/
│ │ │ ├── SortByDueDate.cs
│ │ │ ├── SortByPriority.cs
│ │ │ └── TaskSortStrategy.cs
│ │ ├── TaskManagementSystem.cs
│ │ ├── TaskManagementSystemDemo.cs
│ │ └── taskmanagementsystem.csproj
│ ├── tictactoe/
│ │ ├── Enums/
│ │ │ ├── GameStatus.cs
│ │ │ └── Symbol.cs
│ │ ├── Exceptions/
│ │ │ └── InvalidMoveException.cs
│ │ ├── Models/
│ │ │ ├── Board.cs
│ │ │ ├── Cell.cs
│ │ │ ├── Game.cs
│ │ │ └── Player.cs
│ │ ├── Observer/
│ │ │ ├── GameSubject.cs
│ │ │ ├── IGameObserver.cs
│ │ │ └── Scoreboard.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── DrawState.cs
│ │ │ ├── IGameState.cs
│ │ │ ├── InProgressState.cs
│ │ │ └── WinnerState.cs
│ │ ├── Strategy/
│ │ │ ├── ColumnWinningStrategy.cs
│ │ │ ├── DiagonalWinningStrategy.cs
│ │ │ ├── IWinningStrategy.cs
│ │ │ └── RowWinningStrategy.cs
│ │ ├── TicTacToeDemo.cs
│ │ ├── TicTacToeSystem.cs
│ │ └── tictactoe.csproj
│ ├── trafficsignalsystem/
│ │ ├── Enums/
│ │ │ ├── Direction.cs
│ │ │ └── LightColor.cs
│ │ ├── IntersectionController.cs
│ │ ├── Observer/
│ │ │ ├── CentralMonitor.cs
│ │ │ └── ITrafficObserver.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── Intersection/
│ │ │ │ ├── EastWestGreenState.cs
│ │ │ │ ├── IIntersectionState.cs
│ │ │ │ └── NorthSouthGreenState.cs
│ │ │ └── Light/
│ │ │ ├── GreenState.cs
│ │ │ ├── ISignalState.cs
│ │ │ ├── RedState.cs
│ │ │ └── YellowState.cs
│ │ ├── TrafficControlSystem.cs
│ │ ├── TrafficLight.cs
│ │ ├── TrafficSystemDemo.cs
│ │ └── trafficsignalsystem.csproj
│ ├── vendingmachine/
│ │ ├── Enum/
│ │ │ └── Coin.cs
│ │ ├── Models/
│ │ │ ├── Inventory.cs
│ │ │ └── Item.cs
│ │ ├── README.md
│ │ ├── States/
│ │ │ ├── DispensingState.cs
│ │ │ ├── HasMoneyState.cs
│ │ │ ├── IdleState.cs
│ │ │ ├── ItemSelectedState.cs
│ │ │ └── VendingMachineState.cs
│ │ ├── VendingMachine.cs
│ │ ├── VendingMachineDemo.cs
│ │ └── vendingmachine.csproj
│ └── votingsystem/
│ └── README.md
├── golang/
│ ├── airlinemanagementsystem/
│ │ ├── README.md
│ │ ├── aircraft.go
│ │ ├── airline_management_system.go
│ │ ├── airline_management_system_demo.go
│ │ ├── booking.go
│ │ ├── booking_manager.go
│ │ ├── flight.go
│ │ ├── flight_search.go
│ │ ├── passenger.go
│ │ ├── payment.go
│ │ ├── payment_processor.go
│ │ ├── seat.go
│ │ └── types.go
│ ├── app.log
│ ├── atm/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── atm.go
│ │ ├── atm_demo.go
│ │ ├── banking_service.go
│ │ ├── card.go
│ │ ├── cash_dispenser.go
│ │ ├── deposit_transaction.go
│ │ ├── errors.go
│ │ ├── transaction.go
│ │ └── withdrawal_transaction.go
│ ├── carrentalsystem/
│ │ ├── README.md
│ │ ├── car.go
│ │ ├── car_rental_system_demo.go
│ │ ├── credit_card_processor.go
│ │ ├── customer.go
│ │ ├── payment_processor.go
│ │ ├── paypal_processor.go
│ │ ├── rental_system.go
│ │ └── reservation.go
│ ├── chessgame/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── chess_game.go
│ │ ├── chess_game_demo.go
│ │ ├── color.go
│ │ ├── errors.go
│ │ ├── move.go
│ │ ├── piece.go
│ │ ├── pieces.go
│ │ └── player.go
│ ├── coffeevendingmachine/
│ │ ├── README.md
│ │ ├── coffee.go
│ │ ├── coffee_machine.go
│ │ ├── coffee_vending_machine_demo.go
│ │ ├── ingredient.go
│ │ └── payment.go
│ ├── concertticketbookingsystem/
│ │ ├── README.md
│ │ ├── booking.go
│ │ ├── concert.go
│ │ ├── concert_booking_system.go
│ │ ├── concert_booking_system_demo.go
│ │ ├── errors.go
│ │ ├── seat.go
│ │ ├── types.go
│ │ ├── user.go
│ │ └── utils.go
│ ├── courseregistrationsystem/
│ │ ├── README.md
│ │ ├── course.go
│ │ ├── course_registration_system.go
│ │ ├── course_registration_system_demo.go
│ │ ├── registration.go
│ │ └── student.go
│ ├── cricinfo/
│ │ ├── README.md
│ │ ├── ball.go
│ │ ├── cricinfo.go
│ │ ├── cricinfo_system.go
│ │ ├── innings.go
│ │ ├── match.go
│ │ ├── match_service.go
│ │ ├── over.go
│ │ ├── player.go
│ │ ├── scorecard.go
│ │ ├── scorecard_service.go
│ │ ├── team.go
│ │ └── types.go
│ ├── digitalwalletservice/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── bank_account.go
│ │ ├── credit_card.go
│ │ ├── currency_converter.go
│ │ ├── digital_wallet.go
│ │ ├── digital_wallet_demo.go
│ │ ├── errors.go
│ │ ├── payment_method.go
│ │ ├── transaction.go
│ │ ├── types.go
│ │ └── user.go
│ ├── elevatorsystem/
│ │ ├── README.md
│ │ ├── direction.go
│ │ ├── elevator.go
│ │ ├── elevator_controller.go
│ │ ├── elevator_controller_demo.go
│ │ └── request.go
│ ├── fooddeliveryservice/
│ │ ├── README.md
│ │ ├── customer.go
│ │ ├── delivery_agent.go
│ │ ├── food_delivery_service.go
│ │ ├── food_delivery_service_demo.go
│ │ ├── menu_item.go
│ │ ├── order.go
│ │ ├── restaurant.go
│ │ └── types.go
│ ├── go.mod
│ ├── hotelmanagementsystem/
│ │ ├── README.md
│ │ ├── guest.go
│ │ ├── hotel_management.go
│ │ ├── hotel_management_demo.go
│ │ ├── payment.go
│ │ ├── reservation.go
│ │ ├── room.go
│ │ └── types.go
│ ├── librarymanagementsystem/
│ │ ├── README.md
│ │ ├── book.go
│ │ ├── library_management_system_demo.go
│ │ ├── library_manager.go
│ │ └── member.go
│ ├── linkedin/
│ │ ├── README.md
│ │ ├── connection.go
│ │ ├── education.go
│ │ ├── experience.go
│ │ ├── job_posting.go
│ │ ├── linkedin_service.go
│ │ ├── linkedin_service_demo.go
│ │ ├── message.go
│ │ ├── notification.go
│ │ ├── profile.go
│ │ ├── skill.go
│ │ ├── types.go
│ │ └── user.go
│ ├── loggingframework/
│ │ ├── README.md
│ │ ├── console_appender.go
│ │ ├── database_appender.go
│ │ ├── file_appender.go
│ │ ├── log_appender.go
│ │ ├── log_level.go
│ │ ├── log_message.go
│ │ ├── logger.go
│ │ ├── logger_config.go
│ │ └── logging_framework_demo.go
│ ├── lrucache/
│ │ ├── README.md
│ │ ├── lru_cache.go
│ │ └── lru_cache_demo.go
│ ├── main.go
│ ├── movieticketbookingsystem/
│ │ ├── README.md
│ │ ├── booking.go
│ │ ├── movie.go
│ │ ├── movie_ticket_booking_system.go
│ │ ├── movie_ticket_booking_system_demo.go
│ │ ├── seat.go
│ │ ├── show.go
│ │ ├── theater.go
│ │ ├── types.go
│ │ └── user.go
│ ├── musicstreamingservice/
│ │ ├── README.md
│ │ ├── album.go
│ │ ├── artist.go
│ │ ├── music_library.go
│ │ ├── music_player.go
│ │ ├── music_recommender.go
│ │ ├── music_streaming_service.go
│ │ ├── music_streaming_service_demo.go
│ │ ├── playlist.go
│ │ ├── song.go
│ │ ├── user.go
│ │ └── userManager.go
│ ├── onlineauctionsystem/
│ │ ├── README.md
│ │ ├── auction_listing.go
│ │ ├── auction_status.go
│ │ ├── auction_system.go
│ │ ├── bid.go
│ │ ├── main.go
│ │ └── user.go
│ ├── onlineshoppingservice/
│ │ ├── README.md
│ │ ├── credit_card_payment.go
│ │ ├── online_shopping_service.go
│ │ ├── online_shopping_service_demo.go
│ │ ├── order.go
│ │ ├── order_item.go
│ │ ├── order_status.go
│ │ ├── payment.go
│ │ ├── product.go
│ │ ├── shopping_cart.go
│ │ └── user.go
│ ├── onlinestockbrokeragesystem/
│ │ ├── README.md
│ │ ├── account.go
│ │ ├── buy_order.go
│ │ ├── exceptions.go
│ │ ├── order.go
│ │ ├── portfolio.go
│ │ ├── sell_order.go
│ │ ├── stock.go
│ │ ├── stock_broker.go
│ │ ├── stock_broker_demo.go
│ │ ├── types.go
│ │ └── user.go
│ ├── parkinglot/
│ │ ├── README.md
│ │ ├── car.go
│ │ ├── level.go
│ │ ├── motorcycle.go
│ │ ├── parking_lot.go
│ │ ├── parking_lot_demo.go
│ │ ├── parking_spot.go
│ │ ├── truck.go
│ │ └── vehicle.go
│ ├── pubsubsystem/
│ │ ├── README.md
│ │ ├── message.go
│ │ ├── print_subscriber.go
│ │ ├── publisher.go
│ │ ├── pubsub_system_demo.go
│ │ ├── subscriber.go
│ │ └── topic.go
│ ├── restaurantmanagementsystem/
│ │ ├── README.md
│ │ ├── menu_item.go
│ │ ├── order.go
│ │ ├── order_status.go
│ │ ├── payment.go
│ │ ├── payment_method.go
│ │ ├── payment_status.go
│ │ ├── reservation.go
│ │ ├── restaurant.go
│ │ ├── restaurant_management_demo.go
│ │ └── staff.go
│ ├── ridesharingservice/
│ │ ├── README.md
│ │ ├── driver.go
│ │ ├── driver_status.go
│ │ ├── location.go
│ │ ├── passenger.go
│ │ ├── ride.go
│ │ ├── ride_service.go
│ │ ├── ride_sharing_service_demo.go
│ │ └── ride_status.go
│ ├── snakeandladdergame/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── dice.go
│ │ ├── game_manager.go
│ │ ├── ladder.go
│ │ ├── player.go
│ │ ├── snake.go
│ │ ├── snake_and_ladder_demo.go
│ │ └── snake_and_ladder_game.go
│ ├── socialnetworkingservice/
│ │ ├── README.md
│ │ ├── comment.go
│ │ ├── notification.go
│ │ ├── post.go
│ │ ├── social_networking_service.go
│ │ ├── social_networking_service_demo.go
│ │ ├── types.go
│ │ └── user.go
│ ├── splitwise/
│ │ ├── README.md
│ │ ├── equal_split.go
│ │ ├── expense.go
│ │ ├── group.go
│ │ ├── percent_split.go
│ │ ├── split.go
│ │ ├── splitwise_demo.go
│ │ ├── splitwise_service.go
│ │ ├── transaction.go
│ │ └── user.go
│ ├── stackOverFlow/
│ │ ├── README.md
│ │ ├── answer.go
│ │ ├── stackoverflow.go
│ │ ├── stackoverflow_demo.go
│ │ └── types.go
│ ├── taskmanagementsystem/
│ │ ├── README.md
│ │ ├── task.go
│ │ ├── task_management_system_demo.go
│ │ ├── task_manager.go
│ │ ├── task_status.go
│ │ └── user.go
│ ├── tictactoe/
│ │ ├── README.md
│ │ ├── board.go
│ │ ├── game.go
│ │ ├── player.go
│ │ └── tictactoe_demo.go
│ ├── trafficsignalsystem/
│ │ ├── README.md
│ │ ├── road.go
│ │ ├── signal.go
│ │ ├── traffic_controller.go
│ │ ├── traffic_light.go
│ │ └── traffic_signal_system_demo.go
│ ├── vendingmachine/
│ │ ├── README.md
│ │ ├── coin.go
│ │ ├── inventory.go
│ │ ├── note.go
│ │ ├── product.go
│ │ ├── state.go
│ │ ├── vending_machine.go
│ │ └── vending_machine_demo.go
│ └── votingsystem/
│ └── README.md
├── java/
│ ├── .gitignore
│ ├── pom.xml
│ ├── src/
│ │ ├── LLDRunner.java
│ │ ├── airlinemanagementsystem/
│ │ │ ├── Aircraft.java
│ │ │ ├── AirlineManagementSystem.java
│ │ │ ├── AirlineManagementSystemDemo.java
│ │ │ ├── Passenger.java
│ │ │ ├── README.md
│ │ │ ├── booking/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── BookingManager.java
│ │ │ │ └── BookingStatus.java
│ │ │ ├── flight/
│ │ │ │ ├── Flight.java
│ │ │ │ ├── FlightSearch.java
│ │ │ │ └── FlightStatus.java
│ │ │ ├── payment/
│ │ │ │ ├── Payment.java
│ │ │ │ ├── PaymentProcessor.java
│ │ │ │ └── PaymentStatus.java
│ │ │ └── seat/
│ │ │ ├── Seat.java
│ │ │ ├── SeatStatus.java
│ │ │ └── SeatType.java
│ │ ├── atm/
│ │ │ ├── ATMDemo.java
│ │ │ ├── ATMSystem.java
│ │ │ ├── README.md
│ │ │ ├── chainofresponsibility/
│ │ │ │ ├── DispenseChain.java
│ │ │ │ ├── NoteDispenser.java
│ │ │ │ ├── NoteDispenser100.java
│ │ │ │ ├── NoteDispenser20.java
│ │ │ │ └── NoteDispenser50.java
│ │ │ ├── entities/
│ │ │ │ ├── Account.java
│ │ │ │ ├── BankService.java
│ │ │ │ ├── Card.java
│ │ │ │ └── CashDispenser.java
│ │ │ ├── enums/
│ │ │ │ └── OperationType.java
│ │ │ └── state/
│ │ │ ├── ATMState.java
│ │ │ ├── AuthenticatedState.java
│ │ │ ├── HasCardState.java
│ │ │ └── IdleState.java
│ │ ├── carrentalsystem/
│ │ │ ├── Car.java
│ │ │ ├── CarRentalSystem.java
│ │ │ ├── CarRentalSystemDemo.java
│ │ │ ├── CarStatus.java
│ │ │ ├── CarType.java
│ │ │ ├── Customer.java
│ │ │ ├── README.md
│ │ │ ├── Reservation.java
│ │ │ └── payment/
│ │ │ ├── CreditCardPaymentProcessor.java
│ │ │ ├── PayPalPaymentProcessor.java
│ │ │ └── PaymentProcessor.java
│ │ ├── chessgame/
│ │ │ ├── Board.java
│ │ │ ├── Cell.java
│ │ │ ├── ChessGame.java
│ │ │ ├── ChessGameDemo.java
│ │ │ ├── Color.java
│ │ │ ├── InvalidMoveException.java
│ │ │ ├── Move.java
│ │ │ ├── Player.java
│ │ │ ├── README.md
│ │ │ └── pieces/
│ │ │ ├── Bishop.java
│ │ │ ├── King.java
│ │ │ ├── Knight.java
│ │ │ ├── Pawn.java
│ │ │ ├── Piece.java
│ │ │ ├── Queen.java
│ │ │ └── Rook.java
│ │ ├── coffeevendingmachine/
│ │ │ ├── CoffeeVendingMachine.java
│ │ │ ├── CoffeeVendingMachineDemo.java
│ │ │ ├── Inventory.java
│ │ │ ├── README.md
│ │ │ ├── decorator/
│ │ │ │ ├── CaramelSyrupDecorator.java
│ │ │ │ ├── Coffee.java
│ │ │ │ ├── CoffeeDecorator.java
│ │ │ │ └── ExtraSugarDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── CoffeeType.java
│ │ │ │ ├── Ingredient.java
│ │ │ │ └── ToppingType.java
│ │ │ ├── factory/
│ │ │ │ └── CoffeeFactory.java
│ │ │ ├── state/
│ │ │ │ ├── OutOfIngredientState.java
│ │ │ │ ├── PaidState.java
│ │ │ │ ├── ReadyState.java
│ │ │ │ ├── SelectingState.java
│ │ │ │ └── VendingMachineState.java
│ │ │ └── templatemethod/
│ │ │ ├── Cappuccino.java
│ │ │ ├── Espresso.java
│ │ │ └── Latte.java
│ │ ├── concertticketbookingsystem/
│ │ │ ├── Booking.java
│ │ │ ├── BookingStatus.java
│ │ │ ├── Concert.java
│ │ │ ├── ConcertTicketBookingSystem.java
│ │ │ ├── ConcertTicketBookingSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── Seat.java
│ │ │ ├── SeatNotAvailableException.java
│ │ │ ├── SeatStatus.java
│ │ │ ├── SeatType.java
│ │ │ └── User.java
│ │ ├── courseregistrationsystem/
│ │ │ ├── CourseRegistrationDemo.java
│ │ │ ├── CourseRegistrationService.java
│ │ │ ├── CourseRegistrationSystemFacade.java
│ │ │ ├── README.md
│ │ │ ├── chain/
│ │ │ │ ├── CapacityRuleHandler.java
│ │ │ │ ├── PrerequisiteRuleHandler.java
│ │ │ │ ├── RegistrationRequest.java
│ │ │ │ ├── RegistrationRuleHandler.java
│ │ │ │ └── ScheduleConflictRuleHandler.java
│ │ │ ├── exception/
│ │ │ │ └── RegistrationException.java
│ │ │ ├── model/
│ │ │ │ ├── Course.java
│ │ │ │ ├── CourseOffering.java
│ │ │ │ ├── Professor.java
│ │ │ │ ├── Student.java
│ │ │ │ └── TimeSlot.java
│ │ │ ├── observer/
│ │ │ │ ├── CourseOfferingObserver.java
│ │ │ │ └── WaitlistManager.java
│ │ │ └── repository/
│ │ │ ├── CourseRepository.java
│ │ │ └── StudentRepository.java
│ │ ├── cricinfo/
│ │ │ ├── CommentaryManager.java
│ │ │ ├── CricInfoService.java
│ │ │ ├── CricinfoDemo.java
│ │ │ ├── README.md
│ │ │ ├── entity/
│ │ │ │ ├── Ball.java
│ │ │ │ ├── Innings.java
│ │ │ │ ├── Match.java
│ │ │ │ ├── Player.java
│ │ │ │ ├── PlayerStats.java
│ │ │ │ ├── Team.java
│ │ │ │ └── Wicket.java
│ │ │ ├── enums/
│ │ │ │ ├── ExtraType.java
│ │ │ │ ├── MatchStatus.java
│ │ │ │ ├── PlayerRole.java
│ │ │ │ └── WicketType.java
│ │ │ ├── observer/
│ │ │ │ ├── CommentaryDisplay.java
│ │ │ │ ├── MatchObserver.java
│ │ │ │ ├── ScorecardDisplay.java
│ │ │ │ └── UserNotifier.java
│ │ │ ├── repository/
│ │ │ │ ├── MatchRepository.java
│ │ │ │ └── PlayerRepository.java
│ │ │ ├── state/
│ │ │ │ ├── FinishedState.java
│ │ │ │ ├── InBreakState.java
│ │ │ │ ├── LiveState.java
│ │ │ │ ├── MatchState.java
│ │ │ │ └── ScheduledState.java
│ │ │ └── strategy/
│ │ │ ├── MatchFormatStrategy.java
│ │ │ ├── ODIFormatStrategy.java
│ │ │ └── T20FormatStrategy.java
│ │ ├── digitalwalletservice/
│ │ │ ├── Account.java
│ │ │ ├── BankAccount.java
│ │ │ ├── CreditCard.java
│ │ │ ├── Currency.java
│ │ │ ├── CurrencyConverter.java
│ │ │ ├── DigitalWallet.java
│ │ │ ├── DigitalWalletDemo.java
│ │ │ ├── InsufficientFundsException.java
│ │ │ ├── PaymentMethod.java
│ │ │ └── README.md
│ │ ├── elevatorsystem/
│ │ │ ├── Elevator.java
│ │ │ ├── ElevatorSystem.java
│ │ │ ├── ElevatorSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── enums/
│ │ │ │ ├── Direction.java
│ │ │ │ └── RequestSource.java
│ │ │ ├── models/
│ │ │ │ └── Request.java
│ │ │ ├── observer/
│ │ │ │ ├── ElevatorDisplay.java
│ │ │ │ └── ElevatorObserver.java
│ │ │ ├── state/
│ │ │ │ ├── ElevatorState.java
│ │ │ │ ├── IdleState.java
│ │ │ │ ├── MovingDownState.java
│ │ │ │ └── MovingUpState.java
│ │ │ └── strategy/
│ │ │ ├── ElevatorSelectionStrategy.java
│ │ │ └── NearestElevatorStrategy.java
│ │ ├── filedirectory/
│ │ │ ├── AbstractNode.java
│ │ │ ├── DirectoryNode.java
│ │ │ ├── FileNode.java
│ │ │ ├── FileSystem.java
│ │ │ ├── FileSystemDemo.java
│ │ │ ├── chainofresponsibility/
│ │ │ │ ├── FileSizeFilter.java
│ │ │ │ ├── FilenameFilter.java
│ │ │ │ ├── NodeFilter.java
│ │ │ │ └── NodeFilterChain.java
│ │ │ └── strategy/
│ │ │ ├── FilenameAndSizeSearchStrategy.java
│ │ │ └── NodeSearchStrategy.java
│ │ ├── fooddeliveryservice/
│ │ │ ├── FoodDeliveryService.java
│ │ │ ├── FoodDeliveryServiceDemo.java
│ │ │ ├── README.md
│ │ │ ├── entity/
│ │ │ │ ├── Address.java
│ │ │ │ ├── Customer.java
│ │ │ │ ├── DeliveryAgent.java
│ │ │ │ ├── Menu.java
│ │ │ │ ├── MenuItem.java
│ │ │ │ ├── Restaurant.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ └── OrderObserver.java
│ │ │ ├── order/
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderItem.java
│ │ │ │ └── OrderStatus.java
│ │ │ ├── search/
│ │ │ │ ├── RestaurantSearchStrategy.java
│ │ │ │ ├── SearchByCityStrategy.java
│ │ │ │ ├── SearchByMenuKeywordStrategy.java
│ │ │ │ └── SearchByProximityStrategy.java
│ │ │ └── strategy/
│ │ │ ├── DeliveryAssignmentStrategy.java
│ │ │ └── NearestAvailableAgentStrategy.java
│ │ ├── hotelmanagementsystem/
│ │ │ ├── BookingService.java
│ │ │ ├── HotelManagementDemo.java
│ │ │ ├── HotelManagerFacade.java
│ │ │ ├── PaymentService.java
│ │ │ ├── README.md
│ │ │ ├── RoomService.java
│ │ │ ├── decorator/
│ │ │ │ ├── AmenityDecorator.java
│ │ │ │ ├── Bookable.java
│ │ │ │ ├── BreakfastDecorator.java
│ │ │ │ ├── RoomBooking.java
│ │ │ │ └── SpaDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── BookingStatus.java
│ │ │ │ ├── RoomStyle.java
│ │ │ │ └── RoomType.java
│ │ │ ├── factory/
│ │ │ │ └── RoomFactory.java
│ │ │ ├── model/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── Guest.java
│ │ │ │ └── Room.java
│ │ │ ├── observer/
│ │ │ │ ├── BookingObserver.java
│ │ │ │ ├── EmailNotifier.java
│ │ │ │ └── SmsNotifier.java
│ │ │ ├── payment/
│ │ │ │ ├── CashPayment.java
│ │ │ │ ├── CreditCardPayment.java
│ │ │ │ └── Payment.java
│ │ │ ├── specification/
│ │ │ │ ├── AbstractSpecification.java
│ │ │ │ ├── AndSpecification.java
│ │ │ │ ├── RoomAvailableSpecification.java
│ │ │ │ ├── RoomStyleSpecification.java
│ │ │ │ ├── RoomTypeSpecification.java
│ │ │ │ └── Specification.java
│ │ │ └── state/
│ │ │ ├── AvailableState.java
│ │ │ ├── MaintenanceState.java
│ │ │ ├── OccupiedState.java
│ │ │ └── RoomState.java
│ │ ├── librarymanagementsystem/
│ │ │ ├── LibraryManagementDemo.java
│ │ │ ├── LibraryManagementSystem.java
│ │ │ ├── README.md
│ │ │ ├── TransactionService.java
│ │ │ ├── enums/
│ │ │ │ └── ItemType.java
│ │ │ ├── factory/
│ │ │ │ └── ItemFactory.java
│ │ │ ├── models/
│ │ │ │ ├── Book.java
│ │ │ │ ├── BookCopy.java
│ │ │ │ ├── LibraryItem.java
│ │ │ │ ├── Loan.java
│ │ │ │ ├── Magazine.java
│ │ │ │ └── Member.java
│ │ │ ├── state/
│ │ │ │ ├── AvailableState.java
│ │ │ │ ├── CheckedOutState.java
│ │ │ │ ├── ItemState.java
│ │ │ │ └── OnHoldState.java
│ │ │ └── strategy/
│ │ │ ├── SearchByAuthorStrategy.java
│ │ │ ├── SearchByTitleStrategy.java
│ │ │ └── SearchStrategy.java
│ │ ├── linkedin/
│ │ │ ├── LinkedInDemo.java
│ │ │ ├── LinkedInSystem.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Connection.java
│ │ │ │ ├── Education.java
│ │ │ │ ├── Experience.java
│ │ │ │ ├── Like.java
│ │ │ │ ├── Member.java
│ │ │ │ ├── NewsFeed.java
│ │ │ │ ├── Notification.java
│ │ │ │ ├── Post.java
│ │ │ │ └── Profile.java
│ │ │ ├── enums/
│ │ │ │ ├── ConnectionStatus.java
│ │ │ │ └── NotificationType.java
│ │ │ ├── observer/
│ │ │ │ ├── NotificationObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── ConnectionService.java
│ │ │ │ ├── NewsFeedService.java
│ │ │ │ ├── NotificationService.java
│ │ │ │ └── SearchService.java
│ │ │ └── strategy/
│ │ │ ├── ChronologicalSortStrategy.java
│ │ │ └── FeedSortingStrategy.java
│ │ ├── loggingframework/
│ │ │ ├── AsyncLogProcessor.java
│ │ │ ├── LogManager.java
│ │ │ ├── Logger.java
│ │ │ ├── LoggingFrameworkDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ └── LogMessage.java
│ │ │ ├── enums/
│ │ │ │ └── LogLevel.java
│ │ │ └── strategies/
│ │ │ ├── appender/
│ │ │ │ ├── ConsoleAppender.java
│ │ │ │ ├── FileAppender.java
│ │ │ │ └── LogAppender.java
│ │ │ └── formatter/
│ │ │ ├── LogFormatter.java
│ │ │ └── SimpleTextFormatter.java
│ │ ├── lrucache/
│ │ │ ├── DoublyLinkedList.java
│ │ │ ├── LRUCache.java
│ │ │ ├── LRUCacheDemo.java
│ │ │ ├── Node.java
│ │ │ └── README.md
│ │ ├── movieticketbookingsystem/
│ │ │ ├── BookingManager.java
│ │ │ ├── MovieBookingDemo.java
│ │ │ ├── MovieBookingService.java
│ │ │ ├── README.md
│ │ │ ├── SeatLockManager.java
│ │ │ ├── entities/
│ │ │ │ ├── Booking.java
│ │ │ │ ├── Cinema.java
│ │ │ │ ├── City.java
│ │ │ │ ├── Movie.java
│ │ │ │ ├── Payment.java
│ │ │ │ ├── Screen.java
│ │ │ │ ├── Seat.java
│ │ │ │ ├── Show.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── PaymentStatus.java
│ │ │ │ ├── SeatStatus.java
│ │ │ │ └── SeatType.java
│ │ │ ├── observer/
│ │ │ │ ├── MovieObserver.java
│ │ │ │ ├── MovieSubject.java
│ │ │ │ └── UserObserver.java
│ │ │ └── strategy/
│ │ │ ├── payment/
│ │ │ │ ├── CreditCardPaymentStrategy.java
│ │ │ │ └── PaymentStrategy.java
│ │ │ └── pricing/
│ │ │ ├── PricingStrategy.java
│ │ │ ├── WeekdayPricingStrategy.java
│ │ │ └── WeekendPricingStrategy.java
│ │ ├── musicstreamingservice/
│ │ │ ├── MusicStreamingDemo.java
│ │ │ ├── MusicStreamingSystem.java
│ │ │ ├── README.md
│ │ │ ├── command/
│ │ │ │ ├── Command.java
│ │ │ │ ├── NextTrackCommand.java
│ │ │ │ ├── PauseCommand.java
│ │ │ │ └── PlayCommand.java
│ │ │ ├── entities/
│ │ │ │ ├── Album.java
│ │ │ │ ├── Artist.java
│ │ │ │ ├── Playable.java
│ │ │ │ ├── Player.java
│ │ │ │ ├── Playlist.java
│ │ │ │ ├── Song.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── PlayerStatus.java
│ │ │ │ └── SubscriptionTier.java
│ │ │ ├── observer/
│ │ │ │ ├── ArtistObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── RecommendationService.java
│ │ │ │ └── SearchService.java
│ │ │ ├── state/
│ │ │ │ ├── PausedState.java
│ │ │ │ ├── PlayerState.java
│ │ │ │ ├── PlayingState.java
│ │ │ │ └── StoppedState.java
│ │ │ └── strategies/
│ │ │ ├── playback/
│ │ │ │ ├── FreePlaybackStrategy.java
│ │ │ │ ├── PlaybackStrategy.java
│ │ │ │ └── PremiumPlaybackStrategy.java
│ │ │ └── recommendation/
│ │ │ ├── GenreBasedRecommendationStrategy.java
│ │ │ └── RecommendationStrategy.java
│ │ ├── onlineauctionsystem/
│ │ │ ├── AuctionService.java
│ │ │ ├── AuctionSystemDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Auction.java
│ │ │ │ ├── Bid.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ └── AuctionStatus.java
│ │ │ └── observer/
│ │ │ └── AuctionObserver.java
│ │ ├── onlinelearningplatform/
│ │ │ └── README.md
│ │ ├── onlineshoppingservice/
│ │ │ ├── OnlineShoppingDemo.java
│ │ │ ├── OnlineShoppingSystem.java
│ │ │ ├── README.md
│ │ │ ├── decorator/
│ │ │ │ ├── GiftWrapDecorator.java
│ │ │ │ └── ProductDecorator.java
│ │ │ ├── enums/
│ │ │ │ ├── OrderStatus.java
│ │ │ │ └── ProductCategory.java
│ │ │ ├── exceptions/
│ │ │ │ └── OutOfStockException.java
│ │ │ ├── models/
│ │ │ │ ├── Account.java
│ │ │ │ ├── Address.java
│ │ │ │ ├── CartItem.java
│ │ │ │ ├── Customer.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderLineItem.java
│ │ │ │ ├── Product.java
│ │ │ │ └── ShoppingCart.java
│ │ │ ├── observer/
│ │ │ │ ├── OrderObserver.java
│ │ │ │ └── Subject.java
│ │ │ ├── services/
│ │ │ │ ├── InventoryService.java
│ │ │ │ ├── OrderService.java
│ │ │ │ ├── PaymentService.java
│ │ │ │ └── SearchService.java
│ │ │ ├── state/
│ │ │ │ ├── CancelledState.java
│ │ │ │ ├── DeliveredState.java
│ │ │ │ ├── OrderState.java
│ │ │ │ ├── PlacedState.java
│ │ │ │ └── ShippedState.java
│ │ │ └── strategy/
│ │ │ ├── CreditCardPaymentStrategy.java
│ │ │ ├── PaymentStrategy.java
│ │ │ └── UPIPaymentStrategy.java
│ │ ├── onlinestockbrokeragesystem/
│ │ │ ├── BuyOrder.java
│ │ │ ├── README.md
│ │ │ ├── SellOrder.java
│ │ │ ├── StockBrokerageSystem.java
│ │ │ ├── StockBrokerageSystemDemo.java
│ │ │ ├── StockExchange.java
│ │ │ ├── command/
│ │ │ │ ├── BuyStockCommand.java
│ │ │ │ ├── OrderCommand.java
│ │ │ │ └── SellStockCommand.java
│ │ │ ├── entities/
│ │ │ │ ├── Account.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderBuilder.java
│ │ │ │ ├── Stock.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── OrderStatus.java
│ │ │ │ ├── OrderType.java
│ │ │ │ └── TransactionType.java
│ │ │ ├── exceptions/
│ │ │ │ ├── InsufficientFundsException.java
│ │ │ │ └── InsufficientStockException.java
│ │ │ ├── observer/
│ │ │ │ └── StockObserver.java
│ │ │ ├── state/
│ │ │ │ ├── CancelledState.java
│ │ │ │ ├── FilledState.java
│ │ │ │ ├── OpenState.java
│ │ │ │ └── OrderState.java
│ │ │ └── strategy/
│ │ │ ├── ExecutionStrategy.java
│ │ │ ├── LimitOrderStrategy.java
│ │ │ └── MarketOrderStrategy.java
│ │ ├── parkinglot/
│ │ │ ├── ParkingLot.java
│ │ │ ├── ParkingLotDemo.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── ParkingFloor.java
│ │ │ │ ├── ParkingSpot.java
│ │ │ │ └── ParkingTicket.java
│ │ │ ├── strategy/
│ │ │ │ ├── fee/
│ │ │ │ │ ├── FeeStrategy.java
│ │ │ │ │ ├── FlatRateFeeStrategy.java
│ │ │ │ │ └── VehicleBasedFeeStrategy.java
│ │ │ │ └── parking/
│ │ │ │ ├── BestFitStrategy.java
│ │ │ │ ├── FarthestFirstStrategy.java
│ │ │ │ ├── NearestFirstStrategy.java
│ │ │ │ └── ParkingStrategy.java
│ │ │ └── vehicle/
│ │ │ ├── Bike.java
│ │ │ ├── Car.java
│ │ │ ├── Truck.java
│ │ │ ├── Vehicle.java
│ │ │ └── VehicleSize.java
│ │ ├── pubsubsystem/
│ │ │ ├── PubSubDemo.java
│ │ │ ├── PubSubService.java
│ │ │ ├── README.md
│ │ │ ├── entities/
│ │ │ │ ├── Message.java
│ │ │ │ └── Topic.java
│ │ │ └── subscriber/
│ │ │ ├── AlertSubscriber.java
│ │ │ ├── NewsSubscriber.java
│ │ │ └── Subscriber.java
│ │ ├── restaurantmanagementsystem/
│ │ │ ├── README.md
│ │ │ ├── RestaurantManagementSystem.java
│ │ │ ├── RestaurantManagementSystemDemo.java
│ │ │ ├── RestaurantManagementSystemFacade.java
│ │ │ ├── command/
│ │ │ │ ├── Command.java
│ │ │ │ ├── PrepareOrderCommand.java
│ │ │ │ └── ServeOrderCommand.java
│ │ │ ├── decorator/
│ │ │ │ ├── BaseBill.java
│ │ │ │ ├── Bill.java
│ │ │ │ ├── BillComponent.java
│ │ │ │ ├── BillDecorator.java
│ │ │ │ ├── ServiceChargeDecorator.java
│ │ │ │ └── TaxDecorator.java
│ │ │ ├── enums/
│ │ │ │ └── TableStatus.java
│ │ │ ├── model/
│ │ │ │ ├── Chef.java
│ │ │ │ ├── Menu.java
│ │ │ │ ├── MenuItem.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── OrderItem.java
│ │ │ │ ├── Restaurant.java
│ │ │ │ ├── Staff.java
│ │ │ │ ├── Table.java
│ │ │ │ └── Waiter.java
│ │ │ ├── observer/
│ │ │ │ └── OrderObserver.java
│ │ │ └── state/
│ │ │ ├── OrderItemState.java
│ │ │ ├── OrderedState.java
│ │ │ ├── PreparingState.java
│ │ │ ├── ReadyForPickupState.java
│ │ │ └── ServedState.java
│ │ ├── ridesharingservice/
│ │ │ ├── README.md
│ │ │ ├── RideSharingService.java
│ │ │ ├── RideSharingServiceDemo.java
│ │ │ ├── entities/
│ │ │ │ ├── Driver.java
│ │ │ │ ├── Location.java
│ │ │ │ ├── Trip.java
│ │ │ │ ├── User.java
│ │ │ │ └── Vehicle.java
│ │ │ ├── enums/
│ │ │ │ ├── DriverStatus.java
│ │ │ │ ├── RideType.java
│ │ │ │ └── TripStatus.java
│ │ │ ├── observer/
│ │ │ │ ├── Rider.java
│ │ │ │ └── TripObserver.java
│ │ │ ├── state/
│ │ │ │ ├── AssignedState.java
│ │ │ │ ├── CompletedState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ ├── RequestedState.java
│ │ │ │ └── TripState.java
│ │ │ └── strategy/
│ │ │ ├── matching/
│ │ │ │ ├── DriverMatchingStrategy.java
│ │ │ │ └── NearestDriverMatchingStrategy.java
│ │ │ └── pricing/
│ │ │ ├── FlatRatePricingStrategy.java
│ │ │ ├── PricingStrategy.java
│ │ │ └── VehicleBasedPricingStrategy.java
│ │ ├── snakeandladdergame/
│ │ │ ├── Game.java
│ │ │ ├── README.md
│ │ │ ├── SnakeAndLadderDemo.java
│ │ │ ├── enums/
│ │ │ │ └── GameStatus.java
│ │ │ └── models/
│ │ │ ├── Board.java
│ │ │ ├── BoardEntity.java
│ │ │ ├── Dice.java
│ │ │ ├── Ladder.java
│ │ │ ├── Player.java
│ │ │ └── Snake.java
│ │ ├── socialnetworkingservice/
│ │ │ ├── README.md
│ │ │ ├── SocialNetworkDemo.java
│ │ │ ├── SocialNetworkFacade.java
│ │ │ ├── model/
│ │ │ │ ├── Comment.java
│ │ │ │ ├── CommentableEntity.java
│ │ │ │ ├── Post.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ ├── PostObserver.java
│ │ │ │ └── UserNotifier.java
│ │ │ ├── repository/
│ │ │ │ ├── PostRepository.java
│ │ │ │ └── UserRepository.java
│ │ │ ├── service/
│ │ │ │ ├── NewsFeedService.java
│ │ │ │ ├── PostService.java
│ │ │ │ └── UserService.java
│ │ │ └── strategy/
│ │ │ ├── ChronologicalStrategy.java
│ │ │ └── NewsFeedGenerationStrategy.java
│ │ ├── splitwise/
│ │ │ ├── README.md
│ │ │ ├── SplitwiseDemo.java
│ │ │ ├── SplitwiseService.java
│ │ │ ├── entities/
│ │ │ │ ├── BalanceSheet.java
│ │ │ │ ├── Expense.java
│ │ │ │ ├── Group.java
│ │ │ │ ├── Split.java
│ │ │ │ ├── Transaction.java
│ │ │ │ └── User.java
│ │ │ └── strategy/
│ │ │ ├── EqualSplitStrategy.java
│ │ │ ├── ExactSplitStrategy.java
│ │ │ ├── PercentageSplitStrategy.java
│ │ │ └── SplitStrategy.java
│ │ ├── stackoverflow/
│ │ │ ├── README.md
│ │ │ ├── StackOverflowDemo.java
│ │ │ ├── StackOverflowService.java
│ │ │ ├── entities/
│ │ │ │ ├── Answer.java
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Content.java
│ │ │ │ ├── Event.java
│ │ │ │ ├── Post.java
│ │ │ │ ├── Question.java
│ │ │ │ ├── Tag.java
│ │ │ │ └── User.java
│ │ │ ├── enums/
│ │ │ │ ├── EventType.java
│ │ │ │ └── VoteType.java
│ │ │ ├── observer/
│ │ │ │ ├── PostObserver.java
│ │ │ │ └── ReputationManager.java
│ │ │ └── strategy/
│ │ │ ├── KeywordSearchStrategy.java
│ │ │ ├── SearchStrategy.java
│ │ │ ├── TagSearchStrategy.java
│ │ │ └── UserSearchStrategy.java
│ │ ├── taskmanagementsystem/
│ │ │ ├── README.md
│ │ │ ├── TaskManagementSystem.java
│ │ │ ├── TaskManagementSystemDemo.java
│ │ │ ├── enums/
│ │ │ │ ├── TaskPriority.java
│ │ │ │ └── TaskStatus.java
│ │ │ ├── models/
│ │ │ │ ├── ActivityLog.java
│ │ │ │ ├── Comment.java
│ │ │ │ ├── Tag.java
│ │ │ │ ├── Task.java
│ │ │ │ ├── TaskList.java
│ │ │ │ └── User.java
│ │ │ ├── observer/
│ │ │ │ ├── ActivityLogger.java
│ │ │ │ └── TaskObserver.java
│ │ │ ├── state/
│ │ │ │ ├── DoneState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ ├── TaskState.java
│ │ │ │ └── TodoState.java
│ │ │ └── strategy/
│ │ │ ├── SortByDueDate.java
│ │ │ ├── SortByPriority.java
│ │ │ └── TaskSortStrategy.java
│ │ ├── tictactoe/
│ │ │ ├── Game.java
│ │ │ ├── README.md
│ │ │ ├── TicTacToeDemo.java
│ │ │ ├── TicTacToeSystem.java
│ │ │ ├── enums/
│ │ │ │ ├── GameStatus.java
│ │ │ │ └── Symbol.java
│ │ │ ├── exceptions/
│ │ │ │ └── InvalidMoveException.java
│ │ │ ├── models/
│ │ │ │ ├── Board.java
│ │ │ │ ├── Cell.java
│ │ │ │ └── Player.java
│ │ │ ├── observer/
│ │ │ │ ├── GameObserver.java
│ │ │ │ ├── GameSubject.java
│ │ │ │ └── Scoreboard.java
│ │ │ ├── state/
│ │ │ │ ├── DrawState.java
│ │ │ │ ├── GameState.java
│ │ │ │ ├── InProgressState.java
│ │ │ │ └── WinnerState.java
│ │ │ └── strategy/
│ │ │ ├── ColumnWinningStrategy.java
│ │ │ ├── DiagonalWinningStrategy.java
│ │ │ ├── RowWinningStrategy.java
│ │ │ └── WinningStrategy.java
│ │ ├── trafficsignalcontrolsystem/
│ │ │ ├── IntersectionController.java
│ │ │ ├── README.md
│ │ │ ├── TrafficControlSystem.java
│ │ │ ├── TrafficLight.java
│ │ │ ├── TrafficSystemDemo.java
│ │ │ ├── enums/
│ │ │ │ ├── Direction.java
│ │ │ │ └── LightColor.java
│ │ │ ├── observer/
│ │ │ │ ├── CentralMonitor.java
│ │ │ │ └── TrafficObserver.java
│ │ │ └── states/
│ │ │ ├── intersection/
│ │ │ │ ├── EastWestGreenState.java
│ │ │ │ ├── IntersectionState.java
│ │ │ │ └── NorthSouthGreenState.java
│ │ │ └── light/
│ │ │ ├── GreenState.java
│ │ │ ├── RedState.java
│ │ │ ├── SignalState.java
│ │ │ └── YellowState.java
│ │ ├── vendingmachine/
│ │ │ ├── README.md
│ │ │ ├── VendingMachine.java
│ │ │ ├── VendingMachineDemo.java
│ │ │ ├── entity/
│ │ │ │ ├── Inventory.java
│ │ │ │ └── Item.java
│ │ │ ├── enums/
│ │ │ │ └── Coin.java
│ │ │ └── state/
│ │ │ ├── DispensingState.java
│ │ │ ├── HasMoneyState.java
│ │ │ ├── IdleState.java
│ │ │ ├── ItemSelectedState.java
│ │ │ └── VendingMachineState.java
│ │ └── votingsystem/
│ │ ├── Candidate.java
│ │ ├── README.md
│ │ ├── VoteRecord.java
│ │ ├── Voter.java
│ │ ├── VotingSystem.java
│ │ └── VotingSystemDemo.java
│ └── test/
│ └── coffeevendingmachine/
│ └── CoffeeVendingMachineTest.java
├── python/
│ ├── .gitignore
│ ├── airlinemanagementsystem/
│ │ └── README.md
│ ├── atm/
│ │ └── README.md
│ ├── carrentalsystem/
│ │ └── README.md
│ ├── chessgame/
│ │ └── README.md
│ ├── coffeevendingmachine/
│ │ └── README.md
│ ├── concertticketbookingsystem/
│ │ └── README.md
│ ├── courseregistrationsystem/
│ │ └── README.md
│ ├── cricinfo/
│ │ └── README.md
│ ├── digitalwalletservice/
│ │ └── README.md
│ ├── elevatorsystem/
│ │ └── README.md
│ ├── fooddeliveryservice/
│ │ └── README.md
│ ├── hotelmanagementsystem/
│ │ └── README.md
│ ├── librarymanagementsystem/
│ │ └── README.md
│ ├── linkedin/
│ │ └── README.md
│ ├── loggingframework/
│ │ └── README.md
│ ├── lrucache/
│ │ └── README.md
│ ├── movieticketbookingsystem/
│ │ └── README.md
│ ├── musicstreamingservice/
│ │ └── README.md
│ ├── onlineauctionsystem/
│ │ └── README.md
│ ├── onlinestockbrokeragesystem/
│ │ └── README.md
│ ├── parkinglot/
│ │ └── README.md
│ ├── pubsubsystem/
│ │ └── README.md
│ ├── restaurantmanagementsystem/
│ │ └── README.md
│ ├── ridesharingservice/
│ │ └── README.md
│ ├── snakeandladdergame/
│ │ └── README.md
│ ├── socialnetworkingservice/
│ │ └── README.md
│ ├── splitwise/
│ │ └── README.md
│ ├── stackoverflow/
│ │ └── README.md
│ ├── taskmanagementsystem/
│ │ └── README.md
│ ├── tictactoe/
│ │ └── README.md
│ ├── trafficsignalsystem/
│ │ └── README.md
│ ├── vendingmachine/
│ │ └── README.md
│ └── votingsystem/
│ └── README.md
└── typescript/
├── .gitignore
├── README.md
├── package.json
├── src/
│ ├── CoffeeVendingMachine/
│ │ ├── CoffeeRecipe.ts
│ │ ├── CoffeeVendingMachine.ts
│ │ ├── CoffeeVendingMachineDemo.ts
│ │ ├── Dispenser.ts
│ │ ├── IngredientStore.ts
│ │ ├── Payment.ts
│ │ ├── PaymentProcessor.ts
│ │ └── README.md
│ ├── LoggingFramework/
│ │ ├── Appender/
│ │ │ ├── ConsoleLogAppender.ts
│ │ │ ├── FileLogAppender.ts
│ │ │ └── LogAppender.ts
│ │ ├── LogFormatter/
│ │ │ ├── LogFormatter.ts
│ │ │ └── SimpleLogFormatter.ts
│ │ ├── LogLevel.ts
│ │ ├── LogManager.ts
│ │ ├── LogMessage.ts
│ │ ├── Logger.ts
│ │ ├── LoggingFrameworkDemo.ts
│ │ └── README.md
│ ├── ParkingLot/
│ │ ├── Floor.ts
│ │ ├── Main.ts
│ │ ├── ParkingLot.ts
│ │ ├── Spot.ts
│ │ ├── Vehicle.ts
│ │ ├── readme.md
│ │ └── types.ts
│ ├── StackOverflow/
│ │ ├── Answer.ts
│ │ ├── Comment.ts
│ │ ├── Commentable.ts
│ │ ├── Question.ts
│ │ ├── README.md
│ │ ├── ReputationType.ts
│ │ ├── StackOverflow.ts
│ │ ├── StackOverflowDemo.ts
│ │ ├── Tag.ts
│ │ ├── User.ts
│ │ ├── Votable.ts
│ │ ├── Vote.ts
│ │ └── VoteTypeEnum.ts
│ ├── TaskManagement/
│ │ ├── ActivityLog.ts
│ │ ├── Comment.ts
│ │ ├── README.md
│ │ ├── SortingStrategy/
│ │ │ ├── SortByDueDate.ts
│ │ │ ├── SortByPriority.ts
│ │ │ └── TaskSortingStrategy.ts
│ │ ├── Task.ts
│ │ ├── TaskList.ts
│ │ ├── TaskManagementSystem.ts
│ │ ├── TaskManagementSystemDemo.ts
│ │ ├── TaskPriorityEnum.ts
│ │ ├── TaskStatusEnum.ts
│ │ └── User.ts
│ ├── TrafficSignalSystem/
│ │ ├── Direction.ts
│ │ ├── Intersection.ts
│ │ ├── README.md
│ │ ├── SignalState/
│ │ │ ├── GreenState.ts
│ │ │ ├── RedState.ts
│ │ │ ├── SignalState.ts
│ │ │ └── YellowState.ts
│ │ ├── TrafficLight.ts
│ │ ├── TrafficSignalController.ts
│ │ └── TrafficSignalSystemDemo.ts
│ ├── VendingMachine/
│ │ ├── Coin.ts
│ │ ├── Inventory.ts
│ │ ├── Item.ts
│ │ ├── README.md
│ │ ├── VendingMachine.ts
│ │ ├── VendingMachineDemo.ts
│ │ └── VendingMachineState/
│ │ ├── DispensingState.ts
│ │ ├── HasMoneyState.ts
│ │ ├── IdleState.ts
│ │ ├── ItemSelectedState.ts
│ │ └── VendingMachineState.ts
│ └── lldrunner.ts
└── tsconfig.json
Showing preview only (751K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (8478 symbols across 2248 files)
FILE: design-patterns/Javascript/Behavioral Pattern/Chain of Responsibilites/supportRequest.js
class supportHandler (line 3) | class supportHandler {
method constructor (line 4) | constructor(nextHandler) {
method handleRequest (line 9) | handleRequest(request, type) {
class InternetConnectionTeam (line 20) | class InternetConnectionTeam extends supportHandler {
method handleRequest (line 21) | handleRequest(request, type) {
class InternetSupportTeam (line 39) | class InternetSupportTeam extends supportHandler {
method handleRequest (line 40) | handleRequest(request, type) {
class PhoneConnectionTeam (line 53) | class PhoneConnectionTeam extends supportHandler {
method handleRequest (line 54) | handleRequest(request, type) {
class PhoneSupportTeam (line 72) | class PhoneSupportTeam extends supportHandler {
method handleRequest (line 73) | handleRequest(request, type) {
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/command.js
class Command (line 2) | class Command {
method execute (line 3) | execute() {}
class LightOnCommand (line 7) | class LightOnCommand extends Command {
method constructor (line 8) | constructor(light) {
method execute (line 13) | execute() {
class LightOffCommand (line 17) | class LightOffCommand extends Command {
method constructor (line 18) | constructor(light) {
method execute (line 23) | execute() {
class FanOnCommand (line 29) | class FanOnCommand extends Command {
method constructor (line 30) | constructor(fan) {
method execute (line 35) | execute() {
class FanOffCommand (line 41) | class FanOffCommand extends Command {
method constructor (line 42) | constructor(fan) {
method execute (line 47) | execute() {
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/invoker.js
class RemoteControl (line 2) | class RemoteControl {
method setCommand (line 3) | setCommand(command) {
method pressButton (line 7) | pressButton() {
FILE: design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/receiver.js
class Light (line 2) | class Light {
method turnOn (line 3) | turnOn() {
method turnOff (line 7) | turnOff() {
class Fan (line 13) | class Fan {
method turnOn (line 14) | turnOn() {
method turnOff (line 18) | turnOff() {
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/aggregate.js
class Aggregate (line 4) | class Aggregate {
method createIterator (line 5) | createIterator() {
class ConcreteAggregate (line 10) | class ConcreteAggregate extends Aggregate {
method constructor (line 11) | constructor() {
method addBook (line 16) | addBook(book) {
method createIterator (line 20) | createIterator() {
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/book.js
class Book (line 1) | class Book {
method constructor (line 2) | constructor(title, author) {
method getDetails (line 7) | getDetails() {
FILE: design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/iterator.js
class Iterator (line 1) | class Iterator {
method next (line 2) | next() {
method hasNext (line 6) | hasNext() {
class LibraryIterator (line 12) | class LibraryIterator extends Iterator {
method constructor (line 13) | constructor(collection) {
method hasNext (line 19) | hasNext() {
method next (line 24) | next() {
FILE: design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/mediator.js
class Mediator (line 2) | class Mediator {
method register (line 3) | register(user) {
method send (line 7) | send(message, user) {
class ChatRoom (line 13) | class ChatRoom extends Mediator {
method constructor (line 14) | constructor() {
method register (line 19) | register(user) {
method send (line 23) | send(message, from) {
FILE: design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/user.js
class User (line 1) | class User {
method constructor (line 2) | constructor(name, mediator) {
method send (line 7) | send(message) {
method receive (line 12) | receive(message) {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/canvas.js
class DrawingCanvas (line 4) | class DrawingCanvas {
method constructor (line 5) | constructor() {
method addShape (line 10) | addShape(shape) {
method removeLastShape (line 15) | removeLastShape() {
method save (line 20) | save() {
method restore (line 25) | restore(memento) {
method show (line 30) | show() {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/careTaker.js
class History (line 3) | class History {
method constructor (line 4) | constructor() {
method saveMemento (line 9) | saveMemento(memento) {
method getMemento (line 14) | getMemento(index) {
method removeMemento (line 19) | removeMemento() {
method getLatestMemento (line 22) | getLatestMemento() {
method removeLastMemento (line 28) | removeLastMemento() {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/memento.js
class CanvasMemento (line 2) | class CanvasMemento {
method constructor (line 3) | constructor(state) {
method getState (line 8) | getState() {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/careTaker.js
class CareTaker (line 3) | class CareTaker {
method constructor (line 4) | constructor() {
method saveMemento (line 8) | saveMemento(memento) {
method getMemento (line 12) | getMemento(index) {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/memento.js
class Memento (line 2) | class Memento {
method constructor (line 3) | constructor(state) {
method getState (line 7) | getState() {
FILE: design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/orginator.js
class TextEditor (line 5) | class TextEditor {
method constructor (line 6) | constructor() {
method write (line 10) | write(content) {
method getContent (line 14) | getContent() {
method save (line 18) | save() {
method restore (line 22) | restore(memento) {
FILE: design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/observer.js
class Observer (line 1) | class Observer {
method update (line 2) | update(temperature) {
class WebUI (line 7) | class WebUI extends Observer {
method update (line 8) | update(temperature) {
class MobileUI (line 13) | class MobileUI extends Observer {
method update (line 14) | update(temperature) {
FILE: design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/publisher.js
class WeatherStation (line 1) | class WeatherStation {
method constructor (line 2) | constructor() {
method addObserver (line 8) | addObserver(observer) {
method removeObserver (line 13) | removeObserver(observer) {
method notifyObservers (line 18) | notifyObservers() {
method setTemperature (line 23) | setTemperature(temperature) {
FILE: design-patterns/Javascript/Behavioral Pattern/State Design Pattern/context.js
class Phone (line 4) | class Phone {
method constructor (line 5) | constructor() {
method setState (line 8) | setState(state) {
method alert (line 11) | alert() {
method answer (line 14) | answer() {
method hangup (line 17) | hangup() {
FILE: design-patterns/Javascript/Behavioral Pattern/State Design Pattern/state.js
class PhoneState (line 2) | class PhoneState {
method alert (line 3) | alert() {}
method answer (line 4) | answer() {}
method hangup (line 5) | hangup() {}
class Ringing (line 11) | class Ringing extends PhoneState {
method alert (line 12) | alert() {
method answer (line 15) | answer(context) {
method hangup (line 19) | hangup() {
class InCall (line 25) | class InCall extends PhoneState {
method alert (line 26) | alert() {
method answer (line 29) | answer() {
method hangup (line 32) | hangup(context) {
class Idle (line 39) | class Idle extends PhoneState {
method alert (line 40) | alert() {
method answer (line 43) | answer() {
method hangup (line 47) | hangup() {
FILE: design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/paymentStrategy.js
class PaymentGateway (line 5) | class PaymentGateway {
method pay (line 6) | pay(amount) {
class Cash (line 14) | class Cash extends PaymentGateway {
method pay (line 15) | pay(amount) {
class UPI (line 21) | class UPI extends PaymentGateway {
method constructor (line 22) | constructor(UPI_ID, UPI_PIN) {
method pay (line 27) | pay(amount) {
class Card (line 35) | class Card extends PaymentGateway {
method constructor (line 36) | constructor(cardNumber, CVV) {
method pay (line 41) | pay(amount) {
class InternetBanking (line 49) | class InternetBanking extends PaymentGateway {
method constructor (line 50) | constructor(accountNumber, IFSC) {
method pay (line 55) | pay(amount) {
FILE: design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/shoppingCart_Context.js
class ShoppinCart (line 3) | class ShoppinCart {
method constructor (line 4) | constructor() {
method addItem (line 10) | addItem(item) {
method viewCart (line 15) | viewCart() {
method setPaymentMethod (line 23) | setPaymentMethod(paymentMethod) {
method checkout (line 28) | checkout() {
FILE: design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beverages.js
class Food (line 2) | class Food {
method prepareFood (line 3) | prepareFood() {
method boilWater (line 11) | boilWater() {
method brew (line 14) | brew() {
method pourInCup (line 18) | pourInCup() {
method addCondiments (line 21) | addCondiments() {
method noNeedVegetables (line 26) | noNeedVegetables() {
method addVegetables (line 32) | addVegetables() {
method shouldAddVegetables (line 37) | shouldAddVegetables() {
FILE: design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beveragesTypes.js
class Tea (line 6) | class Tea extends Food {
method brew (line 7) | brew() {
method addCondiments (line 11) | addCondiments() {
method addVegetables (line 15) | addVegetables() {
method shouldAddVegetables (line 19) | shouldAddVegetables() {
class Coffee (line 24) | class Coffee extends Food {
method brew (line 25) | brew() {
method addCondiments (line 29) | addCondiments() {
FILE: design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/element.js
class Shape (line 2) | class Shape {
method accept (line 3) | accept(visitor) {
class Circle (line 8) | class Circle extends Shape {
method constructor (line 9) | constructor(radius) {
method accept (line 14) | accept(visitor) {
class Rectangle (line 18) | class Rectangle extends Shape {
method constructor (line 19) | constructor(width, height) {
method accept (line 25) | accept(visitor) {
FILE: design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/visitor.js
class ShapeVisitor (line 2) | class ShapeVisitor {
method visitCircle (line 3) | visitCircle(circle) {
method visitRectangle (line 7) | visitRectangle(rectangle) {
class AreaVisitor (line 13) | class AreaVisitor extends ShapeVisitor {
method visitCircle (line 14) | visitCircle(circle) {
method visitRectangle (line 19) | visitRectangle(rectangle) {
class PerimeterVisitor (line 25) | class PerimeterVisitor extends ShapeVisitor {
method visitCircle (line 26) | visitCircle(circle) {
method visitRectangle (line 31) | visitRectangle(rectangle) {
FILE: design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/abstract.js
class Chair (line 2) | class Chair {
method sitOn (line 3) | sitOn() {
class Sofa (line 8) | class Sofa {
method lieOn (line 9) | lieOn() {
class ModernChair (line 15) | class ModernChair extends Chair {
method sitOn (line 16) | sitOn() {
class ModernSofa (line 21) | class ModernSofa extends Sofa {
method lieOn (line 22) | lieOn() {
class ClassicChair (line 28) | class ClassicChair extends Chair {
method sitOn (line 29) | sitOn() {
class ClassicSofa (line 34) | class ClassicSofa extends Sofa {
method lieOn (line 35) | lieOn() {
class FurnitureFactory (line 41) | class FurnitureFactory {
method createChair (line 42) | createChair() {
method createSofa (line 45) | createSofa() {
class ModernFurnitureFactory (line 51) | class ModernFurnitureFactory extends FurnitureFactory {
method createChair (line 52) | createChair() {
method createSofa (line 55) | createSofa() {
class ClassicFurnitureFactory (line 61) | class ClassicFurnitureFactory extends FurnitureFactory {
method createChair (line 62) | createChair() {
method createSofa (line 65) | createSofa() {
FILE: design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/main.js
function createFurniture (line 6) | function createFurniture(factory) {
FILE: design-patterns/Javascript/Creational Pattern/Builder Design Pattern/computerBuilder.js
class Computer (line 1) | class Computer {
method constructor (line 2) | constructor(builder) {
class ComputerBuilder (line 10) | class ComputerBuilder {
method constructor (line 11) | constructor(cpu, ram) {
method addStorage (line 17) | addStorage(hardDisk) {
method addMoniter (line 22) | addMoniter(moniter) {
method build (line 27) | build() {
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/factory.js
class pizzaFactory (line 3) | class pizzaFactory {
method createPizza (line 4) | static createPizza(pizzaType) {
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/main.js
function main (line 3) | function main() {
FILE: design-patterns/Javascript/Creational Pattern/Factory Design Pattern/pizza.js
class Pizza (line 1) | class Pizza {
method prepare (line 2) | prepare() {
method bake (line 5) | bake() {
method cut (line 8) | cut() {
method box (line 11) | box() {
class cheesePizza (line 16) | class cheesePizza extends Pizza {
method prepare (line 17) | prepare() {
class pepperoniPizza (line 22) | class pepperoniPizza extends Pizza {
method prepare (line 23) | prepare() {
FILE: design-patterns/Javascript/Creational Pattern/Prototype Design Pattern/app.js
class Car (line 1) | class Car{
method constructor (line 2) | constructor(model, year, color){
method clone (line 8) | clone(){ // Clone method to clone the current object
method getDetails (line 12) | getDetails(){
FILE: design-patterns/Javascript/Creational Pattern/Singleton Design Pattern/singleton.js
class Singleton (line 4) | class Singleton {
method constructor (line 5) | constructor() {
method increment (line 15) | increment() {
method getData (line 20) | getData() {
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/adapter.js
class USB_Adapter (line 5) | class USB_Adapter {
method constructor (line 6) | constructor(connector) {
method plugIn (line 10) | plugIn() {
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbA_connector.js
class USB_A_Connector (line 5) | class USB_A_Connector {
method connect (line 6) | connect() {
FILE: design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbC_device.js
class USB_C_Device (line 5) | class USB_C_Device {
method plugIn (line 6) | plugIn() {
FILE: design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/device.js
class Device (line 4) | class Device {
method turnOn (line 5) | turnOn() {
method turnOff (line 8) | turnOff() {
class TV (line 14) | class TV extends Device {
method turnOn (line 15) | turnOn() {
method turnOff (line 19) | turnOff() {
class Radio (line 25) | class Radio extends Device {
method turnOn (line 26) | turnOn() {
method turnOff (line 30) | turnOff() {
FILE: design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/remoteControl.js
class RemoteControl (line 3) | class RemoteControl {
method constructor (line 4) | constructor(device) {
method pressOn (line 8) | pressOn() {
method pressOff (line 12) | pressOff() {
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/component.js
class Component (line 3) | class Component {
method showDetails (line 4) | showDetails() {
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/file.js
class File (line 3) | class File extends Component {
method constructor (line 4) | constructor(name) {
method showDetails (line 9) | showDetails() {
FILE: design-patterns/Javascript/Structural Pattern/Composite Design Pattern/folder.js
class Folder (line 5) | class Folder extends Component {
method constructor (line 6) | constructor(name) {
method add (line 12) | add(file) {
method showDetails (line 16) | showDetails() {
FILE: design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/additional.js
class Cream (line 3) | class Cream {
method constructor (line 4) | constructor(coffee) {
method cost (line 8) | cost() {
class Sugar (line 13) | class Sugar {
method constructor (line 14) | constructor(coffee) {
method cost (line 18) | cost() {
class Ice (line 23) | class Ice{
method constructor (line 24) | constructor(coffee) {
method cost (line 28) | cost() {
FILE: design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/coffee.js
class Coffee (line 3) | class Coffee {
method cost (line 4) | cost() {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/dvdPlayer.js
class DVDPlayer (line 3) | class DVDPlayer {
method on (line 4) | on() {
method play (line 7) | play(movie) {
method off (line 11) | off() {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/lights.js
class Lights (line 3) | class Lights {
method on (line 4) | on() {
method off (line 8) | off() {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/movieFacade.js
class MovieFacade (line 7) | class MovieFacade {
method constructor (line 8) | constructor() {
method watchMovie (line 16) | watchMovie(movie) {
method getSnacks (line 27) | getSnacks(snacks) {
method endMovie (line 34) | endMovie() {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/projector.js
class Projector (line 3) | class Projector {
method on (line 4) | on() {
method connect (line 8) | connect(source) {
method off (line 12) | off() {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/snacks.js
class Snacks (line 3) | class Snacks {
method noteOrder (line 4) | noteOrder(snacks) {
method prepare (line 7) | prepare() {
method serve (line 11) | serve(snacks) {
FILE: design-patterns/Javascript/Structural Pattern/Facade Design Pattern/soundSystem.js
class SoundSystem (line 3) | class SoundSystem {
method on (line 4) | on() {
method setVolume (line 8) | setVolume(volume) {
method off (line 12) | off() {
FILE: design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circle.js
class Circle (line 2) | class Circle{
method constructor (line 3) | constructor(color){
method draw (line 7) | draw(size, x, y){
FILE: design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circleFactory.js
class CircleFactory (line 5) | class CircleFactory {
method constructor (line 6) | constructor() {
method getCircle (line 10) | getCircle(color) {
FILE: design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/proxyImage.js
class ProxyImage (line 5) | class ProxyImage {
method constructor (line 6) | constructor(fileName) {
method display (line 11) | display() {
FILE: design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/real_Image.js
class realImage (line 1) | class realImage {
method constructor (line 2) | constructor(fileName) {
method loadFromDisk (line 7) | loadFromDisk() {
method display (line 11) | display() {
FILE: design-patterns/cpp/adapter/in_house_payment_processor.h
function class (line 5) | class InHousePaymentProcessor : public PaymentProcessor {
FILE: design-patterns/cpp/adapter/legacy_gateway.h
function class (line 4) | class LegacyGateway {
FILE: design-patterns/cpp/adapter/legacy_gateway_adapter.h
function class (line 5) | class LegacyGatewayAdapter : public PaymentProcessor {
FILE: design-patterns/cpp/adapter/main.cpp
function main (line 6) | int main() {
FILE: design-patterns/cpp/adapter/payment_processor.h
function class (line 4) | class PaymentProcessor {
FILE: design-patterns/cpp/bridge/circle.h
function class (line 4) | class Circle : public Shape {
FILE: design-patterns/cpp/bridge/main.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/bridge/raster_renderer.h
function class (line 4) | class RasterRenderer : public Renderer {
FILE: design-patterns/cpp/bridge/rectangle.h
function class (line 4) | class Rectangle : public Shape {
FILE: design-patterns/cpp/bridge/renderer.h
function class (line 3) | class Renderer {
FILE: design-patterns/cpp/bridge/shape.h
function class (line 4) | class Shape {
FILE: design-patterns/cpp/bridge/vector_renderer.h
function class (line 4) | class VectorRenderer : public Renderer {
FILE: design-patterns/cpp/builder/http_request.h
function class (line 6) | class HttpRequest {
FILE: design-patterns/cpp/builder/http_request_builder.cpp
function HttpRequest (line 37) | HttpRequest HttpRequest::Builder::build() {
FILE: design-patterns/cpp/builder/main.cpp
function main (line 5) | int main() {
FILE: design-patterns/cpp/chainofresponsibility/auth_handler.h
function class (line 5) | class AuthHandler : public BaseHandler {
FILE: design-patterns/cpp/chainofresponsibility/authorization_handler.h
function class (line 5) | class AuthorizationHandler : public BaseHandler {
FILE: design-patterns/cpp/chainofresponsibility/base_handler.h
function class (line 4) | class BaseHandler : public RequestHandler {
FILE: design-patterns/cpp/chainofresponsibility/business_logic_handler.h
function class (line 5) | class BusinessLogicHandler : public BaseHandler {
FILE: design-patterns/cpp/chainofresponsibility/main.cpp
function main (line 9) | int main() {
FILE: design-patterns/cpp/chainofresponsibility/rate_limit_handler.h
function class (line 5) | class RateLimitHandler : public BaseHandler {
FILE: design-patterns/cpp/chainofresponsibility/request.h
function class (line 4) | class Request {
FILE: design-patterns/cpp/chainofresponsibility/request_handler.h
function class (line 4) | class RequestHandler {
FILE: design-patterns/cpp/chainofresponsibility/validation_handler.h
function class (line 5) | class ValidationHandler : public BaseHandler {
FILE: design-patterns/cpp/composite/file.h
function class (line 5) | class File : public FileSystemItem {
FILE: design-patterns/cpp/composite/file_system_item.h
function class (line 4) | class FileSystemItem {
FILE: design-patterns/cpp/composite/folder.h
function class (line 7) | class Folder : public FileSystemItem {
FILE: design-patterns/cpp/composite/main.cpp
function main (line 6) | int main() {
FILE: design-patterns/cpp/decorator/bold_decorator.h
function class (line 4) | class BoldDecorator : public TextDecorator {
FILE: design-patterns/cpp/decorator/italic_decorator.h
function class (line 4) | class ItalicDecorator : public TextDecorator {
FILE: design-patterns/cpp/decorator/main.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/decorator/plain_text_view.h
function class (line 5) | class PlainTextView : public TextView {
FILE: design-patterns/cpp/decorator/text_decorator.h
function class (line 4) | class TextDecorator : public TextView {
FILE: design-patterns/cpp/decorator/text_view.h
function class (line 3) | class TextView {
FILE: design-patterns/cpp/decorator/underline_decorator.h
function class (line 4) | class UnderlineDecorator : public TextDecorator {
FILE: design-patterns/cpp/facade/build_system.h
function class (line 7) | class BuildSystem {
FILE: design-patterns/cpp/facade/deployment_facade.h
function class (line 9) | class DeploymentFacade {
FILE: design-patterns/cpp/facade/deployment_target.h
function class (line 7) | class DeploymentTarget {
FILE: design-patterns/cpp/facade/main.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/facade/testing_framework.h
function class (line 6) | class TestingFramework {
FILE: design-patterns/cpp/facade/version_control_system.h
function class (line 7) | class VersionControlSystem {
FILE: design-patterns/cpp/factory/email_notification.h
function class (line 4) | class EmailNotification : public Notification {
FILE: design-patterns/cpp/factory/main.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/factory/notification.h
function class (line 4) | class Notification {
FILE: design-patterns/cpp/factory/notification_factory.h
function class (line 6) | class NotificationFactory {
FILE: design-patterns/cpp/factory/push_notification.h
function class (line 4) | class PushNotification : public Notification {
FILE: design-patterns/cpp/factory/sms_notification.h
function class (line 4) | class SMSNotification : public Notification {
FILE: design-patterns/cpp/flyweight/circle.h
function class (line 5) | class Circle : public Shape {
FILE: design-patterns/cpp/flyweight/main.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/flyweight/shape.h
function class (line 4) | class Shape {
FILE: design-patterns/cpp/flyweight/shape_factory.cpp
function Shape (line 6) | Shape* ShapeFactory::getCircle(const std::string& color) {
FILE: design-patterns/cpp/flyweight/shape_factory.h
function class (line 7) | class ShapeFactory {
FILE: design-patterns/cpp/iterator/container.h
function class (line 4) | class Container {
FILE: design-patterns/cpp/iterator/iterator.h
function class (line 4) | class Iterator {
FILE: design-patterns/cpp/iterator/main.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/iterator/name_iterator.h
function class (line 6) | class NameIterator : public Iterator {
FILE: design-patterns/cpp/iterator/name_repository.cpp
function Iterator (line 8) | Iterator* NameRepository::getIterator() {
FILE: design-patterns/cpp/iterator/name_repository.h
function class (line 6) | class NameRepository : public Container {
FILE: design-patterns/cpp/mediator/button.h
function class (line 4) | class Button : public UIComponent {
FILE: design-patterns/cpp/mediator/form_mediator.h
function class (line 7) | class FormMediator : public UIMediator {
FILE: design-patterns/cpp/mediator/label.h
function class (line 5) | class Label : public UIComponent {
FILE: design-patterns/cpp/mediator/main.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/mediator/text_field.h
function class (line 5) | class TextField : public UIComponent {
FILE: design-patterns/cpp/mediator/ui_component.h
function class (line 4) | class UIComponent {
FILE: design-patterns/cpp/mediator/ui_mediator.h
function class (line 6) | class UIMediator {
FILE: design-patterns/cpp/memento/main.cpp
function main (line 5) | int main() {
FILE: design-patterns/cpp/memento/text_editor.cpp
function TextEditorMemento (line 13) | TextEditorMemento TextEditor::save() const {
FILE: design-patterns/cpp/memento/text_editor.h
function class (line 5) | class TextEditor {
FILE: design-patterns/cpp/memento/text_editor_memento.h
function class (line 4) | class TextEditorMemento {
FILE: design-patterns/cpp/memento/text_editor_undo_manager.h
function class (line 5) | class TextEditorUndoManager {
FILE: design-patterns/cpp/observer/fitness_data.h
function class (line 6) | class FitnessData : public FitnessDataSubject {
FILE: design-patterns/cpp/observer/fitness_data_observer.h
function class (line 6) | class FitnessDataObserver {
FILE: design-patterns/cpp/observer/fitness_data_subject.h
function class (line 4) | class FitnessDataSubject {
FILE: design-patterns/cpp/observer/goal_notifier.h
function class (line 4) | class GoalNotifier : public FitnessDataObserver {
FILE: design-patterns/cpp/observer/live_activity_display.h
function class (line 4) | class LiveActivityDisplay : public FitnessDataObserver {
FILE: design-patterns/cpp/observer/main.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/observer/progress_logger.h
function class (line 4) | class ProgressLogger : public FitnessDataObserver {
FILE: design-patterns/cpp/prototype/enemy.cpp
function Enemy (line 7) | Enemy* Enemy::clone() const {
FILE: design-patterns/cpp/prototype/enemy.h
function class (line 5) | class Enemy : public EnemyPrototype {
FILE: design-patterns/cpp/prototype/enemy_prototype.h
function class (line 3) | class EnemyPrototype {
FILE: design-patterns/cpp/prototype/enemy_registry.h
function class (line 8) | class EnemyRegistry {
FILE: design-patterns/cpp/proxy/image.h
function class (line 4) | class Image {
FILE: design-patterns/cpp/proxy/image_gallery_app_v1.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/proxy/image_gallery_app_v2.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/proxy/image_proxy.h
function class (line 7) | class ImageProxy : public Image {
FILE: design-patterns/cpp/singleton/double_checked_singleton.cpp
function DoubleCheckedSingleton (line 7) | DoubleCheckedSingleton& DoubleCheckedSingleton::getInstance() {
FILE: design-patterns/cpp/singleton/double_checked_singleton.h
function class (line 6) | class DoubleCheckedSingleton {
FILE: design-patterns/cpp/singleton/eager_singleton.cpp
function EagerSingleton (line 6) | EagerSingleton& EagerSingleton::getInstance() {
FILE: design-patterns/cpp/singleton/eager_singleton.h
function class (line 3) | class EagerSingleton {
FILE: design-patterns/cpp/singleton/lazy_singleton.cpp
function LazySingleton (line 6) | LazySingleton& LazySingleton::getInstance() {
FILE: design-patterns/cpp/singleton/lazy_singleton.h
function class (line 4) | class LazySingleton {
FILE: design-patterns/cpp/singleton/main.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/singleton/thread_safe_singleton.cpp
function ThreadSafeSingleton (line 7) | ThreadSafeSingleton& ThreadSafeSingleton::getInstance() {
FILE: design-patterns/cpp/singleton/thread_safe_singleton.h
function class (line 5) | class ThreadSafeSingleton {
FILE: design-patterns/cpp/state/dispensing_state.h
function class (line 4) | class DispensingState : public MachineState {
FILE: design-patterns/cpp/state/has_money_state.h
function class (line 4) | class HasMoneyState : public MachineState {
FILE: design-patterns/cpp/state/idle_state.h
function class (line 4) | class IdleState : public MachineState {
FILE: design-patterns/cpp/state/item_selected_state.h
function class (line 4) | class ItemSelectedState : public MachineState {
FILE: design-patterns/cpp/state/machine_state.h
function class (line 6) | class MachineState {
FILE: design-patterns/cpp/state/main.cpp
function main (line 4) | int main() {
FILE: design-patterns/cpp/state/vending_machine.h
function class (line 6) | class VendingMachine {
FILE: design-patterns/cpp/strategy/distance_based_shipping.h
function class (line 4) | class DistanceBasedShipping : public ShippingStrategy {
FILE: design-patterns/cpp/strategy/flat_rate_shipping.h
function class (line 4) | class FlatRateShipping : public ShippingStrategy {
FILE: design-patterns/cpp/strategy/order.h
function class (line 4) | class Order {
FILE: design-patterns/cpp/strategy/shipping_cost_service.h
function class (line 5) | class ShippingCostService {
FILE: design-patterns/cpp/strategy/shipping_strategy.h
function class (line 4) | class ShippingStrategy {
FILE: design-patterns/cpp/strategy/third_party_api_shipping.h
function class (line 4) | class ThirdPartyApiShipping : public ShippingStrategy {
FILE: design-patterns/cpp/strategy/weight_based_shipping.h
function class (line 4) | class WeightBasedShipping : public ShippingStrategy {
FILE: design-patterns/cpp/templatemethod/abstract_report_exporter.h
function class (line 5) | class AbstractReportExporter {
FILE: design-patterns/cpp/templatemethod/csv_report_exporter.h
function class (line 4) | class CsvReportExporter : public AbstractReportExporter {
FILE: design-patterns/cpp/templatemethod/excel_report_exporter.h
function class (line 4) | class ExcelReportExporter : public AbstractReportExporter {
FILE: design-patterns/cpp/templatemethod/pdf_report_exporter.h
function class (line 4) | class PdfReportExporter : public AbstractReportExporter {
FILE: design-patterns/cpp/templatemethod/report_app.cpp
function main (line 7) | int main() {
FILE: design-patterns/cpp/templatemethod/report_data.h
function class (line 7) | class ReportData {
FILE: design-patterns/csharp/adapter/CheckoutService.cs
class CheckoutService (line 5) | public class CheckoutService
method CheckoutService (line 9) | public CheckoutService(IPaymentProcessor paymentProcessor)
method Checkout (line 14) | public bool Checkout(double amount, string currency)
FILE: design-patterns/csharp/adapter/IPaymentProcessor.cs
type IPaymentProcessor (line 3) | public interface IPaymentProcessor
method ProcessPayment (line 5) | void ProcessPayment(double amount, string currency);
method IsPaymentSuccessful (line 6) | bool IsPaymentSuccessful();
method GetTransactionId (line 7) | string GetTransactionId();
FILE: design-patterns/csharp/adapter/InHousePaymentProcessor.cs
class InHousePaymentProcessor (line 5) | public class InHousePaymentProcessor : IPaymentProcessor
method ProcessPayment (line 10) | public void ProcessPayment(double amount, string currency)
method IsPaymentSuccessful (line 26) | public bool IsPaymentSuccessful()
method GetTransactionId (line 31) | public string GetTransactionId()
FILE: design-patterns/csharp/adapter/LegacyGateway.cs
class LegacyGateway (line 5) | public class LegacyGateway
method ExecuteTransaction (line 10) | public void ExecuteTransaction(double totalAmount, string currency)
method CheckStatus (line 18) | public bool CheckStatus(long transactionReference)
method GetReferenceNumber (line 24) | public long GetReferenceNumber()
FILE: design-patterns/csharp/adapter/LegacyGatewayAdapter.cs
class LegacyGatewayAdapter (line 5) | public class LegacyGatewayAdapter : IPaymentProcessor
method LegacyGatewayAdapter (line 10) | public LegacyGatewayAdapter()
method ProcessPayment (line 15) | public void ProcessPayment(double amount, string currency)
method IsPaymentSuccessful (line 29) | public bool IsPaymentSuccessful()
method GetTransactionId (line 35) | public string GetTransactionId()
FILE: design-patterns/csharp/adapter/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/bridge/Circle.cs
class Circle (line 3) | public class Circle : Shape
method Circle (line 7) | public Circle(IRenderer renderer, float radius) : base(renderer)
method Draw (line 12) | public override void Draw()
FILE: design-patterns/csharp/bridge/IRenderer.cs
type IRenderer (line 3) | public interface IRenderer
method RenderCircle (line 5) | void RenderCircle(float radius);
method RenderRectangle (line 6) | void RenderRectangle(float width, float height);
FILE: design-patterns/csharp/bridge/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/bridge/RasterRenderer.cs
class RasterRenderer (line 5) | public class RasterRenderer : IRenderer
method RenderCircle (line 7) | public void RenderCircle(float radius)
method RenderRectangle (line 12) | public void RenderRectangle(float width, float height)
FILE: design-patterns/csharp/bridge/Rectangle.cs
class Rectangle (line 3) | public class Rectangle : Shape
method Rectangle (line 8) | public Rectangle(IRenderer renderer, float width, float height) : base...
method Draw (line 14) | public override void Draw()
FILE: design-patterns/csharp/bridge/Shape.cs
class Shape (line 3) | public abstract class Shape
method Shape (line 7) | protected Shape(IRenderer renderer)
method Draw (line 12) | public abstract void Draw();
FILE: design-patterns/csharp/bridge/VectorRenderer.cs
class VectorRenderer (line 5) | public class VectorRenderer : IRenderer
method RenderCircle (line 7) | public void RenderCircle(float radius)
method RenderRectangle (line 12) | public void RenderRectangle(float width, float height)
FILE: design-patterns/csharp/builder/HttpRequest.cs
class HttpRequest (line 7) | public class HttpRequest
method HttpRequest (line 17) | private HttpRequest(Builder builder)
method ToString (line 27) | public override string ToString()
class Builder (line 39) | public class Builder
method Builder (line 52) | public Builder(string url)
method WithMethod (line 62) | public Builder WithMethod(string method)
method WithHeader (line 68) | public Builder WithHeader(string key, string value)
method WithQueryParam (line 77) | public Builder WithQueryParam(string key, string value)
method WithBody (line 86) | public Builder WithBody(string body)
method WithTimeout (line 92) | public Builder WithTimeout(int timeoutMillis)
method Build (line 102) | public HttpRequest Build()
FILE: design-patterns/csharp/builder/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/chainofresponsibility/AuthHandler.cs
class AuthHandler (line 5) | public class AuthHandler : BaseHandler
method Handle (line 7) | public override void Handle(Request request)
FILE: design-patterns/csharp/chainofresponsibility/AuthorizationHandler.cs
class AuthorizationHandler (line 5) | public class AuthorizationHandler : BaseHandler
method Handle (line 7) | public override void Handle(Request request)
FILE: design-patterns/csharp/chainofresponsibility/BaseHandler.cs
class BaseHandler (line 3) | public abstract class BaseHandler : IRequestHandler
method SetNext (line 7) | public void SetNext(IRequestHandler next)
method Handle (line 12) | public abstract void Handle(Request request);
method HandleNext (line 14) | protected void HandleNext(Request request)
FILE: design-patterns/csharp/chainofresponsibility/BusinessLogicHandler.cs
class BusinessLogicHandler (line 5) | public class BusinessLogicHandler : BaseHandler
method Handle (line 7) | public override void Handle(Request request)
FILE: design-patterns/csharp/chainofresponsibility/RateLimitHandler.cs
class RateLimitHandler (line 5) | public class RateLimitHandler : BaseHandler
method Handle (line 9) | public override void Handle(Request request)
FILE: design-patterns/csharp/chainofresponsibility/Request.cs
class Request (line 3) | public class Request
method Request (line 10) | public Request(string user, string role, int requestCount, string payl...
FILE: design-patterns/csharp/chainofresponsibility/ValidationHandler.cs
class ValidationHandler (line 5) | public class ValidationHandler : BaseHandler
method Handle (line 7) | public override void Handle(Request request)
FILE: design-patterns/csharp/composite/File.cs
class File (line 5) | public class File : IFileSystemItem
method File (line 10) | public File(string name, int size)
method GetSize (line 16) | public int GetSize()
method PrintStructure (line 21) | public void PrintStructure(string indent)
method Delete (line 26) | public void Delete()
FILE: design-patterns/csharp/composite/Folder.cs
class Folder (line 6) | public class Folder : IFileSystemItem
method Folder (line 11) | public Folder(string name)
method Add (line 17) | public void Add(IFileSystemItem item)
method Remove (line 22) | public void Remove(IFileSystemItem item)
method GetSize (line 27) | public int GetSize()
method PrintStructure (line 37) | public void PrintStructure(string indent)
method Delete (line 46) | public void Delete()
FILE: design-patterns/csharp/composite/IFileSystemItem.cs
type IFileSystemItem (line 3) | public interface IFileSystemItem
method GetSize (line 5) | int GetSize();
method PrintStructure (line 6) | void PrintStructure(string indent);
method Delete (line 7) | void Delete();
FILE: design-patterns/csharp/composite/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/decorator/BoldDecorator.cs
class BoldDecorator (line 5) | public class BoldDecorator : TextDecorator
method BoldDecorator (line 7) | public BoldDecorator(ITextView inner) : base(inner)
method Render (line 11) | public override void Render()
FILE: design-patterns/csharp/decorator/ITextView.cs
type ITextView (line 3) | public interface ITextView
method Render (line 5) | void Render();
FILE: design-patterns/csharp/decorator/ItalicDecorator.cs
class ItalicDecorator (line 5) | public class ItalicDecorator : TextDecorator
method ItalicDecorator (line 7) | public ItalicDecorator(ITextView inner) : base(inner)
method Render (line 11) | public override void Render()
FILE: design-patterns/csharp/decorator/PlainTextView.cs
class PlainTextView (line 5) | public class PlainTextView : ITextView
method PlainTextView (line 9) | public PlainTextView(string text)
method Render (line 14) | public void Render()
FILE: design-patterns/csharp/decorator/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/decorator/TextDecorator.cs
class TextDecorator (line 3) | public abstract class TextDecorator : ITextView
method TextDecorator (line 7) | public TextDecorator(ITextView inner)
method Render (line 12) | public abstract void Render();
FILE: design-patterns/csharp/decorator/UnderlineDecorator.cs
class UnderlineDecorator (line 5) | public class UnderlineDecorator : TextDecorator
method UnderlineDecorator (line 7) | public UnderlineDecorator(ITextView inner) : base(inner)
method Render (line 11) | public override void Render()
FILE: design-patterns/csharp/facade/BuildSystem.cs
class BuildSystem (line 6) | public class BuildSystem
method CompileProject (line 8) | public bool CompileProject()
method GetArtifactPath (line 16) | public string GetArtifactPath()
method SimulateDelay (line 23) | private void SimulateDelay(int ms)
FILE: design-patterns/csharp/facade/DeploymentFacade.cs
class DeploymentFacade (line 5) | public class DeploymentFacade
method DeploymentFacade (line 12) | public DeploymentFacade()
method DeployApplication (line 20) | public bool DeployApplication(string branch, string serverAddress)
method DeployHotfix (line 64) | public bool DeployHotfix(string branch, string serverAddress)
FILE: design-patterns/csharp/facade/DeploymentTarget.cs
class DeploymentTarget (line 6) | public class DeploymentTarget
method TransferArtifact (line 8) | public void TransferArtifact(string artifactPath, string server)
method ActivateNewVersion (line 15) | public void ActivateNewVersion(string server)
method SimulateDelay (line 22) | private void SimulateDelay(int ms)
FILE: design-patterns/csharp/facade/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/facade/TestingFramework.cs
class TestingFramework (line 6) | public class TestingFramework
method RunUnitTests (line 8) | public bool RunUnitTests()
method RunIntegrationTests (line 16) | public bool RunIntegrationTests()
method SimulateDelay (line 24) | private void SimulateDelay(int ms)
FILE: design-patterns/csharp/factory/EmailNotification.cs
class EmailNotification (line 5) | public class EmailNotification : INotification
method Send (line 7) | public void Send(string message)
FILE: design-patterns/csharp/factory/INotification.cs
type INotification (line 3) | public interface INotification
method Send (line 5) | void Send(string message);
FILE: design-patterns/csharp/factory/NotificationServiceNaive.cs
class NotificationServiceNaive (line 5) | public class NotificationServiceNaive
method SendNotification (line 7) | public void SendNotification(string type, string message)
FILE: design-patterns/csharp/factory/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/factory/PushNotification.cs
class PushNotification (line 5) | public class PushNotification : INotification
method Send (line 7) | public void Send(string message)
FILE: design-patterns/csharp/factory/SMSNotification.cs
class SMSNotification (line 5) | public class SMSNotification : INotification
method Send (line 7) | public void Send(string message)
FILE: design-patterns/csharp/flyweight/CharacterFlyweightFactory.cs
class CharacterFlyweightFactory (line 6) | public class CharacterFlyweightFactory
method GetFlyweight (line 10) | public static ICharacterFlyweight GetFlyweight(char symbol, string fon...
method GetFlyweightCount (line 20) | public int GetFlyweightCount()
FILE: design-patterns/csharp/flyweight/CharacterGlyph.cs
class CharacterGlyph (line 5) | public class CharacterGlyph : ICharacterFlyweight
method CharacterGlyph (line 12) | public CharacterGlyph(char symbol, string fontFamily, int fontSize, st...
method Draw (line 20) | public void Draw(int x, int y)
FILE: design-patterns/csharp/flyweight/ICharacterFlyweight.cs
type ICharacterFlyweight (line 3) | public interface ICharacterFlyweight
method Draw (line 5) | void Draw(int x, int y);
FILE: design-patterns/csharp/flyweight/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/flyweight/TextEditorClient.cs
class TextEditorClient (line 6) | public class TextEditorClient
method AddCharacter (line 11) | public void AddCharacter(char c, int x, int y, string font, int size, ...
method RenderDocument (line 17) | public void RenderDocument()
class RenderedCharacter (line 26) | private class RenderedCharacter
method RenderedCharacter (line 31) | public RenderedCharacter(ICharacterFlyweight glyph, int x, int y)
method Draw (line 38) | public void Draw()
FILE: design-patterns/csharp/iterator/IIterableCollection.cs
type IIterableCollection (line 3) | public interface IIterableCollection<T>
method CreateIterator (line 5) | IIterator<T> CreateIterator();
FILE: design-patterns/csharp/iterator/IIterator.cs
type IIterator (line 3) | public interface IIterator<T>
method HasNext (line 5) | bool HasNext();
method Next (line 6) | T Next();
FILE: design-patterns/csharp/mediator/Button.cs
class Button (line 5) | public class Button : UIComponent
method Button (line 9) | public Button(IUIMediator mediator) : base(mediator)
method Click (line 13) | public void Click()
method SetEnabled (line 26) | public void SetEnabled(bool value)
FILE: design-patterns/csharp/mediator/FormMediator.cs
class FormMediator (line 3) | public class FormMediator : IUIMediator
method SetUsernameField (line 10) | public void SetUsernameField(TextField usernameField)
method SetPasswordField (line 15) | public void SetPasswordField(TextField passwordField)
method SetLoginButton (line 20) | public void SetLoginButton(Button loginButton)
method SetStatusLabel (line 25) | public void SetStatusLabel(Label statusLabel)
method ComponentChanged (line 30) | public void ComponentChanged(UIComponent component)
FILE: design-patterns/csharp/mediator/IUIMediator.cs
type IUIMediator (line 3) | public interface IUIMediator
method ComponentChanged (line 5) | void ComponentChanged(UIComponent component);
FILE: design-patterns/csharp/mediator/Label.cs
class Label (line 5) | public class Label : UIComponent
method Label (line 9) | public Label(IUIMediator mediator) : base(mediator)
method SetText (line 13) | public void SetText(string message)
FILE: design-patterns/csharp/mediator/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/mediator/TextField.cs
class TextField (line 5) | public class TextField : UIComponent
method TextField (line 9) | public TextField(IUIMediator mediator) : base(mediator)
method SetText (line 13) | public void SetText(string newText)
method GetText (line 20) | public string GetText()
FILE: design-patterns/csharp/mediator/UIComponent.cs
class UIComponent (line 3) | public abstract class UIComponent
method UIComponent (line 7) | public UIComponent(IUIMediator mediator)
method NotifyMediator (line 12) | public void NotifyMediator()
FILE: design-patterns/csharp/memento/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/memento/TextEditor.cs
class TextEditor (line 5) | public class TextEditor
method Type (line 9) | public void Type(string newText)
method GetContent (line 15) | public string GetContent()
method Save (line 20) | public TextEditorMemento Save()
method Restore (line 26) | public void Restore(TextEditorMemento memento)
FILE: design-patterns/csharp/memento/TextEditorMemento.cs
class TextEditorMemento (line 3) | public class TextEditorMemento
method TextEditorMemento (line 7) | public TextEditorMemento(string state)
method GetState (line 12) | public string GetState()
FILE: design-patterns/csharp/memento/TextEditorUndoManager.cs
class TextEditorUndoManager (line 6) | public class TextEditorUndoManager
method Save (line 10) | public void Save(TextEditor editor)
method Undo (line 15) | public void Undo(TextEditor editor)
FILE: design-patterns/csharp/observer/FitnessData.cs
class FitnessData (line 6) | public class FitnessData : IFitnessDataSubject
method RegisterObserver (line 14) | public void RegisterObserver(IFitnessDataObserver observer)
method RemoveObserver (line 19) | public void RemoveObserver(IFitnessDataObserver observer)
method NotifyObservers (line 24) | public void NotifyObservers()
method NewFitnessDataPushed (line 32) | public void NewFitnessDataPushed(int steps, int activeMinutes, int cal...
method DailyReset (line 43) | public void DailyReset()
FILE: design-patterns/csharp/observer/GoalNotifier.cs
class GoalNotifier (line 5) | public class GoalNotifier : IFitnessDataObserver
method Update (line 11) | public void Update(FitnessData data)
FILE: design-patterns/csharp/observer/IFitnessDataObserver.cs
type IFitnessDataObserver (line 3) | public interface IFitnessDataObserver
method Update (line 5) | void Update(FitnessData data);
FILE: design-patterns/csharp/observer/IFitnessDataSubject.cs
type IFitnessDataSubject (line 3) | public interface IFitnessDataSubject
method RegisterObserver (line 5) | void RegisterObserver(IFitnessDataObserver observer);
method RemoveObserver (line 6) | void RemoveObserver(IFitnessDataObserver observer);
method NotifyObservers (line 7) | void NotifyObservers();
FILE: design-patterns/csharp/observer/LiveActivityDisplay.cs
class LiveActivityDisplay (line 5) | public class LiveActivityDisplay : IFitnessDataObserver
method Update (line 7) | public void Update(FitnessData data)
FILE: design-patterns/csharp/observer/ProgressLogger.cs
class ProgressLogger (line 5) | public class ProgressLogger : IFitnessDataObserver
method Update (line 7) | public void Update(FitnessData data)
FILE: design-patterns/csharp/prototype/Enemy.cs
class Enemy (line 5) | public class Enemy : IEnemyPrototype
method Enemy (line 13) | public Enemy(string type, int health, double speed, bool armored, stri...
method Clone (line 22) | public IEnemyPrototype Clone()
method SetHealth (line 27) | public void SetHealth(int health)
method PrintStats (line 32) | public void PrintStats()
FILE: design-patterns/csharp/prototype/EnemyRegistry.cs
class EnemyRegistry (line 6) | public class EnemyRegistry
method Register (line 10) | public void Register(string key, Enemy prototype)
method Get (line 15) | public Enemy Get(string key)
FILE: design-patterns/csharp/prototype/Game.cs
class Game (line 5) | class Game
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/prototype/IEnemyPrototype.cs
type IEnemyPrototype (line 3) | public interface IEnemyPrototype
method Clone (line 5) | IEnemyPrototype Clone();
FILE: design-patterns/csharp/proxy/HighResolutionImage.cs
class HighResolutionImage (line 6) | public class HighResolutionImage : IImage
method HighResolutionImage (line 11) | public HighResolutionImage(string fileName)
method LoadImageFromDisk (line 17) | private void LoadImageFromDisk()
method Display (line 26) | public void Display()
method GetFileName (line 32) | public string GetFileName()
FILE: design-patterns/csharp/proxy/IImage.cs
type IImage (line 3) | public interface IImage
method Display (line 5) | void Display();
method GetFileName (line 6) | string GetFileName();
FILE: design-patterns/csharp/proxy/ImageGalleryApp.cs
class ImageGalleryApp (line 5) | class ImageGalleryApp
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/proxy/ImageProxy.cs
class ImageProxy (line 5) | public class ImageProxy : IImage
method ImageProxy (line 10) | public ImageProxy(string fileName)
method GetFileName (line 16) | public string GetFileName()
method Display (line 22) | public void Display()
FILE: design-patterns/csharp/singleton/BillPughSingleton.cs
class BillPughSingleton (line 3) | public class BillPughSingleton
method BillPughSingleton (line 5) | private BillPughSingleton() { }
method GetInstance (line 6) | public static BillPughSingleton GetInstance()
class Nested (line 10) | private class Nested
method Nested (line 13) | static Nested() { }
FILE: design-patterns/csharp/singleton/DoubleCheckedLockingSingleton.cs
class DoubleCheckedLockingSingleton (line 3) | public class DoubleCheckedLockingSingleton
method DoubleCheckedLockingSingleton (line 7) | private DoubleCheckedLockingSingleton() { }
method GetInstance (line 8) | public static DoubleCheckedLockingSingleton GetInstance()
FILE: design-patterns/csharp/singleton/EagerSingleton.cs
class EagerSingleton (line 3) | public class EagerSingleton
method EagerSingleton (line 6) | private EagerSingleton() { }
method GetInstance (line 7) | public static EagerSingleton GetInstance()
FILE: design-patterns/csharp/singleton/LazySingleton.cs
class LazySingleton (line 3) | public class LazySingleton
method LazySingleton (line 6) | private LazySingleton() { }
method GetInstance (line 7) | public static LazySingleton GetInstance()
FILE: design-patterns/csharp/singleton/SingletonDemo.cs
class SingletonDemo (line 5) | class SingletonDemo
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/singleton/StaticBlockSingleton.cs
class StaticBlockSingleton (line 5) | public class StaticBlockSingleton
method StaticBlockSingleton (line 8) | static StaticBlockSingleton()
method StaticBlockSingleton (line 19) | private StaticBlockSingleton() { }
method GetInstance (line 20) | public static StaticBlockSingleton GetInstance()
FILE: design-patterns/csharp/singleton/ThreadSafeSingleton.cs
class ThreadSafeSingleton (line 3) | public class ThreadSafeSingleton
method ThreadSafeSingleton (line 7) | private ThreadSafeSingleton() { }
method GetInstance (line 8) | public static ThreadSafeSingleton GetInstance()
FILE: design-patterns/csharp/state/DispensingState.cs
class DispensingState (line 5) | public class DispensingState : IMachineState
method SelectItem (line 7) | public void SelectItem(VendingMachine context, string itemCode)
method InsertCoin (line 12) | public void InsertCoin(VendingMachine context, double amount)
method DispenseItem (line 17) | public void DispenseItem(VendingMachine context)
FILE: design-patterns/csharp/state/HasMoneyState.cs
class HasMoneyState (line 6) | public class HasMoneyState : IMachineState
method SelectItem (line 8) | public void SelectItem(VendingMachine context, string itemCode)
method InsertCoin (line 13) | public void InsertCoin(VendingMachine context, double amount)
method DispenseItem (line 18) | public void DispenseItem(VendingMachine context)
FILE: design-patterns/csharp/state/IMachineState.cs
type IMachineState (line 3) | public interface IMachineState
method SelectItem (line 5) | void SelectItem(VendingMachine context, string itemCode);
method InsertCoin (line 6) | void InsertCoin(VendingMachine context, double amount);
method DispenseItem (line 7) | void DispenseItem(VendingMachine context);
FILE: design-patterns/csharp/state/IdleState.cs
class IdleState (line 5) | public class IdleState : IMachineState
method SelectItem (line 7) | public void SelectItem(VendingMachine context, string itemCode)
method InsertCoin (line 14) | public void InsertCoin(VendingMachine context, double amount)
method DispenseItem (line 19) | public void DispenseItem(VendingMachine context)
FILE: design-patterns/csharp/state/ItemSelectedState.cs
class ItemSelectedState (line 5) | public class ItemSelectedState : IMachineState
method SelectItem (line 7) | public void SelectItem(VendingMachine context, string itemCode)
method InsertCoin (line 12) | public void InsertCoin(VendingMachine context, double amount)
method DispenseItem (line 19) | public void DispenseItem(VendingMachine context)
FILE: design-patterns/csharp/state/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/state/VendingMachine.cs
class VendingMachine (line 3) | public class VendingMachine
method VendingMachine (line 9) | public VendingMachine()
method SetState (line 14) | public void SetState(IMachineState newState)
method SetSelectedItem (line 19) | public void SetSelectedItem(string itemCode)
method SetInsertedAmount (line 24) | public void SetInsertedAmount(double amount)
method GetSelectedItem (line 29) | public string GetSelectedItem()
method GetInsertedAmount (line 34) | public double GetInsertedAmount()
method SelectItem (line 39) | public void SelectItem(string itemCode)
method InsertCoin (line 44) | public void InsertCoin(double amount)
method DispenseItem (line 49) | public void DispenseItem()
method Reset (line 54) | public void Reset()
FILE: design-patterns/csharp/strategy/DistanceBasedShipping.cs
class DistanceBasedShipping (line 3) | public class DistanceBasedShipping : IShippingStrategy
method CalculateCost (line 10) | public double CalculateCost(Order order)
FILE: design-patterns/csharp/strategy/FlatRateShipping.cs
class FlatRateShipping (line 3) | public class FlatRateShipping : IShippingStrategy
method CalculateCost (line 7) | public double CalculateCost(Order order)
FILE: design-patterns/csharp/strategy/IShippingStrategy.cs
type IShippingStrategy (line 3) | public interface IShippingStrategy
method CalculateCost (line 5) | double CalculateCost(Order order);
FILE: design-patterns/csharp/strategy/Order.cs
class Order (line 3) | public class Order
method GetTotalWeight (line 5) | public double GetTotalWeight() => 5.0;
method GetDestinationZone (line 6) | public string GetDestinationZone() => "ZoneA";
method GetOrderValue (line 7) | public double GetOrderValue() => 150.0;
FILE: design-patterns/csharp/strategy/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/strategy/ShippingCostService.cs
class ShippingCostService (line 3) | public class ShippingCostService
method ShippingCostService (line 7) | public ShippingCostService(IShippingStrategy shippingStrategy)
method CalculateShippingCost (line 12) | public double CalculateShippingCost(Order order)
FILE: design-patterns/csharp/strategy/ThirdPartyApiShipping.cs
class ThirdPartyApiShipping (line 3) | public class ThirdPartyApiShipping : IShippingStrategy
method CalculateCost (line 5) | public double CalculateCost(Order order)
FILE: design-patterns/csharp/strategy/WeightBasedShipping.cs
class WeightBasedShipping (line 3) | public class WeightBasedShipping : IShippingStrategy
method CalculateCost (line 7) | public double CalculateCost(Order order)
FILE: design-patterns/csharp/templatemethod/AbstractReportExporter.cs
class AbstractReportExporter (line 5) | public abstract class AbstractReportExporter
method ExportReport (line 7) | public void ExportReport(ReportData data, string filePath)
method PrepareData (line 19) | protected virtual void PrepareData(ReportData data)
method OpenFile (line 25) | protected virtual void OpenFile(string filePath)
method WriteHeader (line 30) | protected abstract void WriteHeader(ReportData data);
method WriteDataRows (line 32) | protected abstract void WriteDataRows(ReportData data);
method WriteFooter (line 35) | protected virtual void WriteFooter(ReportData data)
method CloseFile (line 41) | protected virtual void CloseFile(string filePath)
FILE: design-patterns/csharp/templatemethod/CsvReportExporter.cs
class CsvReportExporter (line 6) | public class CsvReportExporter : AbstractReportExporter
method WriteHeader (line 8) | protected override void WriteHeader(ReportData data)
method WriteDataRows (line 14) | protected override void WriteDataRows(ReportData data)
FILE: design-patterns/csharp/templatemethod/ExcelReportExporter.cs
class ExcelReportExporter (line 5) | public class ExcelReportExporter : AbstractReportExporter
method WriteHeader (line 7) | protected override void WriteHeader(ReportData data)
method WriteDataRows (line 16) | protected override void WriteDataRows(ReportData data)
FILE: design-patterns/csharp/templatemethod/PdfReportExporter.cs
class PdfReportExporter (line 5) | public class PdfReportExporter : AbstractReportExporter
method WriteHeader (line 7) | protected override void WriteHeader(ReportData data)
method WriteDataRows (line 18) | protected override void WriteDataRows(ReportData data)
FILE: design-patterns/csharp/templatemethod/Program.cs
class Program (line 5) | class Program
method Main (line 7) | static void Main(string[] args)
FILE: design-patterns/csharp/templatemethod/ReportData.cs
class ReportData (line 5) | public class ReportData
method GetHeaders (line 7) | public List<string> GetHeaders()
method GetRows (line 12) | public List<Dictionary<string, object>> GetRows()
FILE: design-patterns/golang/adapter/checkout_service.go
type CheckoutService (line 6) | type CheckoutService struct
method ProcessCheckout (line 18) | func (cs *CheckoutService) ProcessCheckout(amount float64, currency st...
function NewCheckoutService (line 11) | func NewCheckoutService(paymentProcessor PaymentProcessor) *CheckoutServ...
FILE: design-patterns/golang/adapter/in_house_payment_processor.go
type InHousePaymentProcessor (line 9) | type InHousePaymentProcessor struct
method ProcessPayment (line 15) | func (p *InHousePaymentProcessor) ProcessPayment(amount float64, curre...
method IsPaymentSuccessful (line 23) | func (p *InHousePaymentProcessor) IsPaymentSuccessful() bool {
method GetTransactionID (line 28) | func (p *InHousePaymentProcessor) GetTransactionID() string {
FILE: design-patterns/golang/adapter/legacy_gateway.go
type LegacyGateway (line 9) | type LegacyGateway struct
method ExecuteTransaction (line 15) | func (lg *LegacyGateway) ExecuteTransaction(totalAmount float64, curre...
method CheckStatus (line 23) | func (lg *LegacyGateway) CheckStatus(transactionReference int64) bool {
method GetReferenceNumber (line 29) | func (lg *LegacyGateway) GetReferenceNumber() int64 {
FILE: design-patterns/golang/adapter/legacy_gateway_adapter.go
type LegacyGatewayAdapter (line 6) | type LegacyGatewayAdapter struct
method ProcessPayment (line 18) | func (adapter *LegacyGatewayAdapter) ProcessPayment(amount float64, cu...
method IsPaymentSuccessful (line 23) | func (adapter *LegacyGatewayAdapter) IsPaymentSuccessful() bool {
method GetTransactionID (line 28) | func (adapter *LegacyGatewayAdapter) GetTransactionID() string {
function NewLegacyGatewayAdapter (line 11) | func NewLegacyGatewayAdapter(legacyGateway *LegacyGateway) *LegacyGatewa...
FILE: design-patterns/golang/adapter/main.go
function main (line 8) | func main() {
FILE: design-patterns/golang/adapter/payment_processor.go
type PaymentProcessor (line 4) | type PaymentProcessor interface
FILE: design-patterns/golang/bridge/circle.go
type Circle (line 4) | type Circle struct
method Draw (line 18) | func (c *Circle) Draw() {
function NewCircle (line 10) | func NewCircle(renderer Renderer, radius float64) *Circle {
FILE: design-patterns/golang/bridge/main.go
function main (line 8) | func main() {
FILE: design-patterns/golang/bridge/raster_renderer.go
type RasterRenderer (line 6) | type RasterRenderer struct
method RenderCircle (line 14) | func (r *RasterRenderer) RenderCircle(radius float64) {
method RenderRectangle (line 19) | func (r *RasterRenderer) RenderRectangle(width, height float64) {
function NewRasterRenderer (line 9) | func NewRasterRenderer() *RasterRenderer {
FILE: design-patterns/golang/bridge/rectangle.go
type Rectangle (line 4) | type Rectangle struct
method Draw (line 20) | func (r *Rectangle) Draw() {
function NewRectangle (line 11) | func NewRectangle(renderer Renderer, width, height float64) *Rectangle {
FILE: design-patterns/golang/bridge/renderer.go
type Renderer (line 4) | type Renderer interface
FILE: design-patterns/golang/bridge/shape.go
type Shape (line 4) | type Shape interface
type BaseShape (line 9) | type BaseShape struct
function NewBaseShape (line 14) | func NewBaseShape(renderer Renderer) *BaseShape {
FILE: design-patterns/golang/bridge/vector_renderer.go
type VectorRenderer (line 6) | type VectorRenderer struct
method RenderCircle (line 14) | func (v *VectorRenderer) RenderCircle(radius float64) {
method RenderRectangle (line 19) | func (v *VectorRenderer) RenderRectangle(width, height float64) {
function NewVectorRenderer (line 9) | func NewVectorRenderer() *VectorRenderer {
FILE: design-patterns/golang/builder/http_request.go
type HttpRequest (line 8) | type HttpRequest struct
method GetURL (line 30) | func (r *HttpRequest) GetURL() string {
method GetMethod (line 35) | func (r *HttpRequest) GetMethod() string {
method GetHeaders (line 40) | func (r *HttpRequest) GetHeaders() map[string]string {
method GetQueryParams (line 45) | func (r *HttpRequest) GetQueryParams() map[string]string {
method GetBody (line 50) | func (r *HttpRequest) GetBody() string {
method GetTimeout (line 55) | func (r *HttpRequest) GetTimeout() int {
method String (line 60) | func (r *HttpRequest) String() string {
function NewHttpRequest (line 18) | func NewHttpRequest(builder *HttpRequestBuilder) *HttpRequest {
FILE: design-patterns/golang/builder/http_request_builder.go
type HttpRequestBuilder (line 9) | type HttpRequestBuilder struct
method Method (line 34) | func (b *HttpRequestBuilder) Method(method string) *HttpRequestBuilder {
method Header (line 44) | func (b *HttpRequestBuilder) Header(key, value string) *HttpRequestBui...
method QueryParam (line 52) | func (b *HttpRequestBuilder) QueryParam(key, value string) *HttpReques...
method Body (line 60) | func (b *HttpRequestBuilder) Body(body string) *HttpRequestBuilder {
method Timeout (line 66) | func (b *HttpRequestBuilder) Timeout(timeoutMillis int) *HttpRequestBu...
method Build (line 74) | func (b *HttpRequestBuilder) Build() *HttpRequest {
function NewHttpRequestBuilder (line 19) | func NewHttpRequestBuilder(url string) (*HttpRequestBuilder, error) {
FILE: design-patterns/golang/builder/main.go
function main (line 8) | func main() {
FILE: design-patterns/golang/chainofresponsibility/authentication_handler.go
type AuthenticationHandler (line 6) | type AuthenticationHandler struct
method Handle (line 11) | func (h *AuthenticationHandler) Handle(request *Request) {
FILE: design-patterns/golang/chainofresponsibility/base_handler.go
type BaseHandler (line 4) | type BaseHandler struct
method SetNext (line 9) | func (h *BaseHandler) SetNext(handler RequestHandler) {
method HandleNext (line 14) | func (h *BaseHandler) HandleNext(request *Request) {
FILE: design-patterns/golang/chainofresponsibility/main.go
function main (line 7) | func main() {
FILE: design-patterns/golang/chainofresponsibility/request.go
type Request (line 4) | type Request struct
function NewRequest (line 10) | func NewRequest(user, role string, requestCount int, payload string) *Re...
FILE: design-patterns/golang/chainofresponsibility/request_handler.go
type RequestHandler (line 4) | type RequestHandler interface
FILE: design-patterns/golang/chainofresponsibility/validation_handler.go
type ValidationHandler (line 6) | type ValidationHandler struct
method Handle (line 11) | func (h *ValidationHandler) Handle(request *Request) {
FILE: design-patterns/golang/composite/file.go
type File (line 6) | type File struct
method GetName (line 20) | func (f *File) GetName() string {
method GetSize (line 25) | func (f *File) GetSize() int64 {
method Print (line 30) | func (f *File) Print(indent string) {
method Delete (line 35) | func (f *File) Delete() {
function NewFile (line 12) | func NewFile(name string, size int64) *File {
FILE: design-patterns/golang/composite/file_system_item.go
type FileSystemItem (line 4) | type FileSystemItem interface
FILE: design-patterns/golang/composite/folder.go
type Folder (line 6) | type Folder struct
method GetName (line 20) | func (f *Folder) GetName() string {
method GetSize (line 25) | func (f *Folder) GetSize() int64 {
method Add (line 34) | func (f *Folder) Add(item FileSystemItem) {
method Remove (line 39) | func (f *Folder) Remove(item FileSystemItem) {
method Print (line 49) | func (f *Folder) Print(indent string) {
method Delete (line 57) | func (f *Folder) Delete() {
function NewFolder (line 12) | func NewFolder(name string) *Folder {
FILE: design-patterns/golang/composite/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/decorator/beverage.go
type Beverage (line 4) | type Beverage interface
FILE: design-patterns/golang/decorator/beverage_decorator.go
type BeverageDecorator (line 4) | type BeverageDecorator struct
method GetDescription (line 16) | func (d *BeverageDecorator) GetDescription() string {
method Cost (line 21) | func (d *BeverageDecorator) Cost() float64 {
function NewBeverageDecorator (line 9) | func NewBeverageDecorator(beverage Beverage) *BeverageDecorator {
FILE: design-patterns/golang/decorator/milk_decorator.go
type MilkDecorator (line 4) | type MilkDecorator struct
method GetDescription (line 16) | func (d *MilkDecorator) GetDescription() string {
method Cost (line 21) | func (d *MilkDecorator) Cost() float64 {
function NewMilkDecorator (line 9) | func NewMilkDecorator(beverage Beverage) *MilkDecorator {
FILE: design-patterns/golang/decorator/simple_coffee.go
type SimpleCoffee (line 4) | type SimpleCoffee struct
method GetDescription (line 12) | func (c *SimpleCoffee) GetDescription() string {
method Cost (line 17) | func (c *SimpleCoffee) Cost() float64 {
function NewSimpleCoffee (line 7) | func NewSimpleCoffee() *SimpleCoffee {
FILE: design-patterns/golang/facade/build_system.go
type BuildSystem (line 8) | type BuildSystem struct
method CompileProject (line 16) | func (b *BuildSystem) CompileProject() bool {
method GetArtifactPath (line 24) | func (b *BuildSystem) GetArtifactPath() string {
function NewBuildSystem (line 11) | func NewBuildSystem() *BuildSystem {
FILE: design-patterns/golang/facade/deployment_facade.go
type DeploymentFacade (line 6) | type DeploymentFacade struct
method DeployApplication (line 24) | func (f *DeploymentFacade) DeployApplication(branch, serverAddress str...
method DeployHotfix (line 57) | func (f *DeploymentFacade) DeployHotfix(branch, serverAddress string) ...
function NewDeploymentFacade (line 14) | func NewDeploymentFacade() *DeploymentFacade {
FILE: design-patterns/golang/facade/deployment_target.go
type DeploymentTarget (line 8) | type DeploymentTarget struct
method TransferArtifact (line 16) | func (d *DeploymentTarget) TransferArtifact(artifactPath, serverAddres...
method ActivateNewVersion (line 23) | func (d *DeploymentTarget) ActivateNewVersion(serverAddress string) {
function NewDeploymentTarget (line 11) | func NewDeploymentTarget() *DeploymentTarget {
FILE: design-patterns/golang/facade/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/factory/email_notification.go
type EmailNotification (line 6) | type EmailNotification struct
method Send (line 14) | func (e *EmailNotification) Send(message string) {
function NewEmailNotification (line 9) | func NewEmailNotification() *EmailNotification {
FILE: design-patterns/golang/factory/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/factory/notification.go
type Notification (line 4) | type Notification interface
FILE: design-patterns/golang/factory/simple_notification_factory.go
type SimpleNotificationFactory (line 4) | type SimpleNotificationFactory struct
method CreateNotification (line 12) | func (f *SimpleNotificationFactory) CreateNotification(notificationTyp...
function NewSimpleNotificationFactory (line 7) | func NewSimpleNotificationFactory() *SimpleNotificationFactory {
FILE: design-patterns/golang/factory/sms_notification.go
type SMSNotification (line 6) | type SMSNotification struct
method Send (line 14) | func (s *SMSNotification) Send(message string) {
function NewSMSNotification (line 9) | func NewSMSNotification() *SMSNotification {
FILE: design-patterns/golang/flyweight/character_flyweight.go
type CharacterFlyweight (line 4) | type CharacterFlyweight interface
FILE: design-patterns/golang/flyweight/character_flyweight_factory.go
type CharacterFlyweightFactory (line 6) | type CharacterFlyweightFactory struct
method GetFlyweight (line 18) | func (f *CharacterFlyweightFactory) GetFlyweight(symbol rune, fontFami...
method GetFlyweightCount (line 27) | func (f *CharacterFlyweightFactory) GetFlyweightCount() int {
function NewCharacterFlyweightFactory (line 11) | func NewCharacterFlyweightFactory() *CharacterFlyweightFactory {
FILE: design-patterns/golang/flyweight/character_glyph.go
type CharacterGlyph (line 6) | type CharacterGlyph struct
method Draw (line 24) | func (g *CharacterGlyph) Draw(x, y int) {
function NewCharacterGlyph (line 14) | func NewCharacterGlyph(symbol rune, fontFamily string, fontSize int, col...
FILE: design-patterns/golang/flyweight/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/flyweight/text_editor_client.go
type TextEditorClient (line 4) | type TextEditorClient struct
method RenderText (line 16) | func (c *TextEditorClient) RenderText(text string, x, y int, fontFamil...
method GetUniqueCharacterCount (line 24) | func (c *TextEditorClient) GetUniqueCharacterCount() int {
function NewTextEditorClient (line 9) | func NewTextEditorClient() *TextEditorClient {
FILE: design-patterns/golang/iterator/book.go
type Book (line 4) | type Book struct
function NewBook (line 10) | func NewBook(title, author string) *Book {
FILE: design-patterns/golang/iterator/book_collection.go
type BookCollection (line 4) | type BookCollection struct
method AddBook (line 16) | func (bc *BookCollection) AddBook(book *Book) {
method CreateIterator (line 21) | func (bc *BookCollection) CreateIterator() Iterator {
function NewBookCollection (line 9) | func NewBookCollection() *BookCollection {
type BookIterator (line 26) | type BookIterator struct
method HasNext (line 40) | func (bi *BookIterator) HasNext() bool {
method Next (line 45) | func (bi *BookIterator) Next() interface{} {
function NewBookIterator (line 32) | func NewBookIterator(collection *BookCollection) *BookIterator {
FILE: design-patterns/golang/iterator/collection.go
type Collection (line 4) | type Collection interface
FILE: design-patterns/golang/iterator/iterator.go
type Iterator (line 4) | type Iterator interface
FILE: design-patterns/golang/iterator/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/mediator/chat_mediator.go
type ChatMediator (line 4) | type ChatMediator struct
method AddUser (line 14) | func (m *ChatMediator) AddUser(user Colleague) {
method SendMessage (line 20) | func (m *ChatMediator) SendMessage(message string, sender Colleague) {
function NewChatMediator (line 9) | func NewChatMediator() *ChatMediator {
FILE: design-patterns/golang/mediator/colleague.go
type Colleague (line 4) | type Colleague interface
FILE: design-patterns/golang/mediator/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/mediator/mediator.go
type Mediator (line 4) | type Mediator interface
FILE: design-patterns/golang/mediator/user.go
type User (line 6) | type User struct
method SetMediator (line 16) | func (u *User) SetMediator(mediator Mediator) {
method GetName (line 20) | func (u *User) GetName() string {
method ReceiveMessage (line 24) | func (u *User) ReceiveMessage(message string) {
method SendMessage (line 29) | func (u *User) SendMessage(message string) {
function NewUser (line 12) | func NewUser(name string) *User {
FILE: design-patterns/golang/memento/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/memento/text_editor.go
type TextEditor (line 6) | type TextEditor struct
method Type (line 16) | func (e *TextEditor) Type(words string) {
method GetContent (line 22) | func (e *TextEditor) GetContent() string {
method Save (line 27) | func (e *TextEditor) Save() *TextEditorMemento {
method Restore (line 33) | func (e *TextEditor) Restore(memento *TextEditorMemento) {
function NewTextEditor (line 11) | func NewTextEditor() *TextEditor {
FILE: design-patterns/golang/memento/text_editor_memento.go
type TextEditorMemento (line 4) | type TextEditorMemento struct
function NewTextEditorMemento (line 9) | func NewTextEditorMemento(state string) *TextEditorMemento {
FILE: design-patterns/golang/memento/text_editor_undo_manager.go
type TextEditorUndoManager (line 6) | type TextEditorUndoManager struct
method Save (line 16) | func (m *TextEditorUndoManager) Save(editor *TextEditor) {
method Undo (line 21) | func (m *TextEditorUndoManager) Undo(editor *TextEditor) {
function NewTextEditorUndoManager (line 11) | func NewTextEditorUndoManager() *TextEditorUndoManager {
FILE: design-patterns/golang/observer/fitness_data.go
type FitnessData (line 4) | type FitnessData struct
method RegisterObserver (line 18) | func (f *FitnessData) RegisterObserver(observer FitnessDataObserver) {
method RemoveObserver (line 22) | func (f *FitnessData) RemoveObserver(observer FitnessDataObserver) {
method NotifyObservers (line 31) | func (f *FitnessData) NotifyObservers() {
method SetMeasurements (line 38) | func (f *FitnessData) SetMeasurements(steps int, calories int, distanc...
function NewFitnessData (line 12) | func NewFitnessData() *FitnessData {
FILE: design-patterns/golang/observer/fitness_data_observer.go
type FitnessDataObserver (line 4) | type FitnessDataObserver interface
FILE: design-patterns/golang/observer/fitness_data_subject.go
type FitnessDataSubject (line 4) | type FitnessDataSubject interface
FILE: design-patterns/golang/observer/goal_notifier.go
type GoalNotifier (line 6) | type GoalNotifier struct
method Update (line 14) | func (g *GoalNotifier) Update(steps int, calories int, distance float6...
function NewGoalNotifier (line 10) | func NewGoalNotifier(goalSteps int) *GoalNotifier {
FILE: design-patterns/golang/observer/live_activity_display.go
type LiveActivityDisplay (line 6) | type LiveActivityDisplay struct
method Update (line 12) | func (l *LiveActivityDisplay) Update(steps int, calories int, distance...
function NewLiveActivityDisplay (line 8) | func NewLiveActivityDisplay() *LiveActivityDisplay {
FILE: design-patterns/golang/observer/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/observer/progress_logger.go
type ProgressLogger (line 6) | type ProgressLogger struct
method Update (line 12) | func (p *ProgressLogger) Update(steps int, calories int, distance floa...
function NewProgressLogger (line 8) | func NewProgressLogger() *ProgressLogger {
FILE: design-patterns/golang/prototype/enemy.go
type Enemy (line 6) | type Enemy struct
method Clone (line 26) | func (e *Enemy) Clone() EnemyPrototype {
method SetHealth (line 31) | func (e *Enemy) SetHealth(health int) {
method PrintStats (line 36) | func (e *Enemy) PrintStats() {
function NewEnemy (line 15) | func NewEnemy(type_ string, health int, speed float64, armored bool, wea...
FILE: design-patterns/golang/prototype/enemy_prototype.go
type EnemyPrototype (line 4) | type EnemyPrototype interface
FILE: design-patterns/golang/prototype/enemy_registry.go
type EnemyRegistry (line 4) | type EnemyRegistry struct
method Register (line 16) | func (r *EnemyRegistry) Register(key string, prototype *Enemy) {
method Get (line 21) | func (r *EnemyRegistry) Get(key string) *Enemy {
function NewEnemyRegistry (line 9) | func NewEnemyRegistry() *EnemyRegistry {
FILE: design-patterns/golang/prototype/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/proxy/high_resolution_image.go
type HighResolutionImage (line 9) | type HighResolutionImage struct
method loadImageFromDisk (line 21) | func (i *HighResolutionImage) loadImageFromDisk() {
method Display (line 29) | func (i *HighResolutionImage) Display() {
method GetFileName (line 34) | func (i *HighResolutionImage) GetFileName() string {
function NewHighResolutionImage (line 15) | func NewHighResolutionImage(fileName string) *HighResolutionImage {
FILE: design-patterns/golang/proxy/image.go
type Image (line 4) | type Image interface
FILE: design-patterns/golang/proxy/image_proxy.go
type ImageProxy (line 6) | type ImageProxy struct
method GetFileName (line 17) | func (p *ImageProxy) GetFileName() string {
method Display (line 22) | func (p *ImageProxy) Display() {
function NewImageProxy (line 12) | func NewImageProxy(fileName string) *ImageProxy {
FILE: design-patterns/golang/proxy/main.go
function main (line 5) | func main() {
FILE: design-patterns/golang/singleton/double_checked_singleton.go
type DoubleCheckedSingleton (line 6) | type DoubleCheckedSingleton struct
function GetDoubleCheckedInstance (line 14) | func GetDoubleCheckedInstance() *DoubleCheckedSingleton {
FILE: design-patterns/golang/singleton/eager_singleton.go
type EagerSingleton (line 4) | type EagerSingleton struct
function GetInstance (line 10) | func GetInstance() *EagerSingleton {
FILE: design-patterns/golang/singleton/lazy_singleton.go
type LazySingleton (line 6) | type LazySingleton struct
function GetInstance (line 14) | func GetInstance() *LazySingleton {
FILE: design-patterns/golang/singleton/thread_safe_singleton.go
type ThreadSafeSingleton (line 6) | type ThreadSafeSingleton struct
function GetThreadSafeInstance (line 14) | func GetThreadSafeInstance() *ThreadSafeSingleton {
FILE: design-patterns/golang/state/has_money_state.go
type HasMoneyState (line 6) | type HasMoneyState struct
method SelectItem (line 8) | func (s *HasMoneyState) SelectItem(context *VendingMachine, item strin...
method InsertCoin (line 12) | func (s *HasMoneyState) InsertCoin(context *VendingMachine, amount flo...
method DispenseItem (line 16) | func (s *HasMoneyState) DispenseItem(context *VendingMachine) {
FILE: design-patterns/golang/state/idle_state.go
type IdleState (line 6) | type IdleState struct
method SelectItem (line 8) | func (s *IdleState) SelectItem(context *VendingMachine, item string) {
method InsertCoin (line 14) | func (s *IdleState) InsertCoin(context *VendingMachine, amount float64) {
method DispenseItem (line 18) | func (s *IdleState) DispenseItem(context *VendingMachine) {
FILE: design-patterns/golang/state/item_selected_state.go
type ItemSelectedState (line 6) | type ItemSelectedState struct
method SelectItem (line 8) | func (s *ItemSelectedState) SelectItem(context *VendingMachine, item s...
method InsertCoin (line 12) | func (s *ItemSelectedState) InsertCoin(context *VendingMachine, amount...
method DispenseItem (line 18) | func (s *ItemSelectedState) DispenseItem(context *VendingMachine) {
FILE: design-patterns/golang/state/machine_state.go
type MachineState (line 4) | type MachineState interface
FILE: design-patterns/golang/state/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/state/vending_machine.go
type VendingMachine (line 6) | type VendingMachine struct
method SetState (line 18) | func (vm *VendingMachine) SetState(state MachineState) {
method SetSelectedItem (line 22) | func (vm *VendingMachine) SetSelectedItem(item string) {
method SetInsertedAmount (line 26) | func (vm *VendingMachine) SetInsertedAmount(amount float64) {
method GetSelectedItem (line 30) | func (vm *VendingMachine) GetSelectedItem() string {
method GetInsertedAmount (line 34) | func (vm *VendingMachine) GetInsertedAmount() float64 {
method SelectItem (line 38) | func (vm *VendingMachine) SelectItem(item string) {
method InsertCoin (line 42) | func (vm *VendingMachine) InsertCoin(amount float64) {
method DispenseItem (line 46) | func (vm *VendingMachine) DispenseItem() {
method Reset (line 50) | func (vm *VendingMachine) Reset() {
function NewVendingMachine (line 12) | func NewVendingMachine() *VendingMachine {
FILE: design-patterns/golang/strategy/credit_card_payment.go
type CreditCardPayment (line 6) | type CreditCardPayment struct
method Pay (line 24) | func (c *CreditCardPayment) Pay(amount float64) string {
function NewCreditCardPayment (line 14) | func NewCreditCardPayment(cardNumber, name, cvv, dateOfExp string) *Cred...
FILE: design-patterns/golang/strategy/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/strategy/payment_strategy.go
type PaymentStrategy (line 4) | type PaymentStrategy interface
FILE: design-patterns/golang/strategy/paypal_payment.go
type PayPalPayment (line 6) | type PayPalPayment struct
method Pay (line 16) | func (p *PayPalPayment) Pay(amount float64) string {
function NewPayPalPayment (line 11) | func NewPayPalPayment(email string) *PayPalPayment {
FILE: design-patterns/golang/strategy/shopping_cart.go
type ShoppingCart (line 6) | type ShoppingCart struct
method SetPaymentStrategy (line 15) | func (c *ShoppingCart) SetPaymentStrategy(strategy PaymentStrategy) {
method Checkout (line 19) | func (c *ShoppingCart) Checkout() {
function NewShoppingCart (line 11) | func NewShoppingCart(amount float64) *ShoppingCart {
FILE: design-patterns/golang/templatemethod/csv_data_processor.go
type CSVDataProcessor (line 5) | type CSVDataProcessor struct
method ReadData (line 7) | func (c *CSVDataProcessor) ReadData() {
method ProcessData (line 11) | func (c *CSVDataProcessor) ProcessData() {
method SaveData (line 15) | func (c *CSVDataProcessor) SaveData() {
FILE: design-patterns/golang/templatemethod/data_processor.go
type DataProcessor (line 8) | type DataProcessor interface
type BaseDataProcessor (line 14) | type BaseDataProcessor struct
method Process (line 18) | func (b *BaseDataProcessor) Process() {
FILE: design-patterns/golang/templatemethod/main.go
function main (line 3) | func main() {
FILE: design-patterns/golang/templatemethod/xml_data_processor.go
type XMLDataProcessor (line 5) | type XMLDataProcessor struct
method ReadData (line 7) | func (x *XMLDataProcessor) ReadData() {
method ProcessData (line 11) | func (x *XMLDataProcessor) ProcessData() {
method SaveData (line 15) | func (x *XMLDataProcessor) SaveData() {
FILE: design-patterns/java/abstractfactory/AppLauncher.java
class AppLauncher (line 1) | public class AppLauncher {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/abstractfactory/Application.java
class Application (line 1) | public class Application {
method Application (line 5) | public Application(GUIFactory factory) {
method renderUI (line 10) | public void renderUI() {
FILE: design-patterns/java/abstractfactory/Button.java
type Button (line 1) | public interface Button {
method paint (line 2) | void paint();
method onClick (line 3) | void onClick();
FILE: design-patterns/java/abstractfactory/Checkbox.java
type Checkbox (line 1) | public interface Checkbox {
method paint (line 2) | void paint();
method onSelect (line 3) | void onSelect();
FILE: design-patterns/java/abstractfactory/GUIFactory.java
type GUIFactory (line 1) | public interface GUIFactory {
method createButton (line 2) | Button createButton();
method createCheckbox (line 3) | Checkbox createCheckbox();
FILE: design-patterns/java/abstractfactory/MacOSButton.java
class MacOSButton (line 1) | public class MacOSButton implements Button {
method paint (line 2) | @Override
method onClick (line 7) | @Override
FILE: design-patterns/java/abstractfactory/MacOSCheckbox.java
class MacOSCheckbox (line 1) | public class MacOSCheckbox implements Checkbox {
method paint (line 2) | @Override
method onSelect (line 7) | @Override
FILE: design-patterns/java/abstractfactory/MacOSFactory.java
class MacOSFactory (line 1) | public class MacOSFactory implements GUIFactory {
method createButton (line 2) | @Override
method createCheckbox (line 7) | @Override
FILE: design-patterns/java/abstractfactory/WindowsButton.java
class WindowsButton (line 1) | public class WindowsButton implements Button {
method paint (line 2) | @Override
method onClick (line 7) | @Override
FILE: design-patterns/java/abstractfactory/WindowsCheckbox.java
class WindowsCheckbox (line 1) | public class WindowsCheckbox implements Checkbox {
method paint (line 2) | @Override
method onSelect (line 7) | @Override
FILE: design-patterns/java/abstractfactory/WindowsFactory.java
class WindowsFactory (line 1) | public class WindowsFactory implements GUIFactory {
method createButton (line 2) | @Override
method createCheckbox (line 7) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/BumpySole.java
class BumpySole (line 1) | public class BumpySole implements Sole {
method soleBuild (line 3) | @Override
method soleMaterial (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/CasualShoeFactory.java
class CasualShoeFactory (line 1) | public class CasualShoeFactory implements ShoeFactory {
method createShoeSole (line 3) | @Override
method createShoeLace (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/FlatSole.java
class FlatSole (line 1) | public class FlatSole implements Sole {
method soleBuild (line 3) | @Override
method soleMaterial (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/FormalShoeFactory.java
class FormalShoeFactory (line 1) | public class FormalShoeFactory implements ShoeFactory {
method createShoeSole (line 3) | @Override
method createShoeLace (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/RoundShoeLace.java
class RoundShoeLace (line 1) | public class RoundShoeLace implements ShoeLace {
method shoeLaceBuild (line 3) | @Override
method shoeLaceMaterial (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/Shoe.java
class Shoe (line 1) | public class Shoe {
method Shoe (line 5) | public Shoe(Sole sole, ShoeLace shoeLace){
method displayBuildShoe (line 10) | public void displayBuildShoe()
FILE: design-patterns/java/abstractfactory/shoefactory/ShoeFactory.java
type ShoeFactory (line 1) | public interface ShoeFactory {
method createShoeSole (line 2) | public Sole createShoeSole();
method createShoeLace (line 3) | public ShoeLace createShoeLace();
FILE: design-patterns/java/abstractfactory/shoefactory/ShoeLace.java
type ShoeLace (line 1) | public interface ShoeLace {
method shoeLaceBuild (line 3) | public String shoeLaceBuild();
method shoeLaceMaterial (line 4) | public String shoeLaceMaterial();
FILE: design-patterns/java/abstractfactory/shoefactory/ShoeManufacture.java
class ShoeManufacture (line 1) | public class ShoeManufacture {
method produceShoe (line 4) | public static Shoe produceShoe(String shoeType)
method main (line 20) | public static void main(String[] args) {
FILE: design-patterns/java/abstractfactory/shoefactory/Sole.java
type Sole (line 1) | public interface Sole {
method soleBuild (line 3) | public String soleBuild();
method soleMaterial (line 4) | public String soleMaterial();
FILE: design-patterns/java/abstractfactory/shoefactory/SportsShoeFactory.java
class SportsShoeFactory (line 1) | public class SportsShoeFactory implements ShoeFactory {
method createShoeSole (line 3) | @Override
method createShoeLace (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/TapeShoeLace.java
class TapeShoeLace (line 1) | public class TapeShoeLace implements ShoeLace{
method shoeLaceBuild (line 3) | @Override
method shoeLaceMaterial (line 8) | @Override
FILE: design-patterns/java/abstractfactory/shoefactory/ThinSole.java
class ThinSole (line 1) | public class ThinSole implements Sole {
method soleBuild (line 3) | @Override
method soleMaterial (line 8) | @Override
FILE: design-patterns/java/adapter/CheckoutService.java
class CheckoutService (line 1) | public class CheckoutService {
method CheckoutService (line 4) | public CheckoutService(PaymentProcessor paymentProcessor) {
method checkout (line 8) | public void checkout(double amount, String currency) {
FILE: design-patterns/java/adapter/ECommerceAppV1.java
class ECommerceAppV1 (line 1) | public class ECommerceAppV1 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/adapter/ECommerceAppV2.java
class ECommerceAppV2 (line 1) | public class ECommerceAppV2 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/adapter/InHousePaymentProcessor.java
class InHousePaymentProcessor (line 1) | public class InHousePaymentProcessor implements PaymentProcessor {
method processPayment (line 5) | @Override
method isPaymentSuccessful (line 14) | @Override
method getTransactionId (line 19) | @Override
FILE: design-patterns/java/adapter/LegacyGateway.java
class LegacyGateway (line 1) | public class LegacyGateway {
method executeTransaction (line 5) | public void executeTransaction(double totalAmount, String currency) {
method checkStatus (line 12) | public boolean checkStatus(long transactionReference) {
method getReferenceNumber (line 17) | public long getReferenceNumber() {
FILE: design-patterns/java/adapter/LegacyGatewayAdapter.java
class LegacyGatewayAdapter (line 1) | public class LegacyGatewayAdapter implements PaymentProcessor {
method LegacyGatewayAdapter (line 4) | public LegacyGatewayAdapter(LegacyGateway legacyGateway) {
method processPayment (line 8) | @Override
method isPaymentSuccessful (line 15) | @Override
method getTransactionId (line 20) | @Override
FILE: design-patterns/java/adapter/PaymentProcessor.java
type PaymentProcessor (line 1) | public interface PaymentProcessor {
method processPayment (line 2) | void processPayment(double amount, String currency);
method isPaymentSuccessful (line 3) | boolean isPaymentSuccessful();
method getTransactionId (line 4) | String getTransactionId();
FILE: design-patterns/java/bridge/BridgeDemo.java
class BridgeDemo (line 1) | public class BridgeDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/bridge/Circle.java
class Circle (line 1) | public class Circle extends Shape {
method Circle (line 4) | public Circle(Renderer renderer, float radius) {
method draw (line 9) | @Override
FILE: design-patterns/java/bridge/RasterRenderer.java
class RasterRenderer (line 1) | public class RasterRenderer implements Renderer {
method renderCircle (line 2) | @Override
method renderRectangle (line 7) | @Override
FILE: design-patterns/java/bridge/Rectangle.java
class Rectangle (line 1) | public class Rectangle extends Shape {
method Rectangle (line 5) | public Rectangle(Renderer renderer, float width, float height) {
method draw (line 11) | @Override
FILE: design-patterns/java/bridge/Renderer.java
type Renderer (line 1) | public interface Renderer {
method renderCircle (line 2) | void renderCircle(float radius);
method renderRectangle (line 3) | void renderRectangle(float width, float height);
FILE: design-patterns/java/bridge/Shape.java
class Shape (line 1) | public abstract class Shape {
method Shape (line 4) | public Shape(Renderer renderer) {
method draw (line 8) | public abstract void draw();
FILE: design-patterns/java/bridge/VectorRenderer.java
class VectorRenderer (line 1) | public class VectorRenderer implements Renderer {
method renderCircle (line 2) | @Override
method renderRectangle (line 7) | @Override
FILE: design-patterns/java/builder/HttpAppBuilder.java
class HttpAppBuilder (line 1) | public class HttpAppBuilder {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/builder/HttpAppTelescoping.java
class HttpAppTelescoping (line 1) | public class HttpAppTelescoping {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/builder/HttpRequest.java
class HttpRequest (line 5) | public class HttpRequest {
method HttpRequest (line 14) | private HttpRequest(Builder builder) {
method getUrl (line 24) | public String getUrl() { return url; }
method getMethod (line 25) | public String getMethod() { return method; }
method getHeaders (line 26) | public Map<String, String> getHeaders() { return headers; }
method getQueryParams (line 27) | public Map<String, String> getQueryParams() { return queryParams; }
method getBody (line 28) | public String getBody() { return body; }
method getTimeout (line 29) | public int getTimeout() { return timeout; }
method toString (line 31) | @Override
class Builder (line 44) | public static class Builder {
method Builder (line 56) | public Builder(String url) {
method method (line 64) | public Builder method(String method) {
method header (line 69) | public Builder header(String key, String value) {
method queryParam (line 76) | public Builder queryParam(String key, String value) {
method body (line 83) | public Builder body(String body) {
method timeout (line 88) | public Builder timeout(int timeoutMillis) {
method build (line 96) | public HttpRequest build() {
FILE: design-patterns/java/builder/HttpRequestTelescoping.java
class HttpRequestTelescoping (line 5) | public class HttpRequestTelescoping {
method HttpRequestTelescoping (line 13) | public HttpRequestTelescoping(String url) {
method HttpRequestTelescoping (line 16) | public HttpRequestTelescoping(String url, String method) {
method HttpRequestTelescoping (line 19) | public HttpRequestTelescoping(String url, String method, Map<String, S...
method HttpRequestTelescoping (line 22) | public HttpRequestTelescoping(String url, String method, Map<String, S...
method HttpRequestTelescoping (line 25) | public HttpRequestTelescoping(String url, String method, Map<String, S...
method HttpRequestTelescoping (line 28) | public HttpRequestTelescoping(String url, String method, Map<String, S...
FILE: design-patterns/java/chainofresponsibility/AuthHandler.java
class AuthHandler (line 1) | public class AuthHandler extends BaseHandler {
method handle (line 2) | @Override
FILE: design-patterns/java/chainofresponsibility/AuthorizationHandler.java
class AuthorizationHandler (line 1) | public class AuthorizationHandler extends BaseHandler {
method handle (line 2) | @Override
FILE: design-patterns/java/chainofresponsibility/BaseHandler.java
class BaseHandler (line 1) | public abstract class BaseHandler implements RequestHandler {
method setNext (line 4) | @Override
method forward (line 9) | protected void forward(Request request) {
FILE: design-patterns/java/chainofresponsibility/BusinessLogicHandler.java
class BusinessLogicHandler (line 1) | public class BusinessLogicHandler extends BaseHandler {
method handle (line 2) | @Override
FILE: design-patterns/java/chainofresponsibility/RateLimitHandler.java
class RateLimitHandler (line 1) | public class RateLimitHandler extends BaseHandler {
method handle (line 2) | @Override
FILE: design-patterns/java/chainofresponsibility/Request.java
class Request (line 1) | public class Request {
method Request (line 7) | public Request(String user, String role, int requestCount, String payl...
FILE: design-patterns/java/chainofresponsibility/RequestHandler.java
type RequestHandler (line 1) | public interface RequestHandler {
method setNext (line 2) | void setNext(RequestHandler next);
method handle (line 3) | void handle(Request request);
FILE: design-patterns/java/chainofresponsibility/RequestHandlerV1.java
class RequestHandlerV1 (line 1) | public class RequestHandlerV1 {
method handle (line 2) | public void handle(Request request) {
method authenticate (line 27) | private boolean authenticate(Request req) {
method authorize (line 31) | private boolean authorize(Request req) {
method rateLimit (line 35) | private boolean rateLimit(Request req) {
method validate (line 39) | private boolean validate(Request req) {
FILE: design-patterns/java/chainofresponsibility/RequestHandlerV2.java
class RequestHandlerV2 (line 1) | public class RequestHandlerV2 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/chainofresponsibility/ValidationHandler.java
class ValidationHandler (line 1) | public class ValidationHandler extends BaseHandler {
method handle (line 2) | @Override
FILE: design-patterns/java/command/Command.java
type Command (line 1) | interface Command {
method execute (line 2) | void execute();
method undo (line 3) | void undo();
FILE: design-patterns/java/command/CommandPatternDemo.java
class CommandPatternDemo (line 1) | public class CommandPatternDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/command/Light.java
class Light (line 1) | public class Light {
method on (line 2) | public void on() {
method off (line 6) | public void off() {
FILE: design-patterns/java/command/LightOffCommand.java
class LightOffCommand (line 1) | public class LightOffCommand implements Command {
method LightOffCommand (line 4) | public LightOffCommand(Light light) {
method execute (line 8) | @Override
method undo (line 13) | @Override
FILE: design-patterns/java/command/LightOnCommand.java
class LightOnCommand (line 1) | public class LightOnCommand implements Command {
method LightOnCommand (line 4) | public LightOnCommand(Light light) {
method execute (line 8) | @Override
method undo (line 13) | @Override
FILE: design-patterns/java/command/SetTemperatureCommand.java
class SetTemperatureCommand (line 1) | public class SetTemperatureCommand implements Command {
method SetTemperatureCommand (line 6) | public SetTemperatureCommand(Thermostat thermostat, int temperature) {
method execute (line 11) | @Override
method undo (line 17) | @Override
FILE: design-patterns/java/command/SmartButton.java
class SmartButton (line 3) | public class SmartButton {
method setCommand (line 7) | public void setCommand(Command command) {
method press (line 11) | public void press() {
method undoLast (line 20) | public void undoLast() {
FILE: design-patterns/java/command/Thermostat.java
class Thermostat (line 1) | public class Thermostat {
method setTemperature (line 4) | public void setTemperature(int temp) {
method getCurrentTemperature (line 9) | public int getCurrentTemperature() {
FILE: design-patterns/java/composite/filesystem/File.java
class File (line 1) | public class File implements FileSystemItem {
method File (line 5) | public File(String name, int size) {
method getSize (line 10) | @Override
method printStructure (line 15) | @Override
method delete (line 20) | @Override
FILE: design-patterns/java/composite/filesystem/FileExplorerApp.java
class FileExplorerApp (line 1) | public class FileExplorerApp {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/composite/filesystem/FileSystemItem.java
type FileSystemItem (line 1) | public interface FileSystemItem {
method getSize (line 2) | int getSize();
method printStructure (line 3) | void printStructure(String indent);
method delete (line 4) | void delete();
FILE: design-patterns/java/composite/filesystem/Folder.java
class Folder (line 4) | public class Folder implements FileSystemItem {
method Folder (line 8) | public Folder(String name) {
method addItem (line 12) | public void addItem(FileSystemItem item) {
method getSize (line 16) | @Override
method printStructure (line 25) | @Override
method delete (line 33) | @Override
FILE: design-patterns/java/composite/organization/CompositeDemo.java
class CompositeDemo (line 1) | public class CompositeDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/composite/organization/Designer.java
class Designer (line 1) | class Designer implements Employee {
method Designer (line 5) | public Designer(String name, double salary) {
method showDetails (line 10) | @Override
method getSalary (line 15) | @Override
FILE: design-patterns/java/composite/organization/Developer.java
class Developer (line 1) | class Developer implements Employee {
method Developer (line 5) | public Developer(String name, double salary) {
method showDetails (line 10) | @Override
method getSalary (line 15) | @Override
FILE: design-patterns/java/composite/organization/Employee.java
type Employee (line 1) | interface Employee {
method showDetails (line 2) | void showDetails();
method getSalary (line 3) | double getSalary();
FILE: design-patterns/java/composite/organization/Manager.java
class Manager (line 4) | class Manager implements Employee {
method Manager (line 9) | public Manager(String name, double salary) {
method addEmployee (line 14) | public void addEmployee(Employee employee) {
method removeEmployee (line 18) | public void removeEmployee(Employee employee) {
method showDetails (line 22) | @Override
method getSalary (line 31) | @Override
FILE: design-patterns/java/decorator/BoldDecorator.java
class BoldDecorator (line 1) | public class BoldDecorator extends TextDecorator {
method BoldDecorator (line 2) | public BoldDecorator(TextView inner) {
method render (line 6) | @Override
FILE: design-patterns/java/decorator/DecoratorDemo.java
class DecoratorDemo (line 1) | public class DecoratorDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/decorator/ItalicDecorator.java
class ItalicDecorator (line 1) | public class ItalicDecorator extends TextDecorator {
method ItalicDecorator (line 2) | public ItalicDecorator(TextView inner) {
method render (line 6) | @Override
FILE: design-patterns/java/decorator/PlainTextView.java
class PlainTextView (line 1) | public class PlainTextView implements TextView {
method PlainTextView (line 4) | public PlainTextView(String text) {
method render (line 8) | @Override
FILE: design-patterns/java/decorator/TextDecorator.java
class TextDecorator (line 1) | public abstract class TextDecorator implements TextView {
method TextDecorator (line 4) | public TextDecorator(TextView inner) {
FILE: design-patterns/java/decorator/TextView.java
type TextView (line 1) | public interface TextView {
method render (line 2) | void render();
FILE: design-patterns/java/decorator/UnderlineDecorator.java
class UnderlineDecorator (line 1) | public class UnderlineDecorator extends TextDecorator {
method UnderlineDecorator (line 2) | public UnderlineDecorator(TextView inner) {
method render (line 6) | @Override
FILE: design-patterns/java/decorator/coffee/Coffee.java
type Coffee (line 1) | interface Coffee {
method getCost (line 2) | double getCost();
method getDescription (line 3) | String getDescription();
FILE: design-patterns/java/decorator/coffee/CoffeeDecorator.java
class CoffeeDecorator (line 1) | abstract class CoffeeDecorator implements Coffee {
method CoffeeDecorator (line 4) | public CoffeeDecorator(Coffee coffee) {
method getCost (line 8) | public double getCost() {
method getDescription (line 12) | public String getDescription() {
FILE: design-patterns/java/decorator/coffee/DecoratorDemo.java
class DecoratorDemo (line 1) | public class DecoratorDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/decorator/coffee/Milk.java
class Milk (line 1) | class Milk extends CoffeeDecorator {
method Milk (line 2) | public Milk(Coffee coffee) {
method getCost (line 6) | @Override
method getDescription (line 11) | @Override
FILE: design-patterns/java/decorator/coffee/SimpleCoffee.java
class SimpleCoffee (line 1) | class SimpleCoffee implements Coffee {
method getCost (line 2) | @Override
method getDescription (line 7) | @Override
FILE: design-patterns/java/decorator/coffee/Sugar.java
class Sugar (line 1) | class Sugar extends CoffeeDecorator {
method Sugar (line 2) | public Sugar(Coffee coffee) {
method getCost (line 6) | @Override
method getDescription (line 11) | @Override
FILE: design-patterns/java/facade/BuildSystem.java
class BuildSystem (line 1) | public class BuildSystem {
method compileProject (line 2) | public boolean compileProject() {
method getArtifactPath (line 9) | public String getArtifactPath() {
method simulateDelay (line 15) | private void simulateDelay(int ms) {
FILE: design-patterns/java/facade/DeploymentAppDirect.java
class DeploymentAppDirect (line 1) | public class DeploymentAppDirect {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/facade/DeploymentAppFacade.java
class DeploymentAppFacade (line 1) | public class DeploymentAppFacade {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/facade/DeploymentFacade.java
class DeploymentFacade (line 1) | public class DeploymentFacade {
method deployApplication (line 10) | public boolean deployApplication(String branch, String serverAddress) {
method deployHotfix (line 49) | public boolean deployHotfix(String branch, String serverAddress) {
FILE: design-patterns/java/facade/DeploymentOrchestrator.java
class DeploymentOrchestrator (line 1) | public class DeploymentOrchestrator {
method deployApplication (line 7) | public boolean deployApplication(String branch, String prodServer) {
FILE: design-patterns/java/facade/DeploymentTarget.java
class DeploymentTarget (line 1) | public class DeploymentTarget {
method transferArtifact (line 2) | public void transferArtifact(String artifactPath, String server) {
method activateNewVersion (line 8) | public void activateNewVersion(String server) {
method simulateDelay (line 14) | private void simulateDelay(int ms) {
FILE: design-patterns/java/facade/TestingFramework.java
class TestingFramework (line 1) | public class TestingFramework {
method runUnitTests (line 2) | public boolean runUnitTests() {
method runIntegrationTests (line 9) | public boolean runIntegrationTests() {
method simulateDelay (line 16) | private void simulateDelay(int ms) {
FILE: design-patterns/java/facade/VersionControlSystem.java
class VersionControlSystem (line 1) | public class VersionControlSystem {
method pullLatestChanges (line 2) | public void pullLatestChanges(String branch) {
method simulateDelay (line 8) | private void simulateDelay() {
FILE: design-patterns/java/factory/notification/EmailNotification.java
class EmailNotification (line 1) | public class EmailNotification implements Notification {
method send (line 2) | @Override
FILE: design-patterns/java/factory/notification/EmailNotificationCreator.java
class EmailNotificationCreator (line 1) | public class EmailNotificationCreator extends NotificationCreator {
method createNotification (line 2) | @Override
FILE: design-patterns/java/factory/notification/FactoryMethodDemo.java
class FactoryMethodDemo (line 1) | public class FactoryMethodDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/factory/notification/Notification.java
type Notification (line 1) | public interface Notification {
method send (line 2) | public void send(String message);
FILE: design-patterns/java/factory/notification/NotificationCreator.java
class NotificationCreator (line 1) | public abstract class NotificationCreator {
method createNotification (line 3) | public abstract Notification createNotification();
method send (line 6) | public void send(String message) {
FILE: design-patterns/java/factory/notification/NotificationServiceNaive.java
class NotificationServiceNaive (line 1) | public class NotificationServiceNaive {
method sendNotification (line 2) | public void sendNotification(String type, String message) {
FILE: design-patterns/java/factory/notification/PushNotification.java
class PushNotification (line 1) | public class PushNotification implements Notification {
method send (line 2) | @Override
FILE: design-patterns/java/factory/notification/PushNotificationCreator.java
class PushNotificationCreator (line 1) | public class PushNotificationCreator extends NotificationCreator {
method createNotification (line 2) | @Override
FILE: design-patterns/java/factory/notification/SMSNotification.java
class SMSNotification (line 1) | public class SMSNotification implements Notification {
method send (line 2) | @Override
FILE: design-patterns/java/factory/notification/SMSNotificationCreator.java
class SMSNotificationCreator (line 1) | public class SMSNotificationCreator extends NotificationCreator {
method createNotification (line 2) | @Override
FILE: design-patterns/java/factory/notification/SimpleNotificationFactory.java
class SimpleNotificationFactory (line 1) | public class SimpleNotificationFactory {
method createNotification (line 2) | public static Notification createNotification(String type) {
FILE: design-patterns/java/factory/subscription/Customer.java
class Customer (line 1) | public class Customer {
method Customer (line 5) | public Customer(String customerId) {
method SubscribePlan (line 9) | public void SubscribePlan(Subscription subscription) {
method unSubscribePlan (line 14) | public void unSubscribePlan() {
method updateSubcribePlan (line 18) | public void updateSubcribePlan(Subscription newSubscription) {
FILE: design-patterns/java/factory/subscription/DataBase.java
class DataBase (line 3) | public class DataBase {
method DataBase (line 6) | public DataBase() {
method addToDataBase (line 10) | public void addToDataBase(String customerId, String subscriptionType) {
method removeFromDataBase (line 16) | public void removeFromDataBase(String customerId) {
method updateDataBase (line 22) | public void updateDataBase(String customerId, String subscriptionType) {
FILE: design-patterns/java/factory/subscription/FactoryApplication.java
class FactoryApplication (line 1) | public class FactoryApplication {
method main (line 4) | public static void main(String[] arg) {
FILE: design-patterns/java/factory/subscription/Gold.java
class Gold (line 1) | public class Gold implements Subscription {
method Gold (line 5) | public Gold(DataBase dataBase) {
method subscriptionType (line 9) | @Override
method addSubscription (line 14) | @Override
method removeSubscription (line 21) | @Override
method updateSubscription (line 28) | @Override
FILE: design-patterns/java/factory/subscription/Platinum.java
class Platinum (line 1) | public class Platinum implements Subscription {
method Platinum (line 5) | public Platinum(DataBase dataBase) {
method subscriptionType (line 9) | @Override
method addSubscription (line 14) | @Override
method removeSubscription (line 21) | @Override
method updateSubscription (line 28) | @Override
FILE: design-patterns/java/factory/subscription/RoyalGold.java
class RoyalGold (line 1) | public class RoyalGold implements Subscription {
method RoyalGold (line 5) | public RoyalGold(DataBase dataBase) {
method subscriptionType (line 9) | @Override
method addSubscription (line 14) | @Override
method removeSubscription (line 21) | @Override
method updateSubscription (line 28) | @Override
FILE: design-patterns/java/factory/subscription/Silver.java
class Silver (line 1) | public class Silver implements Subscription {
method Silver (line 5) | public Silver(DataBase dataBase) {
method subscriptionType (line 9) | @Override
method addSubscription (line 14) | @Override
method removeSubscription (line 21) | @Override
method updateSubscription (line 28) | @Override
FILE: design-patterns/java/factory/subscription/Subscription.java
type Subscription (line 1) | public interface Subscription {
method subscriptionType (line 2) | public String subscriptionType();
method addSubscription (line 3) | public boolean addSubscription(Customer customer);
method removeSubscription (line 4) | public boolean removeSubscription(Customer customer);
method updateSubscription (line 5) | public boolean updateSubscription(Customer customer);
FILE: design-patterns/java/factory/subscription/SubscriptionFactory.java
class SubscriptionFactory (line 1) | public class SubscriptionFactory {
method SubscriptionFactory (line 4) | public SubscriptionFactory(DataBase dataBase){
method getSubscription (line 7) | public Subscription getSubscription(String subscriptionType){
FILE: design-patterns/java/flyweight/CharacterFlyweight.java
type CharacterFlyweight (line 1) | public interface CharacterFlyweight {
method draw (line 2) | void draw(int x, int y);
FILE: design-patterns/java/flyweight/CharacterFlyweightFactory.java
class CharacterFlyweightFactory (line 4) | public class CharacterFlyweightFactory {
method getFlyweight (line 7) | public static CharacterFlyweight getFlyweight(char symbol, String font...
method getFlyweightCount (line 15) | public int getFlyweightCount() {
FILE: design-patterns/java/flyweight/CharacterGlyph.java
class CharacterGlyph (line 1) | public class CharacterGlyph implements CharacterFlyweight {
method CharacterGlyph (line 7) | public CharacterGlyph(char symbol, String fontFamily, int fontSize, St...
method draw (line 14) | @Override
FILE: design-patterns/java/flyweight/FlyweightDemo.java
class FlyweightDemo (line 1) | public class FlyweightDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/flyweight/TextEditorClient.java
class TextEditorClient (line 4) | public class TextEditorClient {
method addCharacter (line 8) | public void addCharacter(char c, int x, int y, String font, int size, ...
method renderDocument (line 13) | public void renderDocument() {
class RenderedCharacter (line 20) | private static class RenderedCharacter {
method RenderedCharacter (line 24) | public RenderedCharacter(CharacterFlyweight glyph, int x, int y) {
method draw (line 30) | public void draw() {
FILE: design-patterns/java/iterator/IterableCollection.java
type IterableCollection (line 1) | public interface IterableCollection<T> {
method createIterator (line 2) | Iterator<T> createIterator();
FILE: design-patterns/java/iterator/Iterator.java
type Iterator (line 1) | public interface Iterator<T> {
method hasNext (line 2) | boolean hasNext();
method next (line 3) | T next();
FILE: design-patterns/java/iterator/MusicPlayer.java
class MusicPlayer (line 1) | public class MusicPlayer {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/iterator/Playlist.java
class Playlist (line 4) | public class Playlist implements IterableCollection<String> {
method addSong (line 7) | public void addSong(String song) {
method getSongAt (line 11) | public String getSongAt(int index) {
method getSize (line 15) | public int getSize() {
method createIterator (line 19) | @Override
FILE: design-patterns/java/iterator/PlaylistIterator.java
class PlaylistIterator (line 1) | public class PlaylistIterator implements Iterator<String> {
method PlaylistIterator (line 5) | public PlaylistIterator(Playlist playlist) {
method hasNext (line 9) | @Override
method next (line 14) | @Override
FILE: design-patterns/java/iterator/books/Book.java
class Book (line 1) | class Book {
method Book (line 4) | public Book(String title) {
method getTitle (line 8) | public String getTitle() {
FILE: design-patterns/java/iterator/books/BookShelf.java
class BookShelf (line 5) | class BookShelf implements Container<Book> {
method BookShelf (line 8) | public BookShelf() {
method addBook (line 12) | public void addBook(Book book) {
method getIterator (line 16) | @Override
class BookShelfIterator (line 22) | private class BookShelfIterator implements Iterator<Book> {
method hasNext (line 25) | @Override
method next (line 30) | @Override
FILE: design-patterns/java/iterator/books/Container.java
type Container (line 1) | interface Container<T> {
method getIterator (line 2) | Iterator<T> getIterator();
FILE: design-patterns/java/iterator/books/Iterator.java
type Iterator (line 1) | interface Iterator<T> {
method hasNext (line 2) | boolean hasNext();
method next (line 3) | T next();
FILE: design-patterns/java/iterator/books/IteratorDemo.java
class IteratorDemo (line 1) | public class IteratorDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/mediator/Button.java
class Button (line 1) | public class Button extends UIComponent {
method Button (line 4) | public Button(UIMediator mediator) {
method click (line 8) | public void click() {
method setEnabled (line 17) | public void setEnabled(boolean value) {
FILE: design-patterns/java/mediator/FormMediator.java
class FormMediator (line 1) | public class FormMediator implements UIMediator {
method setUsernameField (line 7) | public void setUsernameField(TextField usernameField) {
method setPasswordField (line 11) | public void setPasswordField(TextField passwordField) {
method setLoginButton (line 15) | public void setLoginButton(Button loginButton) {
method setStatusLabel (line 19) | public void setStatusLabel(Label statusLabel) {
method componentChanged (line 23) | @Override
FILE: design-patterns/java/mediator/Label.java
class Label (line 1) | public class Label extends UIComponent {
method Label (line 4) | public Label(UIMediator mediator) {
method setText (line 8) | public void setText(String message) {
FILE: design-patterns/java/mediator/MediatorApp.java
class MediatorApp (line 1) | public class MediatorApp {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/mediator/TextField.java
class TextField (line 1) | public class TextField extends UIComponent {
method TextField (line 4) | public TextField(UIMediator mediator) {
method setText (line 8) | public void setText(String newText) {
method getText (line 14) | public String getText() {
FILE: design-patterns/java/mediator/UIComponent.java
class UIComponent (line 1) | public abstract class UIComponent {
method UIComponent (line 4) | public UIComponent(UIMediator mediator) {
method notifyMediator (line 8) | public void notifyMediator() {
FILE: design-patterns/java/mediator/UIMediator.java
type UIMediator (line 1) | public interface UIMediator {
method componentChanged (line 2) | void componentChanged(UIComponent component);
FILE: design-patterns/java/memento/TextEditor.java
class TextEditor (line 1) | public class TextEditor {
method type (line 4) | public void type(String newText) {
method getContent (line 9) | public String getContent() {
method save (line 13) | public TextEditorMemento save() {
method restore (line 18) | public void restore(TextEditorMemento memento) {
FILE: design-patterns/java/memento/TextEditorMemento.java
class TextEditorMemento (line 1) | public class TextEditorMemento {
method TextEditorMemento (line 4) | public TextEditorMemento(String state) {
method getState (line 8) | public String getState() {
FILE: design-patterns/java/memento/TextEditorNaive.java
class TextEditorNaive (line 1) | public class TextEditorNaive {
method type (line 4) | public void type(String newText) {
method undo (line 8) | public void undo(String previousContent) {
method getContent (line 12) | public String getContent() {
FILE: design-patterns/java/memento/TextEditorUndoManager.java
class TextEditorUndoManager (line 3) | public class TextEditorUndoManager {
method save (line 6) | public void save(TextEditor editor) {
method undo (line 10) | public void undo(TextEditor editor) {
FILE: design-patterns/java/memento/TextEditorUndoV1.java
class TextEditorUndoV1 (line 1) | public class TextEditorUndoV1 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/memento/TextEditorUndoV2.java
class TextEditorUndoV2 (line 1) | public class TextEditorUndoV2 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/observer/FitnessAppNaiveClient.java
class FitnessAppNaiveClient (line 1) | public class FitnessAppNaiveClient {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/observer/FitnessAppObserverDemo.java
class FitnessAppObserverDemo (line 1) | public class FitnessAppObserverDemo {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/observer/FitnessData.java
class FitnessData (line 3) | public class FitnessData implements FitnessDataSubject {
method registerObserver (line 10) | @Override
method removeObserver (line 15) | @Override
method notifyObservers (line 20) | @Override
method newFitnessDataPushed (line 27) | public void newFitnessDataPushed(int steps, int activeMinutes, int cal...
method dailyReset (line 37) | public void dailyReset() {
method getSteps (line 46) | public int getSteps() { return steps; }
method getActiveMinutes (line 47) | public int getActiveMinutes() { return activeMinutes; }
method getCalories (line 48) | public int getCalories() { return calories; }
FILE: design-patterns/java/observer/FitnessDataNaive.java
class FitnessDataNaive (line 1) | public class FitnessDataNaive {
method FitnessDataNaive (line 11) | public FitnessDataNaive(LiveActivityDisplayNaive ld, ProgressLoggerNai...
method newFitnessDataPushed (line 18) | public void newFitnessDataPushed(int newSteps, int newActiveMinutes, i...
method dailyReset (line 32) | public void dailyReset() {
FILE: design-patterns/java/observer/FitnessDataObserver.java
type FitnessDataObserver (line 1) | public interface FitnessDataObserver {
method update (line 2) | void update(FitnessData data);
FILE: design-patterns/java/observer/FitnessDataSubject.java
type FitnessDataSubject (line 1) | public interface FitnessDataSubject {
method registerObserver (line 2) | void registerObserver(FitnessDataObserver o);
method removeObserver (line 3) | void removeObserver(FitnessDataObserver o);
method notifyObservers (line 4) | void notifyObservers();
FILE: design-patterns/java/observer/GoalNotifier.java
class GoalNotifier (line 1) | public class GoalNotifier implements FitnessDataObserver {
method update (line 5) | @Override
method reset (line 13) | public void reset() {
FILE: design-patterns/java/observer/LiveActivityDisplay.java
class LiveActivityDisplay (line 1) | public class LiveActivityDisplay implements FitnessDataObserver {
method update (line 2) | @Override
FILE: design-patterns/java/observer/LiveActivityDisplayNaive.java
class LiveActivityDisplayNaive (line 1) | public class LiveActivityDisplayNaive {
method showStats (line 2) | public void showStats(int steps, int activeMinutes, int calories) {
FILE: design-patterns/java/observer/NotificationServiceNaive.java
class NotificationServiceNaive (line 1) | public class NotificationServiceNaive {
method checkAndNotify (line 5) | public void checkAndNotify(int currentSteps) {
method resetDailyNotifications (line 12) | public void resetDailyNotifications() {
FILE: design-patterns/java/observer/ProgressLogger.java
class ProgressLogger (line 1) | public class ProgressLogger implements FitnessDataObserver {
method update (line 2) | @Override
FILE: design-patterns/java/observer/ProgressLoggerNaive.java
class ProgressLoggerNaive (line 1) | public class ProgressLoggerNaive {
method logDataPoint (line 2) | public void logDataPoint(int steps, int activeMinutes, int calories) {
FILE: design-patterns/java/prototype/Enemy.java
class Enemy (line 1) | public class Enemy implements EnemyPrototype {
method Enemy (line 8) | public Enemy(String type, int health, double speed, boolean armored, S...
method clone (line 16) | @Override
method setHealth (line 21) | public void setHealth(int health) {
method printStats (line 25) | public void printStats() {
FILE: design-patterns/java/prototype/EnemyPrototype.java
type EnemyPrototype (line 1) | public interface EnemyPrototype {
method clone (line 2) | EnemyPrototype clone();
FILE: design-patterns/java/prototype/EnemyRegistry.java
class EnemyRegistry (line 4) | public class EnemyRegistry {
method register (line 7) | public void register(String key, Enemy prototype) {
method get (line 11) | public Enemy get(String key) {
FILE: design-patterns/java/prototype/Game.java
class Game (line 1) | public class Game {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/proxy/HighResolutionImage.java
class HighResolutionImage (line 1) | public class HighResolutionImage implements Image {
method HighResolutionImage (line 5) | public HighResolutionImage(String fileName) {
method loadImageFromDisk (line 10) | private void loadImageFromDisk() {
method display (line 22) | @Override
method getFileName (line 28) | @Override
FILE: design-patterns/java/proxy/Image.java
type Image (line 1) | public interface Image {
method display (line 2) | void display();
method getFileName (line 3) | String getFileName();
FILE: design-patterns/java/proxy/ImageGalleryAppV1.java
class ImageGalleryAppV1 (line 1) | public class ImageGalleryAppV1 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/proxy/ImageGalleryAppV2.java
class ImageGalleryAppV2 (line 1) | public class ImageGalleryAppV2 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/proxy/ImageProxy.java
class ImageProxy (line 1) | public class ImageProxy implements Image {
method ImageProxy (line 5) | public ImageProxy(String fileName) {
method getFileName (line 10) | @Override
method display (line 16) | @Override
FILE: design-patterns/java/singleton/BillPughSingleton.java
class BillPughSingleton (line 1) | class BillPughSingleton {
method BillPughSingleton (line 3) | private BillPughSingleton() {}
class SingletonHelper (line 6) | private static class SingletonHelper {
method getInstance (line 11) | public static BillPughSingleton getInstance() {
FILE: design-patterns/java/singleton/DoubleCheckedLockingSingleton.java
class DoubleCheckedSingleton (line 1) | class DoubleCheckedSingleton {
method DoubleCheckedSingleton (line 6) | private DoubleCheckedSingleton() {}
method getInstance (line 9) | public static DoubleCheckedSingleton getInstance() {
FILE: design-patterns/java/singleton/EagerSingleton.java
class EagerSingleton (line 1) | class EagerSingleton {
method EagerSingleton (line 6) | private EagerSingleton() {}
method getInstance (line 9) | public static EagerSingleton getInstance() {
FILE: design-patterns/java/singleton/EnumSingleton.java
type EnumSingleton (line 1) | public enum EnumSingleton {
method doSomething (line 4) | public void doSomething() {
FILE: design-patterns/java/singleton/LazySingleton.java
class LazySingleton (line 1) | class LazySingleton {
method LazySingleton (line 6) | private LazySingleton() {}
method getInstance (line 9) | public static LazySingleton getInstance() {
FILE: design-patterns/java/singleton/StaticBlockSingleton.java
class StaticBlockSingleton (line 1) | class StaticBlockSingleton {
method StaticBlockSingleton (line 6) | private StaticBlockSingleton() {}
method getInstance (line 18) | public static StaticBlockSingleton getInstance() {
FILE: design-patterns/java/singleton/ThreadSafeSingleton.java
class ThreadSafeSingleton (line 1) | class ThreadSafeSingleton {
method ThreadSafeSingleton (line 6) | private ThreadSafeSingleton() {}
method getInstance (line 9) | public static synchronized ThreadSafeSingleton getInstance() {
FILE: design-patterns/java/state/DispensingState.java
class DispensingState (line 1) | public class DispensingState implements MachineState {
method selectItem (line 2) | @Override
method insertCoin (line 7) | @Override
method dispenseItem (line 12) | @Override
FILE: design-patterns/java/state/HasMoneyState.java
class HasMoneyState (line 1) | public class HasMoneyState implements MachineState {
method selectItem (line 2) | @Override
method insertCoin (line 7) | @Override
method dispenseItem (line 12) | @Override
FILE: design-patterns/java/state/IdleState.java
class IdleState (line 1) | public class IdleState implements MachineState {
method selectItem (line 2) | @Override
method insertCoin (line 9) | @Override
method dispenseItem (line 14) | @Override
FILE: design-patterns/java/state/ItemSelectedState.java
class ItemSelectedState (line 1) | public class ItemSelectedState implements MachineState {
method selectItem (line 2) | @Override
method insertCoin (line 7) | @Override
method dispenseItem (line 14) | @Override
FILE: design-patterns/java/state/MachineState.java
type MachineState (line 1) | public interface MachineState {
method selectItem (line 2) | void selectItem(VendingMachine context, String itemCode);
method insertCoin (line 3) | void insertCoin(VendingMachine context, double amount);
method dispenseItem (line 4) | void dispenseItem(VendingMachine context);
FILE: design-patterns/java/state/VendingMachine.java
class VendingMachine (line 1) | public class VendingMachine {
method VendingMachine (line 6) | public VendingMachine() {
method setState (line 10) | public void setState(MachineState newState) {
method setSelectedItem (line 14) | public void setSelectedItem(String itemCode) {
method setInsertedAmount (line 18) | public void setInsertedAmount(double amount) {
method getSelectedItem (line 22) | public String getSelectedItem() {
method getInsertedAmount (line 26) | public double getInsertedAmount() {
method selectItem (line 30) | public void selectItem(String itemCode) {
method insertCoin (line 34) | public void insertCoin(double amount) {
method dispenseItem (line 38) | public void dispenseItem() {
method reset (line 42) | public void reset() {
FILE: design-patterns/java/state/VendingMachineApp.java
class VendingMachineApp (line 1) | public class VendingMachineApp {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/state/VendingMachineNaive.java
class VendingMachineNaive (line 1) | public class VendingMachineNaive {
type State (line 2) | private enum State {
method selectItem (line 13) | public void selectItem(String itemCode) {
method insertCoin (line 32) | public void insertCoin(double amount) {
method dispenseItem (line 51) | public void dispenseItem() {
method cancelTransaction (line 79) | public void cancelTransaction() {
method resetMachine (line 98) | private void resetMachine() {
FILE: design-patterns/java/strategy/DistanceBasedShipping.java
class DistanceBasedShipping (line 1) | public class DistanceBasedShipping implements ShippingStrategy {
method DistanceBasedShipping (line 4) | public DistanceBasedShipping(double ratePerKm) {
method calculateCost (line 8) | @Override
FILE: design-patterns/java/strategy/ECommerceAppV1.java
class ECommerceAppV1 (line 1) | public class ECommerceAppV1 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/strategy/ECommerceAppV2.java
class ECommerceAppV2 (line 1) | public class ECommerceAppV2 {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/strategy/FlatRateShipping.java
class FlatRateShipping (line 1) | public class FlatRateShipping implements ShippingStrategy {
method FlatRateShipping (line 4) | public FlatRateShipping(double rate) {
method calculateCost (line 8) | @Override
FILE: design-patterns/java/strategy/Order.java
class Order (line 1) | public class Order {
method getTotalWeight (line 2) | public double getTotalWeight() { return 5.0; /* kg */ }
method getDestinationZone (line 3) | public String getDestinationZone() { return "ZoneA"; }
method getOrderValue (line 4) | public double getOrderValue() { return 150.0; }
FILE: design-patterns/java/strategy/ShippingCostCalculatorNaive.java
class ShippingCostCalculatorNaive (line 1) | public class ShippingCostCalculatorNaive {
method calculateShippingCost (line 2) | public double calculateShippingCost(Order order, String strategyType) {
FILE: design-patterns/java/strategy/ShippingCostService.java
class ShippingCostService (line 1) | public class ShippingCostService {
method ShippingCostService (line 5) | public ShippingCostService(ShippingStrategy strategy) {
method setStrategy (line 10) | public void setStrategy(ShippingStrategy strategy) {
method calculateShippingCost (line 15) | public double calculateShippingCost(Order order) {
FILE: design-patterns/java/strategy/ShippingStrategy.java
type ShippingStrategy (line 1) | public interface ShippingStrategy {
method calculateCost (line 2) | double calculateCost(Order order);
FILE: design-patterns/java/strategy/ThirdPartyApiShipping.java
class ThirdPartyApiShipping (line 1) | public class ThirdPartyApiShipping implements ShippingStrategy {
method ThirdPartyApiShipping (line 5) | public ThirdPartyApiShipping(double baseFee, double percentageFee) {
method calculateCost (line 10) | @Override
FILE: design-patterns/java/strategy/WeightBasedShipping.java
class WeightBasedShipping (line 1) | public class WeightBasedShipping implements ShippingStrategy {
method WeightBasedShipping (line 4) | public WeightBasedShipping(double ratePerKg) {
method calculateCost (line 8) | @Override
FILE: design-patterns/java/templatemethod/AbstractReportExporter.java
class AbstractReportExporter (line 1) | public abstract class AbstractReportExporter {
method exportReport (line 2) | public final void exportReport(ReportData data, String filePath) {
method prepareData (line 13) | protected void prepareData(ReportData data) {
method openFile (line 18) | protected void openFile(String filePath) {
method writeHeader (line 22) | protected abstract void writeHeader(ReportData data);
method writeDataRows (line 24) | protected abstract void writeDataRows(ReportData data);
method writeFooter (line 27) | protected void writeFooter(ReportData data) {
method closeFile (line 32) | protected void closeFile(String filePath) {
FILE: design-patterns/java/templatemethod/CsvReportExporter.java
class CsvReportExporter (line 3) | public class CsvReportExporter extends AbstractReportExporter {
method writeHeader (line 7) | @Override
method writeDataRows (line 12) | @Override
FILE: design-patterns/java/templatemethod/CsvReportExporterNaive.java
class CsvReportExporterNaive (line 1) | class CsvReportExporterNaive {
method export (line 2) | public void export(ReportData data, String filePath) {
FILE: design-patterns/java/templatemethod/ExcelReportExporter.java
class ExcelReportExporter (line 3) | public class ExcelReportExporter extends AbstractReportExporter {
method writeHeader (line 7) | @Override
method writeDataRows (line 12) | @Override
FILE: design-patterns/java/templatemethod/ExcelReportExporterNaive.java
class ExcelReportExporterNaive (line 1) | public class ExcelReportExporterNaive {
method export (line 2) | public void export(ReportData data, String filePath) {
FILE: design-patterns/java/templatemethod/PdfReportExporter.java
class PdfReportExporter (line 3) | public class PdfReportExporter extends AbstractReportExporter {
method writeHeader (line 7) | @Override
method writeDataRows (line 12) | @Override
FILE: design-patterns/java/templatemethod/PdfReportExporterNaive.java
class PdfReportExporterNaive (line 1) | class PdfReportExporterNaive {
method export (line 2) | public void export(ReportData data, String filePath) {
FILE: design-patterns/java/templatemethod/ReportAppNaive.java
class ReportAppNaive (line 1) | public class ReportAppNaive {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/templatemethod/ReportAppTemplateMethod.java
class ReportAppTemplateMethod (line 1) | public class ReportAppTemplateMethod {
method main (line 2) | public static void main(String[] args) {
FILE: design-patterns/java/templatemethod/ReportData.java
class ReportData (line 5) | public class ReportData {
method getHeaders (line 6) | public List<String> getHeaders() {
method getRows (line 9) | public List<Map<String, Object>> getRows() {
FILE: design-patterns/java/visitor/AreaCalculatorVisitor.java
class AreaCalculatorVisitor (line 1) | public class AreaCalculatorVisitor implements ShapeVisitor {
method visitCircle (line 2) | @Override
method visitRectangle (line 8) | @Override
FILE: design-patterns/java/visitor/Circle.java
class Circle (line 1) | public class Circle implements Shape {
method Circle (line 4) | public Circle(double radius) {
method getRadius (line 8) | public double getRadius() {
method accept (line 12) | @Override
FILE: design-patterns/java/visitor/Rectangle.java
class Rectangle (line 1) | public class Rectangle implements Shape {
method Rectangle (line 5) | public Rectangle(double width, double height) {
method getWidth (line 10) | public double getWidth() {
method getHeight (line 14) | public double getHeight() {
method accept (line 18) | @Override
FILE: design-patterns/java/visitor/Shape.java
type Shape (line 1) | public interface Shape {
method accept (line 2) | void accept(ShapeVisitor visitor);
FILE: design-patterns/java/visitor/ShapeVisitor.java
type ShapeVisitor (line 1) | public interface ShapeVisitor {
method visitCircle (line 2) | void visitCircle(Circle circle);
method visitRectangle (line 3) | void visitRectangle(Rectangle rectangle);
FILE: design-patterns/java/visitor/SvgExporterVisitor.java
class SvgExporterVisitor (line 1) | public class SvgExporterVisitor implements ShapeVisitor {
method visitCircle (line 2) | @Override
method visitRectangle (line 7) | @Override
FILE: design-patterns/java/visitor/VisitorPatternDemo.java
class VisitorPatternDemo (line 1) | public class VisitorPatternDemo {
method main (line 2) | public static void main(String[] args) {
FILE: oop/rust/abstraction/main.rs
type CoffeeMaker (line 11) | pub trait CoffeeMaker {
method brew (line 12) | fn brew(&mut self);
method add_water (line 13) | fn add_water(&mut self, amount: u32);
method add_water (line 62) | fn add_water(&mut self, amount: u32) {
method brew (line 69) | fn brew(&mut self) {
type PremiumCoffeeMachine (line 19) | pub struct PremiumCoffeeMachine {
method new (line 28) | pub fn new(water: u32, beans: u32) -> Self {
method grind_beans (line 37) | fn grind_beans(&mut self) -> bool {
method heat_water (line 48) | fn heat_water(&mut self) -> bool {
function main (line 81) | fn main() {
FILE: oop/rust/aggregation/main.rs
type Book (line 9) | struct Book {
method new (line 15) | fn new(title: &str, author: &str) -> Self {
method read (line 22) | fn read(&self) {
type Library (line 29) | struct Library<'a> {
function new (line 36) | fn new(name: &str) -> Self {
function add_book (line 44) | fn add_book(&mut self, book: &'a Book) {
function list_books (line 48) | fn list_books(&self) {
type Reader (line 59) | struct Reader {
function main (line 65) | fn main() {
FILE: oop/rust/association/main.rs
type Student (line 18) | struct Student {
type Teacher (line 22) | struct Teacher {
method new (line 29) | fn new(name: &str) -> Self {
method add_student (line 36) | fn add_student(&mut self, student: Rc<Student>) {
method show_students (line 40) | fn show_students(&self) {
type Library (line 55) | struct Library {
method new (line 68) | fn new(name: &str) -> Rc<Self> {
method add_book (line 75) | fn add_book(library: &Rc<Library>, title: &str) {
method show_books (line 86) | fn show_books(&self) {
type Book (line 60) | struct Book {
method show_library (line 95) | fn show_library(&self) {
function main (line 104) | fn main() {
FILE: oop/rust/classes_and_objects/main.rs
type Car (line 12) | pub struct Car {
method new (line 26) | pub fn new(color: String, make: String, model: String, year: u32) -> S...
method display_info (line 38) | pub fn display_info(&self) {
function main (line 50) | fn main() {
FILE: oop/rust/composition/main.rs
type Engine (line 10) | struct Engine {
method new (line 15) | fn new(horsepower: u32) -> Self {
method start (line 19) | fn start(&self) {
type Wheel (line 24) | struct Wheel {
method new (line 29) | fn new(wheel_type: &str) -> Self {
method rotate (line 35) | fn rotate(&self) {
type Transmission (line 40) | struct Transmission {
method new (line 45) | fn new(trans_type: &str) -> Self {
method shift (line 51) | fn shift(&self) {
type Car (line 58) | struct Car {
method new (line 67) | fn new(hp: u32, wheel_type: &str, trans_type: &str) -> Self {
method drive (line 75) | fn drive(&self) {
type PowerSource (line 87) | trait PowerSource {
method power_up (line 88) | fn power_up(&self);
method power_up (line 93) | fn power_up(&self) {
method power_up (line 100) | fn power_up(&self) {
type ElectricMotor (line 91) | struct ElectricMotor;
type DieselMotor (line 98) | struct DieselMotor;
type HybridVehicle (line 105) | struct HybridVehicle {
method new (line 111) | fn new(source: Box<dyn PowerSource>) -> Self {
method start (line 115) | fn start(&self) {
function main (line 120) | fn main() {
FILE: oop/rust/encapsulation/main.rs
type BankAccount (line 10) | pub struct BankAccount {
method new (line 16) | pub fn new(owner: &str, balance: f64) -> Self {
method balance (line 24) | pub fn balance(&self) -> f64 {
method deposit (line 29) | pub fn deposit(&mut self, amount: f64) {
type Employee (line 42) | pub struct Employee {
method new (line 48) | pub fn new(name: &str, age: u8) -> Self {
method name (line 56) | pub fn name(&self) -> &str {
method set_age (line 61) | pub fn set_age(&mut self, age: u8) {
method age (line 69) | pub fn age(&self) -> u8 {
type Processor (line 77) | pub struct Processor {
method new (line 83) | pub fn new(card_number: &str, amount: f64) -> Self {
method mask_card (line 92) | fn mask_card(real_no: &str) -> String {
method process (line 101) | pub fn process(&self) {
function main (line 107) | fn main() {
FILE: oop/rust/inheritance/main.rs
type Animal (line 12) | trait Animal {
method name (line 13) | fn name(&self) -> &String;
method eat (line 16) | fn eat(&self) {
method name (line 29) | fn name(&self) -> &String {
type Dog (line 22) | struct Dog {
method bark (line 35) | fn bark(&self) {
type Living (line 43) | trait Living {
method live (line 44) | fn live(&self) { println!("I am alive."); }
type Mammal (line 48) | trait Mammal: Living {
method walk (line 49) | fn walk(&self) { println!("I can walk."); }
type Cat (line 52) | struct Cat;
type SoundMaker (line 63) | trait SoundMaker {
method make_sound (line 64) | fn make_sound(&self) {
method make_sound (line 73) | fn make_sound(&self) {
type Cow (line 69) | struct Cow;
type BaseEntity (line 82) | struct BaseEntity {
method save (line 87) | fn save(&self) {
type User (line 93) | struct User {
method new (line 99) | fn new(id: u32, username: &str) -> Self {
method save_user (line 106) | fn save_user(&self) {
function main (line 113) | fn main() {
FILE: oop/rust/interfaces/main.rs
type Vehicle (line 9) | pub trait Vehicle {
method start (line 10) | fn start(&self);
method stop (line 11) | fn stop(&self);
method start (line 21) | fn start(&self) {
method stop (line 24) | fn stop(&self) {
type Car (line 15) | pub struct Car {
type Flyable (line 30) | trait Flyable {
method fly (line 31) | fn fly(&self);
method fly (line 41) | fn fly(&self) {
type Drivable (line 34) | trait Drivable {
method drive (line 35) | fn drive(&self);
method drive (line 47) | fn drive(&self) {
type FlyingCar (line 38) | struct FlyingCar;
type Animal (line 53) | trait Animal {
method sound (line 54) | fn sound(&self);
method sleep (line 57) | fn sleep(&self) {
method sound (line 65) | fn sound(&self) {
type Dog (line 62) | struct Dog;
type MathOperations (line 70) | trait MathOperations {
method add (line 72) | fn add(a: i32, b: i32) -> i32 {
type Calculator (line 77) | struct Calculator;
type Payment (line 81) | trait Payment {
method pay (line 82) | fn pay(&self, amount: f64);
method pay (line 87) | fn pay(&self, amount: f64) {
method pay (line 94) | fn pay(&self, amount: f64) {
type CreditCard (line 85) | struct CreditCard;
type PayPal (line 92) | struct PayPal;
function main (line 99) | fn main() {
FILE: oop/rust/polymorphism/main.rs
type Addable (line 10) | trait Addable {
method add (line 11) | fn add(&self, other: i32) -> i32;
method add (line 20) | fn add(&self, other: i32) -> i32 {
type Number (line 15) | struct Number {
function static_add (line 28) | fn static_add<T: Addable>(item: T, extra: i32) -> i32 {
type Animal (line 35) | trait Animal {
method make_sound (line 36) | fn make_sound(&self);
method make_sound (line 41) | fn make_sound(&self) {
method make_sound (line 48) | fn make_sound(&self) {
type Dog (line 39) | struct Dog;
type Cat (line 46) | struct Cat;
type Vehicle (line 56) | trait Vehicle {
method start (line 57) | fn start(&self);
method start (line 62) | fn start(&self) {
method start (line 69) | fn start(&self) {
type Car (line 60) | struct Car;
type Bike (line 67) | struct Bike;
type Payment (line 77) | trait Payment {
method pay (line 78) | fn pay(&self, amount: f64);
method pay (line 83) | fn pay(&self, amount: f64) {
method pay (line 90) | fn pay(&self, amount: f64) {
type CreditCardPayment (line 81) | struct CreditCardPayment;
type PayPalPayment (line 88) | struct PayPalPayment;
function process (line 96) | fn process(payment_method: &dyn Payment, amount: f64) {
function main (line 101) | fn main() {
FILE: solutions/cpp/airlinemanagementsystem/AirlineManagementSystem.cpp
function Flight (line 70) | Flight* AirlineManagementSystem::findFlight(std::string flightNumber) co...
function Passenger (line 77) | Passenger* AirlineManagementSystem::findPassenger(std::string passportNu...
function Booking (line 84) | Booking* AirlineManagementSystem::findBooking(std::string bookingId) con...
FILE: solutions/cpp/airlinemanagementsystem/AirlineManagementSystem.hpp
class AirlineManagementSystem (line 10) | class AirlineManagementSystem {
FILE: solutions/cpp/airlinemanagementsystem/AirlineManagementSystemDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/airlinemanagementsystem/Booking.cpp
function Flight (line 8) | Flight* Booking::getFlight() const { return flight; }
function Passenger (line 9) | Passenger* Booking::getPassenger() const { return passenger; }
FILE: solutions/cpp/airlinemanagementsystem/Booking.hpp
class Booking (line 8) | class Booking {
FILE: solutions/cpp/airlinemanagementsystem/Flight.hpp
class Flight (line 8) | class Flight {
FILE: solutions/cpp/airlinemanagementsystem/Passenger.hpp
class Passenger (line 6) | class Passenger {
FILE: solutions/cpp/airlinemanagementsystem/Seat.hpp
class Seat (line 4) | class Seat {
FILE: solutions/cpp/atm/ATM.hpp
class ATM (line 8) | class ATM {
FILE: solutions/cpp/atm/ATMDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/atm/Account.hpp
class Account (line 6) | class Account {
FILE: solutions/cpp/carrentalsystem/Car.hpp
class Car (line 6) | class Car {
FILE: solutions/cpp/carrentalsystem/CarRentalSystem.cpp
function Car (line 73) | Car* CarRentalSystem::findCar(std::string carId) const {
function Customer (line 80) | Customer* CarRentalSystem::findCustomer(std::string customerId) const {
function Rental (line 87) | Rental* CarRentalSystem::findRental(std::string rentalId) const {
FILE: solutions/cpp/carrentalsystem/CarRentalSystem.hpp
class CarRentalSystem (line 10) | class CarRentalSystem {
FILE: solutions/cpp/carrentalsystem/CarRentalSystemDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/carrentalsystem/Customer.hpp
class Customer (line 6) | class Customer {
FILE: solutions/cpp/carrentalsystem/Rental.cpp
function Car (line 13) | Car* Rental::getCar() const { return car; }
function Customer (line 14) | Customer* Rental::getCustomer() const { return customer; }
FILE: solutions/cpp/carrentalsystem/Rental.hpp
class Rental (line 8) | class Rental {
FILE: solutions/cpp/chessgame/Board.hpp
class Board (line 7) | class Board {
FILE: solutions/cpp/chessgame/ChessDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/chessgame/Game.cpp
function Color (line 40) | Color Game::getCurrentTurn() const {
FILE: solutions/cpp/chessgame/Game.hpp
class Game (line 6) | class Game {
FILE: solutions/cpp/chessgame/Piece.cpp
function PieceType (line 7) | PieceType Piece::getType() const { return type; }
function Color (line 8) | Color Piece::getColor() const { return color; }
function Position (line 9) | Position Piece::getPosition() const { return position; }
FILE: solutions/cpp/chessgame/Piece.hpp
type PieceType (line 7) | enum class PieceType {
type Color (line 11) | enum class Color {
class Piece (line 15) | class Piece {
method Piece (line 23) | Piece(PieceType type, Color color, Position position)
method PieceType (line 28) | PieceType getType() const { return type; }
method Color (line 29) | Color getColor() const { return color; }
method Position (line 30) | Position getPosition() const { return position; }
method isCaptured (line 31) | bool isCaptured() const { return captured; }
method setPosition (line 33) | void setPosition(Position newPosition) { position = newPosition; }
method setCaptured (line 34) | void setCaptured(bool status) { captured = status; }
method getSymbol (line 38) | std::string getSymbol() const {
FILE: solutions/cpp/chessgame/Position.hpp
class Position (line 4) | class Position {
FILE: solutions/cpp/chessgame/pieces/Bishop.hpp
class Bishop (line 6) | class Bishop : public Piece {
FILE: solutions/cpp/chessgame/pieces/King.hpp
class King (line 6) | class King : public Piece {
FILE: solutions/cpp/chessgame/pieces/Knight.hpp
class Knight (line 6) | class Knight : public Piece {
FILE: solutions/cpp/chessgame/pieces/Pawn.hpp
class Pawn (line 6) | class Pawn : public Piece {
FILE: solutions/cpp/chessgame/pieces/Queen.hpp
class Queen (line 6) | class Queen : public Piece {
FILE: solutions/cpp/chessgame/pieces/Rook.hpp
class Rook (line 6) | class Rook : public Piece {
FILE: solutions/cpp/coffeevendingmachine/Coffee.cpp
function CoffeeType (line 6) | CoffeeType Coffee::getType() const { return type; }
FILE: solutions/cpp/coffeevendingmachine/Coffee.hpp
class Coffee (line 7) | class Coffee {
FILE: solutions/cpp/coffeevendingmachine/CoffeeType.hpp
type CoffeeType (line 4) | enum class CoffeeType {
FILE: solutions/cpp/coffeevendingmachine/CoffeeVendingMachine.cpp
function Coffee (line 77) | Coffee* CoffeeVendingMachine::findCoffee(CoffeeType type) {
FILE: solutions/cpp/coffeevendingmachine/CoffeeVendingMachine.hpp
class CoffeeVendingMachine (line 8) | class CoffeeVendingMachine {
FILE: solutions/cpp/coffeevendingmachine/CoffeeVendingMachineDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/coffeevendingmachine/Inventory.hpp
class Inventory (line 7) | class Inventory {
FILE: solutions/cpp/concertticketbookingsystem/Booking.cpp
function Concert (line 12) | Concert* Booking::getConcert() const { return concert; }
FILE: solutions/cpp/concertticketbookingsystem/Booking.hpp
class Booking (line 7) | class Booking {
FILE: solutions/cpp/concertticketbookingsystem/BookingSystem.cpp
function Concert (line 71) | Concert* BookingSystem::findConcert(std::string concertId) const {
function Booking (line 78) | Booking* BookingSystem::findBooking(std::string bookingId) const {
FILE: solutions/cpp/concertticketbookingsystem/BookingSystem.hpp
class BookingSystem (line 9) | class BookingSystem {
FILE: solutions/cpp/concertticketbookingsystem/Concert.hpp
class Concert (line 8) | class Concert {
FILE: solutions/cpp/concertticketbookingsystem/ConcertBookingDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/concertticketbookingsystem/Seat.hpp
class Seat (line 4) | class Seat {
FILE: solutions/cpp/courseregistrationsystem/Course.hpp
class Course (line 8) | class Course {
FILE: solutions/cpp/courseregistrationsystem/RegistrationSystem.cpp
function Course (line 61) | Course* RegistrationSystem::findCourse(std::string courseId) const {
function Student (line 68) | Student* RegistrationSystem::findStudent(std::string studentId) const {
FILE: solutions/cpp/courseregistrationsystem/RegistrationSystem.hpp
class RegistrationSystem (line 9) | class RegistrationSystem {
FILE: solutions/cpp/courseregistrationsystem/RegistrationSystemDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/courseregistrationsystem/Student.hpp
class Course (line 7) | class Course
class Student (line 9) | class Student {
FILE: solutions/cpp/cricinfo/CricInfoDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/cricinfo/CricInfoSystem.cpp
function Team (line 19) | Team* CricInfoSystem::findTeam(const std::string& teamId) const {
function Match (line 26) | Match* CricInfoSystem::findMatch(const std::string& matchId) const {
FILE: solutions/cpp/cricinfo/CricInfoSystem.hpp
class CricInfoSystem (line 8) | class CricInfoSystem {
FILE: solutions/cpp/cricinfo/Match.cpp
function Team (line 10) | Team* Match::getTeam1() const { return team1; }
function Team (line 11) | Team* Match::getTeam2() const { return team2; }
function Team (line 15) | Team* Match::getWinner() const { return winner; }
FILE: solutions/cpp/cricinfo/Match.hpp
class Match (line 10) | class Match {
FILE: solutions/cpp/cricinfo/Player.cpp
function PlayerType (line 11) | PlayerType Player::getType() const { return type; }
function PlayerStats (line 12) | PlayerStats& Player::getStats() { return stats; }
FILE: solutions/cpp/cricinfo/Player.hpp
type PlayerType (line 7) | enum class PlayerType {
class Player (line 13) | class Player {
FILE: solutions/cpp/cricinfo/PlayerStats.hpp
type PlayerStats (line 4) | struct PlayerStats {
method PlayerStats (line 11) | PlayerStats()
FILE: solutions/cpp/cricinfo/Team.cpp
function Player (line 27) | Player* Team::findPlayer(const std::string& playerId) const {
FILE: solutions/cpp/cricinfo/Team.hpp
class Team (line 8) | class Team {
FILE: solutions/cpp/digitalwalletservice/Transaction.cpp
function TransactionType (line 13) | TransactionType Transaction::getType() const { return type; }
FILE: solutions/cpp/digitalwalletservice/Transaction.hpp
type TransactionType (line 6) | enum class TransactionType {
class Transaction (line 12) | class Transaction {
FILE: solutions/cpp/digitalwalletservice/User.hpp
class User (line 6) | class User {
FILE: solutions/cpp/digitalwalletservice/Wallet.hpp
class Wallet (line 8) | class Wallet {
FILE: solutions/cpp/digitalwalletservice/WalletDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/digitalwalletservice/WalletSystem.cpp
function Wallet (line 18) | Wallet* WalletSystem::createWallet(std::string userId) {
function User (line 139) | User* WalletSystem::findUser(const std::string& userId) const {
function Wallet (line 146) | Wallet* WalletSystem::findWallet(const std::string& walletId) const {
FILE: solutions/cpp/digitalwalletservice/WalletSystem.hpp
class WalletSystem (line 10) | class WalletSystem {
FILE: solutions/cpp/elevatorsystem/Elevator.cpp
function Direction (line 12) | Direction Elevator::getDirection() const { return direction; }
function Status (line 13) | Status Elevator::getStatus() const { return status; }
FILE: solutions/cpp/elevatorsystem/Elevator.hpp
type Direction (line 9) | enum class Direction {
type Status (line 15) | enum class Status {
class Elevator (line 21) | class Elevator {
FILE: solutions/cpp/elevatorsystem/ElevatorDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/elevatorsystem/ElevatorSystem.cpp
function Elevator (line 46) | Elevator* ElevatorSystem::findElevator(int elevatorId) const {
FILE: solutions/cpp/elevatorsystem/ElevatorSystem.hpp
class ElevatorSystem (line 7) | class ElevatorSystem {
FILE: solutions/cpp/elevatorsystem/Request.hpp
class Request (line 4) | class Request {
FILE: solutions/cpp/fooddeliveryservice/DeliveryDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/fooddeliveryservice/DeliveryService.cpp
function Order (line 20) | Order* DeliveryService::createOrder(std::string userId, std::string rest...
function User (line 82) | User* DeliveryService::findUser(const std::string& userId) const {
function Restaurant (line 89) | Restaurant* DeliveryService::findRestaurant(const std::string& restauran...
function Order (line 96) | Order* DeliveryService::findOrder(const std::string& orderId) const {
FILE: solutions/cpp/fooddeliveryservice/DeliveryService.hpp
class DeliveryService (line 10) | class DeliveryService {
FILE: solutions/cpp/fooddeliveryservice/MenuItem.hpp
class MenuItem (line 6) | class MenuItem {
FILE: solutions/cpp/fooddeliveryservice/Order.cpp
function User (line 14) | User* Order::getUser() const { return user; }
function Restaurant (line 15) | Restaurant* Order::getRestaurant() const { return restaurant; }
function OrderStatus (line 16) | OrderStatus Order::getStatus() const { return status; }
FILE: solutions/cpp/fooddeliveryservice/Order.hpp
type OrderStatus (line 11) | enum class OrderStatus {
class Order (line 19) | class Order {
FILE: solutions/cpp/fooddeliveryservice/Restaurant.cpp
function MenuItem (line 33) | MenuItem* Restaurant::findMenuItem(const std::string& itemId) const {
FILE: solutions/cpp/fooddeliveryservice/Restaurant.hpp
class Restaurant (line 8) | class Restaurant {
FILE: solutions/cpp/fooddeliveryservice/User.hpp
class User (line 6) | class User {
FILE: solutions/cpp/hotelmanagementsystem/Booking.cpp
function Guest (line 14) | Guest* Booking::getGuest() const { return guest; }
function Room (line 15) | Room* Booking::getRoom() const { return room; }
function BookingStatus (line 20) | BookingStatus Booking::getStatus() const { return status; }
FILE: solutions/cpp/hotelmanagementsystem/Booking.hpp
type BookingStatus (line 8) | enum class BookingStatus {
class Booking (line 15) | class Booking {
FILE: solutions/cpp/hotelmanagementsystem/Guest.hpp
class Guest (line 6) | class Guest {
FILE: solutions/cpp/hotelmanagementsystem/HotelDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/hotelmanagementsystem/HotelManager.cpp
function Booking (line 20) | Booking* HotelManager::createBooking(std::string guestId, std::string ro...
function Room (line 105) | Room* HotelManager::findRoom(const std::string& roomNumber) const {
function Guest (line 112) | Guest* HotelManager::findGuest(const std::string& guestId) const {
function Booking (line 119) | Booking* HotelManager::findBooking(const std::string& bookingId) const {
FILE: solutions/cpp/hotelmanagementsystem/HotelManager.hpp
class HotelManager (line 10) | class HotelManager {
FILE: solutions/cpp/hotelmanagementsystem/Room.cpp
function RoomType (line 10) | RoomType Room::getType() const { return type; }
function RoomStatus (line 11) | RoomStatus Room::getStatus() const { return status; }
FILE: solutions/cpp/hotelmanagementsystem/Room.hpp
type RoomType (line 6) | enum class RoomType {
type RoomStatus (line 12) | enum class RoomStatus {
class Room (line 18) | class Room {
FILE: solutions/cpp/librarymanagementsystem/Book.cpp
function BookStatus (line 14) | BookStatus Book::getStatus() const { return status; }
FILE: solutions/cpp/librarymanagementsystem/Book.hpp
type BookStatus (line 6) | enum class BookStatus {
class Book (line 13) | class Book {
FILE: solutions/cpp/librarymanagementsystem/LibraryDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/librarymanagementsystem/LibraryManager.cpp
function Book (line 156) | Book* LibraryManager::findBook(const std::string& bookId) const {
function Member (line 163) | Member* LibraryManager::findMember(const std::string& memberId) const {
function Transaction (line 170) | Transaction* LibraryManager::findTransaction(const std::string& bookId,
FILE: solutions/cpp/librarymanagementsystem/LibraryManager.hpp
class LibraryManager (line 10) | class LibraryManager {
FILE: solutions/cpp/librarymanagementsystem/Member.hpp
class Member (line 8) | class Member {
FILE: solutions/cpp/librarymanagementsystem/Transaction.cpp
function Book (line 11) | Book* Transaction::getBook() const { return book; }
function Member (line 12) | Member* Transaction::getMember() const { return member; }
function TransactionType (line 13) | TransactionType Transaction::getType() const { return type; }
FILE: solutions/cpp/librarymanagementsystem/Transaction.hpp
type TransactionType (line 8) | enum class TransactionType {
class Transaction (line 15) | class Transaction {
FILE: solutions/cpp/linkedin/LinkedInDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/linkedin/LinkedInManager.cpp
function Post (line 15) | Post* LinkedInManager::createPost(std::string userId, std::string content,
function User (line 116) | User* LinkedInManager::findUser(const std::string& userId) const {
function Post (line 123) | Post* LinkedInManager::findPost(const std::string& postId) const {
FILE: solutions/cpp/linkedin/LinkedInManager.hpp
class LinkedInManager (line 9) | class LinkedInManager {
FILE: solutions/cpp/linkedin/Post.cpp
function User (line 11) | User* Post::getAuthor() const { return author; }
function PostType (line 13) | PostType Post::getType() const { return type; }
FILE: solutions/cpp/linkedin/Post.hpp
type PostType (line 8) | enum class PostType {
class Post (line 15) | class Post {
FILE: solutions/cpp/linkedin/Profile.hpp
type Experience (line 7) | struct Experience {
type Education (line 15) | struct Education {
class Profile (line 23) | class Profile {
FILE: solutions/cpp/linkedin/User.cpp
function Profile (line 17) | Profile* User::getProfile() const { return profile; }
FILE: solutions/cpp/linkedin/User.hpp
class User (line 9) | class User {
FILE: solutions/cpp/loggingframework/ConsoleAppender.hpp
class ConsoleAppender (line 6) | class ConsoleAppender : public LogAppender {
FILE: solutions/cpp/loggingframework/FileAppender.hpp
class FileAppender (line 8) | class FileAppender : public LogAppender {
FILE: solutions/cpp/loggingframework/LogAppender.hpp
class LogAppender (line 6) | class LogAppender {
FILE: solutions/cpp/loggingframework/LogLevel.hpp
type LogLevel (line 4) | enum class LogLevel {
function logLevelToString (line 14) | inline std::string logLevelToString(LogLevel level) {
FILE: solutions/cpp/loggingframework/LogMessage.cpp
function LogLevel (line 16) | LogLevel LogMessage::getLevel() const { return level; }
FILE: solutions/cpp/loggingframework/LogMessage.hpp
class LogMessage (line 8) | class LogMessage {
FILE: solutions/cpp/loggingframework/Logger.hpp
class Logger (line 11) | class Logger {
FILE: solutions/cpp/loggingframework/LoggingDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/lrucache/DoublyLinkedList.hpp
type Node (line 5) | struct Node {
method Node (line 11) | Node(K key, V value) : key(key), value(value), prev(nullptr), next(nul...
class DoublyLinkedList (line 15) | class DoublyLinkedList {
method DoublyLinkedList (line 22) | DoublyLinkedList() : head(nullptr), tail(nullptr), size(0) {}
method moveToFront (line 46) | void moveToFront(Node<K,V>* node) {
method removeNode (line 63) | void removeNode(Node<K,V>* node) {
method getSize (line 98) | int getSize() const { return size; }
method isEmpty (line 99) | bool isEmpty() const { return size == 0; }
FILE: solutions/cpp/lrucache/LRUCache.hpp
class LRUCache (line 8) | class LRUCache {
method LRUCache (line 15) | LRUCache(int capacity) : capacity(capacity) {}
method V (line 17) | V get(K key) {
method put (line 28) | void put(K key, V value) {
method contains (line 50) | bool contains(K key) const {
method getSize (line 54) | int getSize() const {
method isEmpty (line 58) | bool isEmpty() const {
method clear (line 62) | void clear() {
method display (line 70) | void display() const {
FILE: solutions/cpp/lrucache/LRUCacheDemo.cpp
function main (line 5) | int main() {
FILE: solutions/cpp/movieticketbookingsystem/Booking.cpp
function Show (line 22) | Show* Booking::getShow() const { return show; }
function BookingStatus (line 27) | BookingStatus Booking::getStatus() const { return status; }
FILE: solutions/cpp/movieticketbookingsystem/Booking.hpp
type BookingStatus (line 8) | enum class BookingStatus {
class Booking (line 14) | class Booking {
FILE: solutions/cpp/movieticketbookingsystem/BookingDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/movieticketbookingsystem/BookingSystem.cpp
function Booking (line 21) | Booking* BookingSystem::createBooking(std::string showId, std::string cu...
function Show (line 103) | Show* BookingSystem::findShow(const std::string& showId) const {
function Booking (line 114) | Booking* BookingSystem::findBooking(const std::string& bookingId) const {
FILE: solutions/cpp/movieticketbookingsystem/BookingSystem.hpp
class BookingSystem (line 11) | class BookingSystem {
FILE: solutions/cpp/movieticketbookingsystem/Movie.cpp
function MovieGenre (line 13) | MovieGenre Movie::getGenre() const { return genre; }
FILE: solutions/cpp/movieticketbookingsystem/Movie.hpp
type MovieGenre (line 7) | enum class MovieGenre {
class Movie (line 16) | class Movie {
FILE: solutions/cpp/movieticketbookingsystem/Show.cpp
function Movie (line 12) | Movie* Show::getMovie() const { return movie; }
function ShowStatus (line 16) | ShowStatus Show::getStatus() const { return status; }
FILE: solutions/cpp/movieticketbookingsystem/Show.hpp
type ShowStatus (line 8) | enum class ShowStatus {
class Show (line 15) | class Show {
FILE: solutions/cpp/movieticketbookingsystem/Theater.hpp
class Theater (line 8) | class Theater {
FILE: solutions/cpp/musicstreamingservice/Artist.hpp
class Artist (line 8) | class Artist {
FILE: solutions/cpp/musicstreamingservice/MusicStreamingDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/musicstreamingservice/MusicStreamingService.cpp
function Playlist (line 29) | Playlist* MusicStreamingService::createPlaylist(std::string userId, std:...
function User (line 138) | User* MusicStreamingService::findUser(const std::string& userId) const {
function Artist (line 144) | Artist* MusicStreamingService::findArtist(const std::string& artistId) c...
function Song (line 150) | Song* MusicStreamingService::findSong(const std::string& songId) const {
function Playlist (line 156) | Playlist* MusicStreamingService::findPlaylist(const std::string& playlis...
FILE: solutions/cpp/musicstreamingservice/MusicStreamingService.hpp
class MusicStreamingService (line 11) | class MusicStreamingService {
FILE: solutions/cpp/musicstreamingservice/Playlist.hpp
class Playlist (line 8) | class Playlist {
FILE: solutions/cpp/musicstreamingservice/Song.cpp
function Genre (line 16) | Genre Song::getGenre() const { return genre; }
FILE: solutions/cpp/musicstreamingservice/Song.hpp
type Genre (line 7) | enum class Genre {
class Song (line 16) | class Song {
FILE: solutions/cpp/musicstreamingservice/User.cpp
function UserType (line 19) | UserType User::getType() const { return type; }
FILE: solutions/cpp/musicstreamingservice/User.hpp
type UserType (line 8) | enum class UserType {
class User (line 13) | class User {
FILE: solutions/cpp/onlineauctionsystem/Auction.cpp
function Item (line 11) | Item* Auction::getItem() const { return item; }
function AuctionStatus (line 15) | AuctionStatus Auction::getStatus() const { return status; }
FILE: solutions/cpp/onlineauctionsystem/Auction.hpp
type Bid (line 10) | struct Bid {
method Bid (line 15) | Bid(std::string bidderId, double amount)
type AuctionStatus (line 19) | enum class AuctionStatus {
class Auction (line 26) | class Auction {
FILE: solutions/cpp/onlineauctionsystem/AuctionSystem.cpp
function User (line 13) | User* AuctionSystem::registerUser(std::string username, std::string emai...
function Item (line 20) | Item* AuctionSystem::createItem(std::string sellerId, std::string name, ...
function Auction (line 32) | Auction* AuctionSystem::createAuction(std::string itemId, std::time_t st...
function User (line 135) | User* AuctionSystem::findUser(const std::string& userId) const {
function Item (line 141) | Item* AuctionSystem::findItem(const std::string& itemId) const {
function Auction (line 147) | Auction* AuctionSystem::findAuction(const std::string& auctionId) const {
FILE: solutions/cpp/onlineauctionsystem/AuctionSystem.hpp
class AuctionSystem (line 10) | class AuctionSystem {
FILE: solutions/cpp/onlineauctionsystem/AuctionSystemDemo.cpp
function main (line 5) | int main() {
FILE: solutions/cpp/onlineauctionsystem/Item.cpp
function ItemCategory (line 13) | ItemCategory Item::getCategory() const { return category; }
function ItemStatus (line 15) | ItemStatus Item::getStatus() const { return status; }
FILE: solutions/cpp/onlineauctionsystem/Item.hpp
type ItemCategory (line 6) | enum class ItemCategory {
type ItemStatus (line 16) | enum class ItemStatus {
class Item (line 23) | class Item {
FILE: solutions/cpp/onlineauctionsystem/User.hpp
class User (line 8) | class User {
FILE: solutions/cpp/onlineshoppingservice/Cart.cpp
function User (line 12) | User* Cart::getUser() const { return user; }
FILE: solutions/cpp/onlineshoppingservice/Cart.hpp
class Cart (line 8) | class Cart {
FILE: solutions/cpp/onlineshoppingservice/CartItem.cpp
function Product (line 8) | Product* CartItem::getProduct() const { return product; }
FILE: solutions/cpp/onlineshoppingservice/CartItem.hpp
class CartItem (line 6) | class CartItem {
FILE: solutions/cpp/onlineshoppingservice/Order.cpp
function User (line 25) | User* Order::getUser() const { return user; }
function OrderStatus (line 29) | OrderStatus Order::getStatus() const { return status; }
FILE: solutions/cpp/onlineshoppingservice/Order.hpp
type OrderStatus (line 9) | enum class OrderStatus {
class Order (line 17) | class Order {
FILE: solutions/cpp/onlineshoppingservice/Product.hpp
class Product (line 6) | class Product {
FILE: solutions/cpp/onlineshoppingservice/ShoppingDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/onlineshoppingservice/ShoppingSystem.cpp
function User (line 14) | User* ShoppingSystem::registerUser(const std::string& username, const st...
function Product (line 39) | Product* ShoppingSystem::addProduct(const std::string& name, const std::...
function Order (line 99) | Order* ShoppingSystem::placeOrder(const std::string& userId) {
function User (line 170) | User* ShoppingSystem::findUser(const std::string& userId) const {
function Product (line 176) | Product* ShoppingSystem::findProduct(const std::string& productId) const {
function Order (line 182) | Order* ShoppingSystem::findOrder(const std::string& orderId) const {
function Cart (line 188) | Cart* ShoppingSystem::getCart(const std::string& userId) {
FILE: solutions/cpp/onlineshoppingservice/ShoppingSystem.hpp
class ShoppingSystem (line 12) | class ShoppingSystem {
FILE: solutions/cpp/onlineshoppingservice/User.hpp
class User (line 8) | class User {
FILE: solutions/cpp/onlinestockbrokeragesystem/BrokerageDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/onlinestockbrokeragesystem/BrokerageSystem.cpp
function User (line 13) | User* BrokerageSystem::registerUser(const std::string& username, const s...
function Stock (line 30) | Stock* BrokerageSystem::addStock(const std::string& symbol, const std::s...
function Transaction (line 58) | Transaction* BrokerageSystem::buyStock(const std::string& userId, const ...
function Transaction (line 84) | Transaction* BrokerageSystem::sellStock(const std::string& userId, const...
function User (line 143) | User* BrokerageSystem::findUser(const std::string& userId) const {
function Stock (line 149) | Stock* BrokerageSystem::findStock(const std::string& symbol) const {
FILE: solutions/cpp/onlinestockbrokeragesystem/BrokerageSystem.hpp
class BrokerageSystem (line 11) | class BrokerageSystem {
FILE: solutions/cpp/onlinestockbrokeragesystem/Portfolio.hpp
class Portfolio (line 8) | class Portfolio {
FILE: solutions/cpp/onlinestockbrokeragesystem/Stock.hpp
class Stock (line 6) | class Stock {
FILE: solutions/cpp/onlinestockbrokeragesystem/Transaction.cpp
function User (line 14) | User* Transaction::getUser() const { return user; }
function Stock (line 15) | Stock* Transaction::getStock() const { return stock; }
function TransactionType (line 16) | TransactionType Transaction::getType() const { return type; }
FILE: solutions/cpp/onlinestockbrokeragesystem/Transaction.hpp
type TransactionType (line 9) | enum class TransactionType {
class Transaction (line 14) | class Transaction {
FILE: solutions/cpp/onlinestockbrokeragesystem/User.cpp
function Portfolio (line 18) | Portfolio* User::getPortfolio() const { return portfolio; }
FILE: solutions/cpp/onlinestockbrokeragesystem/User.hpp
class User (line 8) | class User {
FILE: solutions/cpp/parkinglot/ParkingLot.cpp
function Vehicle (line 53) | Vehicle* ParkingLot::removeVehicle(const std::string& licensePlate) {
function ParkingSpot (line 66) | ParkingSpot* ParkingLot::findVehicle(const std::string& licensePlate) co...
function ParkingSpot (line 85) | ParkingSpot* ParkingLot::findAvailableSpot(const Vehicle* vehicle) const {
FILE: solutions/cpp/parkinglot/ParkingLot.hpp
class ParkingLot (line 9) | class ParkingLot {
FILE: solutions/cpp/parkinglot/ParkingLotDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/parkinglot/ParkingSpot.cpp
function SpotType (line 8) | SpotType ParkingSpot::getType() const { return type; }
function Vehicle (line 9) | Vehicle* ParkingSpot::getVehicle() const { return vehicle; }
function Vehicle (line 37) | Vehicle* ParkingSpot::removeVehicle() {
FILE: solutions/cpp/parkinglot/ParkingSpot.hpp
type SpotType (line 6) | enum class SpotType {
class ParkingSpot (line 12) | class ParkingSpot {
FILE: solutions/cpp/parkinglot/Vehicle.cpp
function VehicleType (line 8) | VehicleType Vehicle::getType() const { return type; }
FILE: solutions/cpp/parkinglot/Vehicle.hpp
type VehicleType (line 6) | enum class VehicleType {
class Vehicle (line 13) | class Vehicle {
FILE: solutions/cpp/pubsubsystem/Message.hpp
class Message (line 7) | class Message {
FILE: solutions/cpp/pubsubsystem/PubSubDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/pubsubsystem/PubSubSystem.cpp
function Topic (line 12) | Topic* PubSubSystem::createTopic(const std::string& name, const std::str...
function Subscriber (line 30) | Subscriber* PubSubSystem::addSubscriber(const std::string& name) {
function Topic (line 102) | Topic* PubSubSystem::findTopic(const std::string& topicName) const {
function Subscriber (line 108) | Subscriber* PubSubSystem::findSubscriber(const std::string& subscriberId...
FILE: solutions/cpp/pubsubsystem/PubSubSystem.hpp
class PubSubSystem (line 9) | class PubSubSystem {
FILE: solutions/cpp/pubsubsystem/Subscriber.hpp
class Subscriber (line 8) | class Subscriber {
FILE: solutions/cpp/pubsubsystem/Topic.hpp
class Topic (line 8) | class Topic {
FILE: solutions/cpp/restaurantmanagementsystem/MenuItem.cpp
function Category (line 14) | Category MenuItem::getCategory() const { return category; }
FILE: solutions/cpp/restaurantmanagementsystem/MenuItem.hpp
type Category (line 6) | enum class Category {
class MenuItem (line 13) | class MenuItem {
FILE: solutions/cpp/restaurantmanagementsystem/Order.cpp
function Table (line 18) | Table* Order::getTable() const { return table; }
function OrderStatus (line 22) | OrderStatus Order::getStatus() const { return status; }
FILE: solutions/cpp/restaurantmanagementsystem/Order.hpp
type OrderStatus (line 10) | enum class OrderStatus {
class Order (line 18) | class Order {
FILE: solutions/cpp/restaurantmanagementsystem/OrderItem.cpp
function MenuItem (line 10) | MenuItem* OrderItem::getMenuItem() const { return menuItem; }
FILE: solutions/cpp/restaurantmanagementsystem/OrderItem.hpp
class OrderItem (line 6) | class OrderItem {
FILE: solutions/cpp/restaurantmanagementsystem/RestaurantDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/restaurantmanagementsystem/RestaurantSystem.cpp
function MenuItem (line 13) | MenuItem* RestaurantSystem::addMenuItem(const std::string& name, const s...
function Table (line 37) | Table* RestaurantSystem::addTable(int capacity) {
function Order (line 50) | Order* RestaurantSystem::createOrder(int tableNumber) {
function MenuItem (line 119) | MenuItem* RestaurantSystem::findMenuItem(const std::string& itemId) const {
function Table (line 125) | Table* RestaurantSystem::findTable(int tableNumber) const {
function Order (line 131) | Order* RestaurantSystem::findOrder(const std::string& orderId) const {
FILE: solutions/cpp/restaurantmanagementsystem/RestaurantSystem.hpp
class RestaurantSystem (line 10) | class RestaurantSystem {
FILE: solutions/cpp/restaurantmanagementsystem/Table.cpp
function TableStatus (line 9) | TableStatus Table::getStatus() const { return status; }
FILE: solutions/cpp/restaurantmanagementsystem/Table.hpp
type TableStatus (line 4) | enum class TableStatus {
class Table (line 10) | class Table {
FILE: solutions/cpp/ridesharingservice/Location.hpp
class Location (line 6) | class Location {
FILE: solutions/cpp/ridesharingservice/Ride.cpp
function User (line 19) | User* Ride::getRider() const { return rider; }
function User (line 20) | User* Ride::getDriver() const { return driver; }
function Location (line 21) | Location* Ride::getPickup() const { return pickup; }
function Location (line 22) | Location* Ride::getDropoff() const { return dropoff; }
function RideStatus (line 27) | RideStatus Ride::getStatus() const { return status; }
FILE: solutions/cpp/ridesharingservice/Ride.hpp
type RideStatus (line 9) | enum class RideStatus {
class Ride (line 17) | class Ride {
FILE: solutions/cpp/ridesharingservice/RideDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/ridesharingservice/RideService.cpp
function User (line 12) | User* RideService::registerUser(const std::string& name, const std::stri...
function Ride (line 30) | Ride* RideService::requestRide(const std::string& riderId, Location* pic...
function User (line 98) | User* RideService::findUser(const std::string& userId) const {
function Ride (line 104) | Ride* RideService::findRide(const std::string& rideId) const {
function User (line 110) | User* RideService::findNearestDriver(const Location& pickup) const {
FILE: solutions/cpp/ridesharingservice/RideService.hpp
class RideService (line 9) | class RideService {
FILE: solutions/cpp/ridesharingservice/User.cpp
function UserType (line 17) | UserType User::getType() const { return type; }
function Location (line 18) | Location* User::getCurrentLocation() const { return currentLocation; }
FILE: solutions/cpp/ridesharingservice/User.hpp
type UserType (line 7) | enum class UserType {
class User (line 12) | class User {
FILE: solutions/cpp/snakeandladdergame/Board.hpp
class Board (line 6) | class Board {
FILE: solutions/cpp/snakeandladdergame/Dice.hpp
class Dice (line 4) | class Dice {
FILE: solutions/cpp/snakeandladdergame/Game.cpp
function Player (line 104) | Player* Game::getCurrentPlayer() const {
FILE: solutions/cpp/snakeandladdergame/Game.hpp
class Game (line 9) | class Game {
FILE: solutions/cpp/snakeandladdergame/GameDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/snakeandladdergame/Player.hpp
class Player (line 6) | class Player {
FILE: solutions/cpp/socialnetworkingservice/Post.hpp
class Post (line 8) | class Post {
FILE: solutions/cpp/socialnetworkingservice/SocialNetwork.cpp
function User (line 12) | User* SocialNetwork::registerUser(const std::string& username, const std...
function Post (line 63) | Post* SocialNetwork::createPost(const std::string& userId, const std::st...
function User (line 148) | User* SocialNetwork::findUser(const std::string& userId) const {
function Post (line 154) | Post* SocialNetwork::findPost(const std::string& postId) const {
FILE: solutions/cpp/socialnetworkingservice/SocialNetwork.hpp
class SocialNetwork (line 9) | class SocialNetwork {
FILE: solutions/cpp/socialnetworkingservice/SocialNetworkDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/socialnetworkingservice/User.hpp
class User (line 8) | class User {
FILE: solutions/cpp/splitwise/Expense.cpp
function ExpenseType (line 22) | ExpenseType Expense::getType() const { return type; }
FILE: solutions/cpp/splitwise/Expense.hpp
type ExpenseType (line 9) | enum class ExpenseType {
class Expense (line 15) | class Expense {
FILE: solutions/cpp/splitwise/SplitwiseDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/splitwise/SplitwiseSystem.cpp
function User (line 13) | User* SplitwiseSystem::registerUser(const std::string& name, const std::...
function Expense (line 30) | Expense* SplitwiseSystem::addExpense(const std::string& description, dou...
function User (line 130) | User* SplitwiseSystem::findUser(const std::string& userId) const {
function Expense (line 136) | Expense* SplitwiseSystem::findExpense(const std::string& expenseId) const {
FILE: solutions/cpp/splitwise/SplitwiseSystem.hpp
class SplitwiseSystem (line 9) | class SplitwiseSystem {
FILE: solutions/cpp/splitwise/User.hpp
class User (line 7) | class User {
FILE: solutions/cpp/stackoverflow/Comment.hpp
class Comment (line 7) | class Comment {
FILE: solutions/cpp/stackoverflow/Post.cpp
function PostType (line 25) | PostType Post::getType() const { return type; }
FILE: solutions/cpp/stackoverflow/Post.hpp
type PostType (line 9) | enum class PostType {
class Post (line 14) | class Post {
FILE: solutions/cpp/stackoverflow/StackOverflow.cpp
function User (line 12) | User* StackOverflow::registerUser(const std::string& username, const std...
function Post (line 29) | Post* StackOverflow::addQuestion(const std::string& userId, const std::s...
function Post (line 39) | Post* StackOverflow::addAnswer(const std::string& userId, const std::str...
function Comment (line 52) | Comment* StackOverflow::addComment(const std::string& userId, const std:...
function User (line 149) | User* StackOverflow::findUser(const std::string& userId) const {
function Post (line 155) | Post* StackOverflow::findPost(const std::string& postId) const {
FILE: solutions/cpp/stackoverflow/StackOverflow.hpp
class StackOverflow (line 10) | class StackOverflow {
FILE: solutions/cpp/stackoverflow/StackOverflowDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/stackoverflow/User.hpp
class User (line 7) | class User {
FILE: solutions/cpp/taskmanagementsystem/Task.cpp
function TaskStatus (line 17) | TaskStatus Task::getStatus() const { return status; }
function TaskPriority (line 18) | TaskPriority Task::getPriority() const { return priority; }
FILE: solutions/cpp/taskmanagementsystem/Task.hpp
type TaskStatus (line 8) | enum class TaskStatus {
type TaskPriority (line 15) | enum class TaskPriority {
class Task (line 22) | class Task {
FILE: solutions/cpp/taskmanagementsystem/TaskManager.cpp
function User (line 12) | User* TaskManager::registerUser(const std::string& username, const std::...
function Task (line 35) | Task* TaskManager::createTask(const std::string& title, const std::strin...
function User (line 156) | User* TaskManager::findUser(const std::string& userId) const {
function Task (line 162) | Task* TaskManager::findTask(const std::string& taskId) const {
FILE: solutions/cpp/taskmanagementsystem/TaskManager.hpp
class TaskManager (line 9) | class TaskManager {
FILE: solutions/cpp/taskmanagementsystem/TaskManagerDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/taskmanagementsystem/User.hpp
class User (line 7) | class User {
FILE: solutions/cpp/tictactoe/Board.hpp
class Board (line 7) | class Board {
FILE: solutions/cpp/tictactoe/Game.cpp
function Player (line 92) | Player* Game::getCurrentPlayer() const {
FILE: solutions/cpp/tictactoe/Game.hpp
class Game (line 7) | class Game {
FILE: solutions/cpp/tictactoe/Player.hpp
class Player (line 6) | class Player {
FILE: solutions/cpp/tictactoe/TicTacToeDemo.cpp
function main (line 4) | int main() {
FILE: solutions/cpp/trafficsignalsystem/Intersection.cpp
function Signal (line 61) | Signal* Intersection::findSignal(const std::string& signalId) const {
FILE: solutions/cpp/trafficsignalsystem/Intersection.hpp
class Intersection (line 8) | class Intersection {
FILE: solutions/cpp/trafficsignalsystem/Signal.cpp
function SignalColor (line 12) | SignalColor Signal::getCurrentColor() const { return currentColor; }
FILE: solutions/cpp/trafficsignalsystem/Signal.hpp
type SignalColor (line 6) | enum class SignalColor {
class Signal (line 12) | class Signal {
FILE: solutions/cpp/trafficsignalsystem/TrafficSystem.cpp
function Intersection (line 13) | Intersection* TrafficSystem::createIntersection() {
function Signal (line 32) | Signal* TrafficSystem::addSignal(const std::string& intersectionId,
function Intersection (line 75) | Intersection* TrafficSystem::findIntersection(const std::string& interse...
FILE: solutions/cpp/trafficsignalsystem/TrafficSystem.hpp
class TrafficSystem (line 8) | class TrafficSystem {
FILE: solutions/cpp/trafficsignalsystem/TrafficSystemDemo.cpp
function main (line 6) | int main() {
FILE: solutions/cpp/vendingmachine/Product.hpp
class Product (line 6) | class Product {
FILE: solutions/cpp/vendingmachine/Transaction.hpp
class Transaction (line 7) | class Transaction {
FILE: solutions/cpp/vendingmachine/VendingMachine.cpp
function Product (line 19) | Product* VendingMachine::addProduct(const std::string& name, double pric...
function Transaction (line 52) | Transaction* VendingMachine::purchaseProduct(const std::string& productI...
function Product (line 116) | Product* VendingMachine::findProduct(const std::string& productId) const {
FILE: solutions/cpp/vendingmachine/VendingMachine.hpp
class VendingMachine (line 9) | class VendingMachine {
FILE: solutions/cpp/vendingmachine/VendingMachineDemo.cpp
function main (line 4) | int main() {
FILE: solutions/csharp/LLDRunner.cs
class Program (line 37) | class Program
method Main (line 39) | static void Main(string[] args)
FILE: solutions/csharp/airlinemanagementsystem/Aircraft.cs
class Aircraft (line 3) | public class Aircraft
method Aircraft (line 9) | public Aircraft(string tailNumber, string model, int totalSeats)
FILE: solutions/csharp/airlinemanagementsystem/AirlineManagementSystem.cs
class AirlineManagementSystem (line 7) | public class AirlineManagementSystem
method AirlineManagementSystem (line 15) | public AirlineManagementSystem()
method AddFlight (line 24) | public void AddFlight(Flight flight)
method AddAircraft (line 29) | public void AddAircraft(Aircraft aircraft)
method SearchFlights (line 34) | public List<Flight> SearchFlights(string source, string destination, D...
method BookFlight (line 39) | public Booking BookFlight(Flight flight, Passenger passenger, Seat sea...
method CancelBooking (line 44) | public void CancelBooking(string bookingNumber)
method ProcessPayment (line 49) | public void ProcessPayment(Payment payment)
FILE: solutions/csharp/airlinemanagementsystem/AirlineManagementSystemDemo.cs
class AirlineManagementSystemDemo (line 6) | public class AirlineManagementSystemDemo
method Run (line 8) | public static void Run()
FILE: solutions/csharp/airlinemanagementsystem/Booking.cs
class Booking (line 5) | public class Booking
method Booking (line 14) | public Booking(string bookingNumber, Flight flight, Passenger passenge...
method Cancel (line 24) | public void Cancel()
FILE: solutions/csharp/airlinemanagementsystem/BookingManager.cs
class BookingManager (line 8) | public class BookingManager
method BookingManager (line 15) | private BookingManager() { }
method CreateBooking (line 29) | public Booking CreateBooking(Flight flight, Passenger passenger, Seat ...
method CancelBooking (line 40) | public void CancelBooking(string bookingNumber)
method GenerateBookingNumber (line 51) | private string GenerateBookingNumber()
FILE: solutions/csharp/airlinemanagementsystem/BookingStatus.cs
type BookingStatus (line 3) | public enum BookingStatus
FILE: solutions/csharp/airlinemanagementsystem/Flight.cs
class Flight (line 6) | public class Flight
method Flight (line 15) | public Flight(string flightNumber, string source, string destination, ...
FILE: solutions/csharp/airlinemanagementsystem/FlightSearch.cs
class FlightSearch (line 7) | public class FlightSearch
method FlightSearch (line 11) | public FlightSearch(List<Flight> flights)
method SearchFlights (line 16) | public List<Flight> SearchFlights(string source, string destination, D...
FILE: solutions/csharp/airlinemanagementsystem/Passenger.cs
class Passenger (line 3) | public class Passenger
method Passenger (line 10) | public Passenger(string id, string name, string email, string phone)
FILE: solutions/csharp/airlinemanagementsystem/Payment.cs
class Payment (line 3) | public class Payment
method Payment (line 10) | public Payment(string paymentId, string paymentMethod, double amount)
method ProcessPayment (line 18) | public void ProcessPayment()
FILE: solutions/csharp/airlinemanagementsystem/PaymentProcessor.cs
class PaymentProcessor (line 3) | public class PaymentProcessor
method PaymentProcessor (line 7) | private PaymentProcessor() { }
method ProcessPayment (line 21) | public void ProcessPayment(Payment payment)
FILE: solutions/csharp/airlinemanagementsystem/PaymentStatus.cs
type PaymentStatus (line 3) | public enum PaymentStatus
FILE: solutions/csharp/airlinemanagementsystem/Seat.cs
class Seat (line 3) | public class Seat
method Seat (line 9) | public Seat(string seatNumber, SeatType type)
method Reserve (line 16) | public void Re
Condensed preview — 2758 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,295K chars).
[
{
"path": ".gitignore",
"chars": 124,
"preview": ".idea/\n\n.vscode/\n\nsolutions/java/.idea/\nsolutions/java/out/\n\nsolutions/c++/.idea/\n\nsolutions/c#/bin/\nsolutions/c#/obj/\n\n"
},
{
"path": "LICENSE",
"chars": 35149,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "README.md",
"chars": 11448,
"preview": "<p align=\"center\">\n <img src=\"images/lld-repo-logo.png\" width=\"350\" height=\"200\">\n</p>\n<p align=\"center\">\n <a href=\"ht"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Chain of Responsibilites/main.js",
"chars": 796,
"preview": "const {\n InternetConnectionTeam,\n InternetSupportTeam,\n PhoneConnectionTeam,\n PhoneSupportTeam,\n} = require(\"./suppo"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Chain of Responsibilites/supportRequest.js",
"chars": 2848,
"preview": "// Creating a chain for attaining support team\n\nclass supportHandler {\n constructor(nextHandler) {\n this.nextHandler"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/command.js",
"chars": 828,
"preview": "// Abstract Command\nclass Command {\n execute() {}\n}\n\n// Concrete Command\nclass LightOnCommand extends Command {\n const"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/invoker.js",
"chars": 202,
"preview": "// Invoker class\nclass RemoteControl {\n setCommand(command) {\n this.command = command;\n }\n \n pressButton("
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/main.js",
"chars": 878,
"preview": "// Client code\n\nconst {\n LightOnCommand,\n LightOffCommand,\n FanOnCommand,\n FanOffCommand,\n} = require(\"./command\");\n"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Command Design Pattern/receiver.js",
"chars": 325,
"preview": "// Receiver for Light\nclass Light {\n turnOn() {\n console.log(\"The light is on.\");\n }\n\n turnOff() {\n console.log"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/aggregate.js",
"chars": 460,
"preview": "const { LibraryIterator } = require(\"./iterator\");\nconst Book = require(\"./book\");\n\nclass Aggregate {\n createIterator()"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/book.js",
"chars": 192,
"preview": "class Book {\n constructor(title, author) {\n this.title = title;\n this.author = author;\n }\n\n getDetails() {\n "
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/iterator.js",
"chars": 566,
"preview": "class Iterator {\n next() {\n throw new Error(\"Method 'next()' must be implemented.\");\n }\n\n hasNext() {\n throw ne"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Iterator Design Pattern/main.js",
"chars": 630,
"preview": "const ConcreteAggregate = require(\"./aggregate\");\nconst Book = require(\"./book\");\n\nconst library = new ConcreteAggregate"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/main.js",
"chars": 572,
"preview": "// Client code to handle users registration and messages communication\n\nconst User = require(\"./user\");\nconst ChatRoom ="
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/mediator.js",
"chars": 603,
"preview": "// Abstract Mediator\nclass Mediator {\n register(user) {\n throw new Error(\"Method 'register()' must be implemented\");"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Mediator Design Pattern/user.js",
"chars": 327,
"preview": "class User {\n constructor(name, mediator) {\n this.name = name;\n this.mediator = mediator;\n }\n\n send(message) {\n"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/canvas.js",
"chars": 899,
"preview": "// Import CanvasMemento from memento.js\nconst CanvasMemento = require(\"./memento\"); // <-- Add this line\n\nclass DrawingC"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/careTaker.js",
"chars": 622,
"preview": "// CareTaker -> Manages mementos\n\nclass History {\n constructor() {\n this.mementos = []; // List of saved mementos\n "
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/main.js",
"chars": 1584,
"preview": "const DrawingCanvas = require('./canvas');\nconst CanvasMemento = require('./memento');\nconst History = require('./careTa"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/Example2/memento.js",
"chars": 264,
"preview": "// Memento -> Stores the snapshot of canvas state\nclass CanvasMemento {\n constructor(state) {\n this.state = state; /"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/careTaker.js",
"chars": 235,
"preview": "// careTaker.js\n\nclass CareTaker {\n constructor() {\n this.mementos = [];\n }\n\n saveMemento(memento) {\n this.meme"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/main.js",
"chars": 874,
"preview": "const TextEditor = require(\"./orginator\");\nconst Caretaker = require(\"./careTaker\");\n\n// Create a TextEditor instance\nco"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/memento.js",
"chars": 150,
"preview": "// Memento\nclass Memento {\n constructor(state) {\n this.state = state;\n }\n\n getState() {\n return this.state;\n }"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Memento Design Pattern/orginator.js",
"chars": 373,
"preview": "// Orginator file\n\nconst Memento = require(\"./memento\");\n\nclass TextEditor {\n constructor() {\n this.content = \"\";\n "
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/main.js",
"chars": 782,
"preview": "const { WebUI, MobileUI } = require(\"./observer\");\nconst WeatherStation = require(\"./publisher\");\n\n// Create a WeatherSt"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/observer.js",
"chars": 415,
"preview": "class Observer {\n update(temperature) {\n throw new Error(\"Method 'update()' must be implemented\");\n }\n}\n\nclass WebU"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Observer Design Pattern/publisher.js",
"chars": 649,
"preview": "class WeatherStation {\n constructor() {\n this.observers = [];\n this.temperature = 0;\n }\n\n //Method to add Subsc"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/State Design Pattern/context.js",
"chars": 340,
"preview": "const {Idle} = require(\"./state\");\n\n// Context Class\nclass Phone {\n constructor() {\n this.state = new Idle(); // Ini"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/State Design Pattern/main.js",
"chars": 462,
"preview": "const Phone = require(\"./context\");\n\nconst {Ringing} = require(\"./state\");\n\nconst phone = new Phone();\n\nphone.alert(); /"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/State Design Pattern/state.js",
"chars": 1035,
"preview": "// Abstract class for phoneState\nclass PhoneState {\n alert() {}\n answer() {}\n hangup() {}\n}\n\n// Concerte Class for ph"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/main.js",
"chars": 778,
"preview": "const ShoppinCart = require(\"./shoppingCart_Context\");\nconst { Cash, UPI, Card, InternetBanking } = require(\"./paymentSt"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/paymentStrategy.js",
"chars": 1342,
"preview": "// Strategy class\n\n// Abstract class\n\nclass PaymentGateway {\n pay(amount) {\n throw new Error(\"Method 'pay()' must be"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Strategy Design Pattern/shoppingCart_Context.js",
"chars": 1001,
"preview": "// Context file as shoppingCart class\n\nclass ShoppinCart {\n constructor() {\n this.items = [];\n this.paymentMethod"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beverages.js",
"chars": 820,
"preview": "// Abstract class in Template Pattern\nclass Food {\n prepareFood() {\n this.boilWater();\n this.brew();\n this.pou"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/beveragesTypes.js",
"chars": 648,
"preview": "// Concrete classes for Food\n// Make using of superClasses from templatePattern and modifying here (subClasses)\n\nconst F"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Template Design Pattern/main.js",
"chars": 267,
"preview": "const { Tea, Coffee } = require(\"./beveragesTypes\");\n\n// Meal 1\nconsole.log(\"Preparing Tea..\");\nconst tea = new Tea();\nt"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/element.js",
"chars": 496,
"preview": "// element.js\nclass Shape {\n accept(visitor) {\n throw new Error(\"This method should be overridden!\");\n }\n}\n\nclass C"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/main.js",
"chars": 537,
"preview": "const { Circle, Rectangle } = require(\"./element\");\nconst { AreaVisitor, PerimeterVisitor } = require(\"./visitor\");\n\n\nco"
},
{
"path": "design-patterns/Javascript/Behavioral Pattern/Visitor Design Pattern/visitor.js",
"chars": 969,
"preview": "// Visitor Interface\nclass ShapeVisitor {\n visitCircle(circle) {\n throw new Error(`This circle method should be over"
},
{
"path": "design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/abstract.js",
"chars": 1260,
"preview": "// Abstract product\nclass Chair {\n sitOn() {\n throw new error(\"Sitting on chair\");\n }\n}\n\nclass Sofa {\n lieOn() {\n "
},
{
"path": "design-patterns/Javascript/Creational Pattern/AbstractFactory Design Pattern/main.js",
"chars": 485,
"preview": "const {\n ModernFurnitureFactory,\n ClassicFurnitureFactory,\n} = require(\"./abstract\");\n\nfunction createFurniture(factor"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Builder Design Pattern/app.js",
"chars": 218,
"preview": "const ComputerBuilder = require(\"./computerBuilder\");\n\nconst myComputer = new ComputerBuilder(\"Intel\", \"4GB\")\n .addStor"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Builder Design Pattern/computerBuilder.js",
"chars": 579,
"preview": "class Computer {\n constructor(builder) {\n this.cpu = builder.cpu;\n this.ram = builder.ram;\n this.hardDisk = bu"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Factory Design Pattern/factory.js",
"chars": 363,
"preview": "const { cheesePizza, pepperoniPizza } = require(\"./pizza\");\n\nclass pizzaFactory {\n static createPizza(pizzaType) {\n "
},
{
"path": "design-patterns/Javascript/Creational Pattern/Factory Design Pattern/main.js",
"chars": 314,
"preview": "const pizzaFactory = require(\"./factory\");\n\nfunction main() {\n const pizzaType = process.argv[2] || \"cheese\";\n try {\n "
},
{
"path": "design-patterns/Javascript/Creational Pattern/Factory Design Pattern/pizza.js",
"chars": 515,
"preview": "class Pizza {\n prepare() {\n throw new error('Method \"prepare()\" must be implemented');\n }\n bake() {\n console.lo"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Prototype Design Pattern/app.js",
"chars": 744,
"preview": "class Car{\n constructor(model, year, color){\n this.model = model;\n this.year = year;\n this.color"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Singleton Design Pattern/app.js",
"chars": 286,
"preview": "\n// Importing\nconst singleton = require(\"./singleton\");\nconst Singleton1 = require(\"./singleton\");\nconst Singleton2 = re"
},
{
"path": "design-patterns/Javascript/Creational Pattern/Singleton Design Pattern/singleton.js",
"chars": 433,
"preview": "//Variable to hold the instance\nlet instance = null;\n\nclass Singleton {\n constructor() {\n if (instance) {\n //ch"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/adapter.js",
"chars": 312,
"preview": "// usbAdapter.js\n\n// No need to import USB_A_Connector here\n\nclass USB_Adapter {\n constructor(connector) {\n this.con"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/main.js",
"chars": 256,
"preview": "const USB_A_Connector = require(\"./usbA_connector\");\nconst Adapter = require(\"./adapter\");\n\n// Creating instances for im"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbA_connector.js",
"chars": 155,
"preview": "// USB A plug class\n\n// Old system\n\nclass USB_A_Connector {\n connect() {\n return \"USB-A connector connected\";\n }\n}\n"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Adapter Design Pattern/usbC_device.js",
"chars": 164,
"preview": "// Device class to connect USB A cable\n\n// New system\n\nclass USB_C_Device {\n plugIn() {\n return \"USB C device connec"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/device.js",
"chars": 621,
"preview": "// Device.js\n\n// The Device interface\nclass Device {\n turnOn() {\n throw new Error(\"Method 'turnOn()' must be impleme"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/main.js",
"chars": 445,
"preview": "// main.js\nconst { TV, Radio } = require(\"./device\");\nconst RemoteControl = require(\"./remoteControl\");\n\n// Creating ins"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Bridge Design Pattern/remoteControl.js",
"chars": 361,
"preview": "// RemoteControl.js\n\nclass RemoteControl {\n constructor(device) {\n this.device = device; // This is the bridge t"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Composite Design Pattern/app.js",
"chars": 1141,
"preview": "const File = require(\"./file\");\nconst Folder = require(\"./folder\");\n\n// Let's create some files with random file extensi"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Composite Design Pattern/component.js",
"chars": 173,
"preview": "// Abstract Class or Component class\n\nclass Component {\n showDetails() {\n throw new error(\"This method is overriden"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Composite Design Pattern/file.js",
"chars": 222,
"preview": "const Component = require(\"./component\");\n\nclass File extends Component {\n constructor(name) {\n super();\n this.na"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Composite Design Pattern/folder.js",
"chars": 409,
"preview": "const Component = require(\"./component\");\n\n// Composite: Folder that can hold files or other folders\n\nclass Folder exten"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/additional.js",
"chars": 626,
"preview": "// Additional behavior class\n\nclass Cream {\n constructor(coffee) {\n this.coffee = coffee;\n }\n\n cost() {\n return"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/coffee.js",
"chars": 128,
"preview": "// Base class component\n\nclass Coffee {\n cost() {\n return 10; // Base price of coffee is 10\n }\n}\n\nmodule.exports = "
},
{
"path": "design-patterns/Javascript/Structural Pattern/Decorator Design Pattern/main.js",
"chars": 531,
"preview": "const Coffee = require(\"./coffee\");\nconst {Cream, Sugar, Ice} = require(\"./additional\");\n\n// Create an instance of coffe"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/dvdPlayer.js",
"chars": 248,
"preview": "// Class for DVD player functionality\n\nclass DVDPlayer {\n on() {\n console.log(\"DVD player is on\");\n }\n play(movie)"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/lights.js",
"chars": 214,
"preview": "// Class for lights functionality\n\nclass Lights {\n on() {\n console.log(\"Lights on, take you're seat!\");\n }\n\n off()"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/main.js",
"chars": 320,
"preview": "// client code for facade design pattern\n\nconst MovieFacade = require(\"./movieFacade\");\n\nconst movieFacade = new MovieFa"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/movieFacade.js",
"chars": 1126,
"preview": "const SoundSystem = require(\"./soundSystem\");\nconst DVDPlayer = require(\"./dvdPlayer\");\nconst Projector = require(\"./pro"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/projector.js",
"chars": 261,
"preview": "// Class for projector functionality\n\nclass Projector {\n on() {\n console.log(\"Projector on\");\n }\n\n connect(source)"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/snacks.js",
"chars": 291,
"preview": "// Class for snacks functionality\n\nclass Snacks {\n noteOrder(snacks) {\n console.log(`Ordering ${snacks}`);\n }\n pre"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Facade Design Pattern/soundSystem.js",
"chars": 278,
"preview": "// Class for sound system functionality\n\nclass SoundSystem {\n on() {\n console.log(\"Sound system is on\");\n }\n\n se"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circle.js",
"chars": 229,
"preview": "// Intrinsic state\nclass Circle{\n constructor(color){\n this.color = color;\n }\n\n draw(size, x, y){\n "
},
{
"path": "design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/circleFactory.js",
"chars": 415,
"preview": "// circleFactory.js\n\nconst Circle = require(\"./circle\");\n\nclass CircleFactory {\n constructor() {\n this.circles = {};"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Flyweight Design Pattern/main.js",
"chars": 533,
"preview": "const CircleFactory = require(\"./circleFactory\");\n\nconst circleFactory = new CircleFactory();\n\nconst redCircle = circleF"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/main.js",
"chars": 201,
"preview": "const proxyImage = require(\"./proxyImage\");\n\nconst image = new proxyImage(\"test.jpg\");\n\nconsole.log('First call to displ"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/proxyImage.js",
"chars": 417,
"preview": "// Proxy object\n\nconst realImage = require(\"./real_Image\");\n\nclass ProxyImage {\n constructor(fileName) {\n this.fileN"
},
{
"path": "design-patterns/Javascript/Structural Pattern/Proxy Design Pattern/real_Image.js",
"chars": 294,
"preview": "class realImage {\n constructor(fileName) {\n this.fileName = fileName;\n this.loadFromDisk();\n }\n\n loadFromDisk()"
},
{
"path": "design-patterns/cpp/adapter/in_house_payment_processor.cpp",
"chars": 849,
"preview": "#include \"in_house_payment_processor.h\"\n#include <iostream>\n#include <chrono>\n#include <sstream>\n\nvoid InHousePaymentPro"
},
{
"path": "design-patterns/cpp/adapter/in_house_payment_processor.h",
"chars": 375,
"preview": "#pragma once\n#include \"payment_processor.h\"\n#include <string>\n\nclass InHousePaymentProcessor : public PaymentProcessor {"
},
{
"path": "design-patterns/cpp/adapter/legacy_gateway.cpp",
"chars": 806,
"preview": "#include \"legacy_gateway.h\"\n#include <iostream>\n#include <chrono>\n\nvoid LegacyGateway::executeTransaction(double totalAm"
},
{
"path": "design-patterns/cpp/adapter/legacy_gateway.h",
"chars": 302,
"preview": "#pragma once\n#include <string>\n\nclass LegacyGateway {\npublic:\n void executeTransaction(double totalAmount, const std:"
},
{
"path": "design-patterns/cpp/adapter/legacy_gateway_adapter.cpp",
"chars": 826,
"preview": "#include \"legacy_gateway_adapter.h\"\n#include <iostream>\n\nLegacyGatewayAdapter::LegacyGatewayAdapter(LegacyGateway* legac"
},
{
"path": "design-patterns/cpp/adapter/legacy_gateway_adapter.h",
"chars": 412,
"preview": "#pragma once\n#include \"payment_processor.h\"\n#include \"legacy_gateway.h\"\n\nclass LegacyGatewayAdapter : public PaymentProc"
},
{
"path": "design-patterns/cpp/adapter/main.cpp",
"chars": 1119,
"preview": "#include \"in_house_payment_processor.h\"\n#include \"legacy_gateway.h\"\n#include \"legacy_gateway_adapter.h\"\n#include <iostre"
},
{
"path": "design-patterns/cpp/adapter/payment_processor.h",
"chars": 284,
"preview": "#pragma once\n#include <string>\n\nclass PaymentProcessor {\npublic:\n virtual ~PaymentProcessor() = default;\n virtual "
},
{
"path": "design-patterns/cpp/bridge/circle.cpp",
"chars": 172,
"preview": "#include \"circle.h\"\n\nCircle::Circle(Renderer* renderer, float radius)\n : Shape(renderer), radius(radius) {}\n\nvoid Cir"
},
{
"path": "design-patterns/cpp/bridge/circle.h",
"chars": 173,
"preview": "#pragma once\n#include \"shape.h\"\n\nclass Circle : public Shape {\npublic:\n Circle(Renderer* renderer, float radius);\n "
},
{
"path": "design-patterns/cpp/bridge/main.cpp",
"chars": 697,
"preview": "#include \"vector_renderer.h\"\n#include \"raster_renderer.h\"\n#include \"circle.h\"\n#include \"rectangle.h\"\n#include <iostream>"
},
{
"path": "design-patterns/cpp/bridge/raster_renderer.cpp",
"chars": 362,
"preview": "#include \"raster_renderer.h\"\n#include <iostream>\n\nvoid RasterRenderer::renderCircle(float radius) {\n std::cout << \"Dr"
},
{
"path": "design-patterns/cpp/bridge/raster_renderer.h",
"chars": 196,
"preview": "#pragma once\n#include \"renderer.h\"\n\nclass RasterRenderer : public Renderer {\npublic:\n void renderCircle(float radius)"
},
{
"path": "design-patterns/cpp/bridge/rectangle.cpp",
"chars": 221,
"preview": "#include \"rectangle.h\"\n\nRectangle::Rectangle(Renderer* renderer, float width, float height)\n : Shape(renderer), width"
},
{
"path": "design-patterns/cpp/bridge/rectangle.h",
"chars": 209,
"preview": "#pragma once\n#include \"shape.h\"\n\nclass Rectangle : public Shape {\npublic:\n Rectangle(Renderer* renderer, float width,"
},
{
"path": "design-patterns/cpp/bridge/renderer.h",
"chars": 191,
"preview": "#pragma once\n\nclass Renderer {\npublic:\n virtual ~Renderer() = default;\n virtual void renderCircle(float radius) = "
},
{
"path": "design-patterns/cpp/bridge/shape.cpp",
"chars": 77,
"preview": "#include \"shape.h\"\n\nShape::Shape(Renderer* renderer) : renderer(renderer) {} "
},
{
"path": "design-patterns/cpp/bridge/shape.h",
"chars": 197,
"preview": "#pragma once\n#include \"renderer.h\"\n\nclass Shape {\nprotected:\n Renderer* renderer;\npublic:\n explicit Shape(Renderer"
},
{
"path": "design-patterns/cpp/bridge/vector_renderer.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/bridge/vector_renderer.h",
"chars": 196,
"preview": "#pragma once\n#include \"renderer.h\"\n\nclass VectorRenderer : public Renderer {\npublic:\n void renderCircle(float radius)"
},
{
"path": "design-patterns/cpp/builder/http_request.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/builder/http_request.h",
"chars": 698,
"preview": "#pragma once\n#include <string>\n#include <map>\n#include <iostream>\n\nclass HttpRequest {\npublic:\n class Builder;\n\n s"
},
{
"path": "design-patterns/cpp/builder/http_request_builder.cpp",
"chars": 1339,
"preview": "#include \"http_request_builder.h\"\n#include <iostream>\n#include <algorithm>\n\nHttpRequest::Builder::Builder(const std::str"
},
{
"path": "design-patterns/cpp/builder/http_request_builder.h",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/builder/main.cpp",
"chars": 2045,
"preview": "#include \"http_request.h\"\n#include \"http_request_builder.h\"\n#include <iostream>\n\nint main() {\n // Example 1: Simple G"
},
{
"path": "design-patterns/cpp/chainofresponsibility/auth_handler.h",
"chars": 402,
"preview": "#pragma once\n#include \"base_handler.h\"\n#include <iostream>\n\nclass AuthHandler : public BaseHandler {\npublic:\n void ha"
},
{
"path": "design-patterns/cpp/chainofresponsibility/authorization_handler.h",
"chars": 424,
"preview": "#pragma once\n#include \"base_handler.h\"\n#include <iostream>\n\nclass AuthorizationHandler : public BaseHandler {\npublic:\n "
},
{
"path": "design-patterns/cpp/chainofresponsibility/base_handler.cpp",
"chars": 212,
"preview": "#include \"base_handler.h\"\n\nvoid BaseHandler::setNext(RequestHandler* nextHandler) {\n next = nextHandler;\n}\n\nvoid Base"
},
{
"path": "design-patterns/cpp/chainofresponsibility/base_handler.h",
"chars": 230,
"preview": "#pragma once\n#include \"request_handler.h\"\n\nclass BaseHandler : public RequestHandler {\nprotected:\n RequestHandler* ne"
},
{
"path": "design-patterns/cpp/chainofresponsibility/business_logic_handler.h",
"chars": 299,
"preview": "#pragma once\n#include \"base_handler.h\"\n#include <iostream>\n\nclass BusinessLogicHandler : public BaseHandler {\npublic:\n "
},
{
"path": "design-patterns/cpp/chainofresponsibility/main.cpp",
"chars": 877,
"preview": "#include \"auth_handler.h\"\n#include \"authorization_handler.h\"\n#include \"rate_limit_handler.h\"\n#include \"validation_handle"
},
{
"path": "design-patterns/cpp/chainofresponsibility/rate_limit_handler.h",
"chars": 425,
"preview": "#pragma once\n#include \"base_handler.h\"\n#include <iostream>\n\nclass RateLimitHandler : public BaseHandler {\npublic:\n vo"
},
{
"path": "design-patterns/cpp/chainofresponsibility/request.cpp",
"chars": 217,
"preview": "#include \"request.h\"\n\nRequest::Request(const std::string& user, const std::string& role, int requestCount, const std::st"
},
{
"path": "design-patterns/cpp/chainofresponsibility/request.h",
"chars": 264,
"preview": "#pragma once\n#include <string>\n\nclass Request {\npublic:\n std::string user;\n std::string userRole;\n int requestC"
},
{
"path": "design-patterns/cpp/chainofresponsibility/request_handler.h",
"chars": 209,
"preview": "#pragma once\n#include \"request.h\"\n\nclass RequestHandler {\npublic:\n virtual ~RequestHandler() = default;\n virtual v"
},
{
"path": "design-patterns/cpp/chainofresponsibility/validation_handler.h",
"chars": 485,
"preview": "#pragma once\n#include \"base_handler.h\"\n#include <iostream>\n\nclass ValidationHandler : public BaseHandler {\npublic:\n v"
},
{
"path": "design-patterns/cpp/composite/file.cpp",
"chars": 387,
"preview": "#include \"file.h\"\n#include <iostream>\n\nFile::File(const std::string& name, int size) : name(name), size(size) {}\n\nint Fi"
},
{
"path": "design-patterns/cpp/composite/file.h",
"chars": 330,
"preview": "#pragma once\n#include \"file_system_item.h\"\n#include <string>\n\nclass File : public FileSystemItem {\npublic:\n File(cons"
},
{
"path": "design-patterns/cpp/composite/file_system_item.h",
"chars": 245,
"preview": "#pragma once\n#include <string>\n\nclass FileSystemItem {\npublic:\n virtual ~FileSystemItem() = default;\n virtual int "
},
{
"path": "design-patterns/cpp/composite/folder.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/composite/folder.h",
"chars": 470,
"preview": "#pragma once\n#include \"file_system_item.h\"\n#include <string>\n#include <vector>\n#include <memory>\n\nclass Folder : public "
},
{
"path": "design-patterns/cpp/composite/main.cpp",
"chars": 850,
"preview": "#include \"file.h\"\n#include \"folder.h\"\n#include <iostream>\n#include <memory>\n\nint main() {\n auto file1 = std::make_sha"
},
{
"path": "design-patterns/cpp/decorator/bold_decorator.cpp",
"chars": 225,
"preview": "#include \"bold_decorator.h\"\n#include <iostream>\n\nBoldDecorator::BoldDecorator(TextView* inner) : TextDecorator(inner) {}"
},
{
"path": "design-patterns/cpp/decorator/bold_decorator.h",
"chars": 171,
"preview": "#pragma once\n#include \"text_decorator.h\"\n\nclass BoldDecorator : public TextDecorator {\npublic:\n explicit BoldDecorato"
},
{
"path": "design-patterns/cpp/decorator/italic_decorator.cpp",
"chars": 233,
"preview": "#include \"italic_decorator.h\"\n#include <iostream>\n\nItalicDecorator::ItalicDecorator(TextView* inner) : TextDecorator(inn"
},
{
"path": "design-patterns/cpp/decorator/italic_decorator.h",
"chars": 175,
"preview": "#pragma once\n#include \"text_decorator.h\"\n\nclass ItalicDecorator : public TextDecorator {\npublic:\n explicit ItalicDeco"
},
{
"path": "design-patterns/cpp/decorator/main.cpp",
"chars": 835,
"preview": "#include \"plain_text_view.h\"\n#include \"bold_decorator.h\"\n#include \"italic_decorator.h\"\n#include \"underline_decorator.h\"\n"
},
{
"path": "design-patterns/cpp/decorator/plain_text_view.cpp",
"chars": 177,
"preview": "#include \"plain_text_view.h\"\n#include <iostream>\n\nPlainTextView::PlainTextView(const std::string& text) : text(text) {}\n"
},
{
"path": "design-patterns/cpp/decorator/plain_text_view.h",
"chars": 218,
"preview": "#pragma once\n#include \"text_view.h\"\n#include <string>\n\nclass PlainTextView : public TextView {\npublic:\n explicit Plai"
},
{
"path": "design-patterns/cpp/decorator/text_decorator.cpp",
"chars": 93,
"preview": "#include \"text_decorator.h\"\n\nTextDecorator::TextDecorator(TextView* inner) : inner(inner) {} "
},
{
"path": "design-patterns/cpp/decorator/text_decorator.h",
"chars": 165,
"preview": "#pragma once\n#include \"text_view.h\"\n\nclass TextDecorator : public TextView {\nprotected:\n TextView* inner;\npublic:\n "
},
{
"path": "design-patterns/cpp/decorator/text_view.h",
"chars": 108,
"preview": "#pragma once\n\nclass TextView {\npublic:\n virtual ~TextView() = default;\n virtual void render() = 0;\n}; "
},
{
"path": "design-patterns/cpp/decorator/underline_decorator.cpp",
"chars": 245,
"preview": "#include \"underline_decorator.h\"\n#include <iostream>\n\nUnderlineDecorator::UnderlineDecorator(TextView* inner) : TextDeco"
},
{
"path": "design-patterns/cpp/decorator/underline_decorator.h",
"chars": 181,
"preview": "#pragma once\n#include \"text_decorator.h\"\n\nclass UnderlineDecorator : public TextDecorator {\npublic:\n explicit Underli"
},
{
"path": "design-patterns/cpp/facade/build_system.cpp",
"chars": 543,
"preview": "#include \"build_system.h\"\n\nbool BuildSystem::compileProject() {\n std::cout << \"BuildSystem: Compiling project...\" << "
},
{
"path": "design-patterns/cpp/facade/build_system.h",
"chars": 222,
"preview": "#pragma once\n#include <string>\n#include <chrono>\n#include <thread>\n#include <iostream>\n\nclass BuildSystem {\npublic:\n "
},
{
"path": "design-patterns/cpp/facade/deployment_facade.cpp",
"chars": 3109,
"preview": "#include \"deployment_facade.h\"\n#include <iostream>\n\nDeploymentFacade::DeploymentFacade()\n : vcs(std::make_unique<Vers"
},
{
"path": "design-patterns/cpp/facade/deployment_facade.h",
"chars": 622,
"preview": "#pragma once\n#include \"version_control_system.h\"\n#include \"build_system.h\"\n#include \"testing_framework.h\"\n#include \"depl"
},
{
"path": "design-patterns/cpp/facade/deployment_target.cpp",
"chars": 707,
"preview": "#include \"deployment_target.h\"\n\nvoid DeploymentTarget::transferArtifact(const std::string& artifactPath, const std::stri"
},
{
"path": "design-patterns/cpp/facade/deployment_target.h",
"chars": 308,
"preview": "#pragma once\n#include <string>\n#include <chrono>\n#include <thread>\n#include <iostream>\n\nclass DeploymentTarget {\npublic:"
},
{
"path": "design-patterns/cpp/facade/main.cpp",
"chars": 447,
"preview": "#include \"deployment_facade.h\"\n#include <iostream>\n\nint main() {\n DeploymentFacade facade;\n\n // Example 1: Full de"
},
{
"path": "design-patterns/cpp/facade/testing_framework.cpp",
"chars": 586,
"preview": "#include \"testing_framework.h\"\n\nbool TestingFramework::runUnitTests() {\n std::cout << \"Testing: Running unit tests..."
},
{
"path": "design-patterns/cpp/facade/testing_framework.h",
"chars": 204,
"preview": "#pragma once\n#include <chrono>\n#include <thread>\n#include <iostream>\n\nclass TestingFramework {\npublic:\n bool runUnitT"
},
{
"path": "design-patterns/cpp/facade/version_control_system.cpp",
"chars": 381,
"preview": "#include \"version_control_system.h\"\n\nvoid VersionControlSystem::pullLatestChanges(const std::string& branch) {\n std::"
},
{
"path": "design-patterns/cpp/facade/version_control_system.h",
"chars": 218,
"preview": "#pragma once\n#include <string>\n#include <chrono>\n#include <thread>\n#include <iostream>\n\nclass VersionControlSystem {\npub"
},
{
"path": "design-patterns/cpp/factory/CMakeLists.txt",
"chars": 264,
"preview": "cmake_minimum_required(VERSION 3.10)\nproject(factory)\n\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\na"
},
{
"path": "design-patterns/cpp/factory/email_notification.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/factory/email_notification.h",
"chars": 151,
"preview": "#pragma once\n#include \"notification.h\"\n\nclass EmailNotification : public Notification {\npublic:\n void send(const std:"
},
{
"path": "design-patterns/cpp/factory/main.cpp",
"chars": 855,
"preview": "#include \"notification_factory.h\"\n#include <iostream>\n\nint main() {\n try {\n // Create different types of notif"
},
{
"path": "design-patterns/cpp/factory/notification.h",
"chars": 158,
"preview": "#pragma once\n#include <string>\n\nclass Notification {\npublic:\n virtual ~Notification() = default;\n virtual void sen"
},
{
"path": "design-patterns/cpp/factory/notification_factory.cpp",
"chars": 567,
"preview": "#include \"notification_factory.h\"\n#include \"email_notification.h\"\n#include \"sms_notification.h\"\n#include \"push_notificat"
},
{
"path": "design-patterns/cpp/factory/notification_factory.h",
"chars": 201,
"preview": "#pragma once\n#include \"notification.h\"\n#include <string>\n#include <memory>\n\nclass NotificationFactory {\npublic:\n stat"
},
{
"path": "design-patterns/cpp/factory/push_notification.cpp",
"chars": 184,
"preview": "#include \"push_notification.h\"\n#include <iostream>\n\nvoid PushNotification::send(const std::string& message) {\n std::c"
},
{
"path": "design-patterns/cpp/factory/push_notification.h",
"chars": 150,
"preview": "#pragma once\n#include \"notification.h\"\n\nclass PushNotification : public Notification {\npublic:\n void send(const std::"
},
{
"path": "design-patterns/cpp/factory/sms_notification.cpp",
"chars": 168,
"preview": "#include \"sms_notification.h\"\n#include <iostream>\n\nvoid SMSNotification::send(const std::string& message) {\n std::cou"
},
{
"path": "design-patterns/cpp/factory/sms_notification.h",
"chars": 149,
"preview": "#pragma once\n#include \"notification.h\"\n\nclass SMSNotification : public Notification {\npublic:\n void send(const std::s"
},
{
"path": "design-patterns/cpp/flyweight/circle.cpp",
"chars": 317,
"preview": "#include \"circle.h\"\n#include <iostream>\n\nCircle::Circle(const std::string& color) : color(color) {}\n\nvoid Circle::draw()"
},
{
"path": "design-patterns/cpp/flyweight/circle.h",
"chars": 239,
"preview": "#pragma once\n#include \"shape.h\"\n#include <string>\n\nclass Circle : public Shape {\npublic:\n Circle(const std::string& c"
},
{
"path": "design-patterns/cpp/flyweight/main.cpp",
"chars": 665,
"preview": "#include \"shape_factory.h\"\n#include <iostream>\n\nint main() {\n std::cout << \"Flyweight Pattern Demo\\n\" << std::endl;\n\n"
},
{
"path": "design-patterns/cpp/flyweight/shape.h",
"chars": 118,
"preview": "#pragma once\n#include <string>\n\nclass Shape {\npublic:\n virtual ~Shape() = default;\n virtual void draw() = 0;\n}; "
},
{
"path": "design-patterns/cpp/flyweight/shape_factory.cpp",
"chars": 518,
"preview": "#include \"shape_factory.h\"\n#include \"circle.h\"\n\nstd::unordered_map<std::string, Shape*> ShapeFactory::circleMap;\n\nShape*"
},
{
"path": "design-patterns/cpp/flyweight/shape_factory.h",
"chars": 286,
"preview": "#pragma once\n#include \"shape.h\"\n#include <unordered_map>\n#include <string>\n#include <memory>\n\nclass ShapeFactory {\npubli"
},
{
"path": "design-patterns/cpp/iterator/container.h",
"chars": 142,
"preview": "#pragma once\n#include \"iterator.h\"\n\nclass Container {\npublic:\n virtual ~Container() = default;\n virtual Iterator* "
},
{
"path": "design-patterns/cpp/iterator/iterator.h",
"chars": 163,
"preview": "#pragma once\n#include <string>\n\nclass Iterator {\npublic:\n virtual ~Iterator() = default;\n virtual bool hasNext() ="
},
{
"path": "design-patterns/cpp/iterator/main.cpp",
"chars": 335,
"preview": "#include \"name_repository.h\"\n#include <iostream>\n\nint main() {\n NameRepository namesRepository;\n \n std::cout <<"
},
{
"path": "design-patterns/cpp/iterator/name_iterator.cpp",
"chars": 305,
"preview": "#include \"name_iterator.h\"\n\nNameIterator::NameIterator(const std::vector<std::string>& names) \n : names(names), index"
},
{
"path": "design-patterns/cpp/iterator/name_iterator.h",
"chars": 314,
"preview": "#pragma once\n#include \"iterator.h\"\n#include <vector>\n#include <string>\n\nclass NameIterator : public Iterator {\npublic:\n "
},
{
"path": "design-patterns/cpp/iterator/name_repository.cpp",
"chars": 224,
"preview": "#include \"name_repository.h\"\n#include \"name_iterator.h\"\n\nNameRepository::NameRepository() {\n names = {\"Robert\", \"John"
},
{
"path": "design-patterns/cpp/iterator/name_repository.h",
"chars": 232,
"preview": "#pragma once\n#include \"container.h\"\n#include <vector>\n#include <string>\n\nclass NameRepository : public Container {\npubli"
},
{
"path": "design-patterns/cpp/mediator/button.cpp",
"chars": 517,
"preview": "#include \"button.h\"\n#include <iostream>\n\nButton::Button(UIMediator* mediator) : UIComponent(mediator), enabled(false) {}"
},
{
"path": "design-patterns/cpp/mediator/button.h",
"chars": 209,
"preview": "#pragma once\n#include \"ui_component.h\"\n\nclass Button : public UIComponent {\npublic:\n explicit Button(UIMediator* medi"
},
{
"path": "design-patterns/cpp/mediator/form_mediator.cpp",
"chars": 1037,
"preview": "#include \"form_mediator.h\"\n#include <iostream>\n\nvoid FormMediator::setUsernameField(TextField* field) {\n usernameFiel"
},
{
"path": "design-patterns/cpp/mediator/form_mediator.h",
"chars": 543,
"preview": "#pragma once\n#include \"ui_mediator.h\"\n#include \"text_field.h\"\n#include \"button.h\"\n#include \"label.h\"\n\nclass FormMediator"
},
{
"path": "design-patterns/cpp/mediator/label.cpp",
"chars": 225,
"preview": "#include \"label.h\"\n#include <iostream>\n\nLabel::Label(UIMediator* mediator) : UIComponent(mediator) {}\n\nvoid Label::setTe"
},
{
"path": "design-patterns/cpp/mediator/label.h",
"chars": 224,
"preview": "#pragma once\n#include \"ui_component.h\"\n#include <string>\n\nclass Label : public UIComponent {\npublic:\n explicit Label("
},
{
"path": "design-patterns/cpp/mediator/main.cpp",
"chars": 1263,
"preview": "#include \"form_mediator.h\"\n#include \"text_field.h\"\n#include \"button.h\"\n#include \"label.h\"\n#include <iostream>\n\nint main("
},
{
"path": "design-patterns/cpp/mediator/text_field.cpp",
"chars": 346,
"preview": "#include \"text_field.h\"\n#include <iostream>\n\nTextField::TextField(UIMediator* mediator) : UIComponent(mediator) {}\n\nvoid"
},
{
"path": "design-patterns/cpp/mediator/text_field.h",
"chars": 272,
"preview": "#pragma once\n#include \"ui_component.h\"\n#include <string>\n\nclass TextField : public UIComponent {\npublic:\n explicit Te"
},
{
"path": "design-patterns/cpp/mediator/ui_component.cpp",
"chars": 176,
"preview": "#include \"ui_component.h\"\n\nUIComponent::UIComponent(UIMediator* mediator) : mediator(mediator) {}\n\nvoid UIComponent::not"
},
{
"path": "design-patterns/cpp/mediator/ui_component.h",
"chars": 221,
"preview": "#pragma once\n#include \"ui_mediator.h\"\n\nclass UIComponent {\npublic:\n explicit UIComponent(UIMediator* mediator);\n v"
},
{
"path": "design-patterns/cpp/mediator/ui_mediator.h",
"chars": 187,
"preview": "#pragma once\n\n// Forward declaration\nclass UIComponent;\n\nclass UIMediator {\npublic:\n virtual ~UIMediator() = default;"
},
{
"path": "design-patterns/cpp/memento/main.cpp",
"chars": 1383,
"preview": "#include \"text_editor.h\"\n#include \"text_editor_undo_manager.h\"\n#include <iostream>\n\nint main() {\n TextEditor editor;\n"
},
{
"path": "design-patterns/cpp/memento/text_editor.cpp",
"chars": 572,
"preview": "#include \"text_editor.h\"\n#include <iostream>\n\nvoid TextEditor::type(const std::string& newText) {\n content += newText"
},
{
"path": "design-patterns/cpp/memento/text_editor.h",
"chars": 297,
"preview": "#pragma once\n#include \"text_editor_memento.h\"\n#include <string>\n\nclass TextEditor {\npublic:\n void type(const std::str"
},
{
"path": "design-patterns/cpp/memento/text_editor_memento.cpp",
"chars": 186,
"preview": "#include \"text_editor_memento.h\"\n\nTextEditorMemento::TextEditorMemento(const std::string& state) : state(state) {}\n\nstd:"
},
{
"path": "design-patterns/cpp/memento/text_editor_memento.h",
"chars": 200,
"preview": "#pragma once\n#include <string>\n\nclass TextEditorMemento {\npublic:\n explicit TextEditorMemento(const std::string& stat"
},
{
"path": "design-patterns/cpp/memento/text_editor_undo_manager.cpp",
"chars": 370,
"preview": "#include \"text_editor_undo_manager.h\"\n#include <iostream>\n\nvoid TextEditorUndoManager::save(TextEditor& editor) {\n hi"
},
{
"path": "design-patterns/cpp/memento/text_editor_undo_manager.h",
"chars": 220,
"preview": "#pragma once\n#include \"text_editor.h\"\n#include <stack>\n\nclass TextEditorUndoManager {\npublic:\n void save(TextEditor& "
},
{
"path": "design-patterns/cpp/observer/fitness_data.cpp",
"chars": 1131,
"preview": "#include \"fitness_data.h\"\n#include <iostream>\n\nFitnessData::FitnessData() : steps(0), activeMinutes(0), calories(0) {}\n\n"
},
{
"path": "design-patterns/cpp/observer/fitness_data.h",
"chars": 781,
"preview": "#pragma once\n#include \"fitness_data_subject.h\"\n#include <vector>\n#include <memory>\n\nclass FitnessData : public FitnessDa"
},
{
"path": "design-patterns/cpp/observer/fitness_data_observer.h",
"chars": 196,
"preview": "#pragma once\n\n// Forward declaration\nclass FitnessData;\n\nclass FitnessDataObserver {\npublic:\n virtual ~FitnessDataObs"
},
{
"path": "design-patterns/cpp/observer/fitness_data_subject.h",
"chars": 310,
"preview": "#pragma once\n#include \"fitness_data_observer.h\"\n\nclass FitnessDataSubject {\npublic:\n virtual ~FitnessDataSubject() = "
},
{
"path": "design-patterns/cpp/observer/goal_notifier.cpp",
"chars": 562,
"preview": "#include \"goal_notifier.h\"\n#include \"fitness_data.h\"\n#include <iostream>\n\nvoid GoalNotifier::update(const FitnessData& d"
},
{
"path": "design-patterns/cpp/observer/goal_notifier.h",
"chars": 161,
"preview": "#pragma once\n#include \"fitness_data_observer.h\"\n\nclass GoalNotifier : public FitnessDataObserver {\npublic:\n void upda"
},
{
"path": "design-patterns/cpp/observer/live_activity_display.cpp",
"chars": 363,
"preview": "#include \"live_activity_display.h\"\n#include \"fitness_data.h\"\n#include <iostream>\n\nvoid LiveActivityDisplay::update(const"
},
{
"path": "design-patterns/cpp/observer/live_activity_display.h",
"chars": 168,
"preview": "#pragma once\n#include \"fitness_data_observer.h\"\n\nclass LiveActivityDisplay : public FitnessDataObserver {\npublic:\n vo"
},
{
"path": "design-patterns/cpp/observer/main.cpp",
"chars": 947,
"preview": "#include \"fitness_data.h\"\n#include \"live_activity_display.h\"\n#include \"progress_logger.h\"\n#include \"goal_notifier.h\"\n#in"
},
{
"path": "design-patterns/cpp/observer/progress_logger.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/observer/progress_logger.h",
"chars": 163,
"preview": "#pragma once\n#include \"fitness_data_observer.h\"\n\nclass ProgressLogger : public FitnessDataObserver {\npublic:\n void up"
},
{
"path": "design-patterns/cpp/prototype/enemy.cpp",
"chars": 637,
"preview": "#include \"enemy.h\"\n#include <iostream>\n\nEnemy::Enemy(const std::string& type, int health, double speed, bool armored, co"
},
{
"path": "design-patterns/cpp/prototype/enemy.h",
"chars": 517,
"preview": "#pragma once\n#include \"enemy_prototype.h\"\n#include <string>\n\nclass Enemy : public EnemyPrototype {\npublic:\n Enemy(con"
},
{
"path": "design-patterns/cpp/prototype/enemy_prototype.h",
"chars": 136,
"preview": "#pragma once\n\nclass EnemyPrototype {\npublic:\n virtual ~EnemyPrototype() = default;\n virtual EnemyPrototype* clone("
},
{
"path": "design-patterns/cpp/prototype/enemy_registry.cpp",
"chars": 1,
"preview": " "
},
{
"path": "design-patterns/cpp/prototype/enemy_registry.h",
"chars": 378,
"preview": "#pragma once\n#include \"enemy.h\"\n#include <string>\n#include <unordered_map>\n#include <memory>\n#include <stdexcept>\n\nclass"
}
]
// ... and 2558 more files (download for full content)
About this extraction
This page contains the full source code of the ashishps1/awesome-low-level-design GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 2758 files (2.8 MB), approximately 890.8k tokens, and a symbol index with 8478 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.