{"id":21523175,"url":"https://github.com/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples","last_synced_at":"2025-07-16T07:31:17.702Z","repository":{"id":108166913,"uuid":"139456648","full_name":"OSSpk/Factory-Singleton-and-Strategy-Design-Patterns_Examples","owner":"OSSpk","description":"🐉 Solved problems demonstrating the use of Factory, Singleton and Strategy Design Patterns using Java. These problems were solved during the course \"Object Oriented Analysis and Design CS309\"","archived":false,"fork":false,"pushed_at":"2024-11-22T11:59:01.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-22T12:37:06.920Z","etag":null,"topics":["behavioral-patterns","creational-patterns","design-patterns","design-patterns-implemented-in-java","factory-method","factory-pattern","object-oriented-design","singleton-pattern","strategy-design-pattern","strategy-pattern"],"latest_commit_sha":null,"homepage":"https://github.com/harismuneer","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OSSpk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.cyfylabs.com"]}},"created_at":"2018-07-02T14:47:14.000Z","updated_at":"2024-11-22T11:59:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"37f016f6-7485-4901-9cca-3b4c5caa6bcd","html_url":"https://github.com/OSSpk/Factory-Singleton-and-Strategy-Design-Patterns_Examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSpk%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSpk%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSpk%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSpk%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSSpk","download_url":"https://codeload.github.com/OSSpk/Factory-Singleton-and-Strategy-Design-Patterns_Examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226112968,"owners_count":17575438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behavioral-patterns","creational-patterns","design-patterns","design-patterns-implemented-in-java","factory-method","factory-pattern","object-oriented-design","singleton-pattern","strategy-design-pattern","strategy-pattern"],"created_at":"2024-11-24T01:12:54.049Z","updated_at":"2025-07-16T07:31:17.693Z","avatar_url":"https://github.com/OSSpk.png","language":"Java","readme":"# Examples Demonstrating Factory, Singleton and Strategy Design Patterns 🐉 \n\n\n\u003ca href=\"https://github.com/harismuneer\"\u003e\u003cimg alt=\"views\" title=\"Github views\" src=\"https://komarev.com/ghpvc/?username=harismuneer\u0026style=flat-square\" width=\"125\"/\u003e\u003c/a\u003e\n[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](#)\n[![GitHub Forks](https://img.shields.io/github/forks/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples.svg?style=social\u0026label=Fork\u0026maxAge=2592000)](https://www.github.com/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples/fork)\n[![GitHub Issues](https://img.shields.io/github/issues/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples.svg?style=flat\u0026label=Issues\u0026maxAge=2592000)](https://www.github.com/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples/issues)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat\u0026label=Contributions\u0026colorA=red\u0026colorB=black\t)](#)\n\n\n\n\nTo study more about Design Patterns, visit [Source Making Design Patterns](https://sourcemaking.com/design_patterns)\n\n## Factory Method\nQ1: In a ‘Drawing’ system, depending on user’s input, different pictures like square, rectangle, circle can be drawn. Here we can use factory method to create instances depending on user’s input. For adding new type of shape, no need to change client’s code. \n\nQ2: In travel site, we can book train ticket as well bus tickets and flight ticket. In this case user can give his travel type as ‘bus’, ‘train’ or ‘flight’.\nHere we have an abstract class ‘AnyTravel’ with a static member function ‘GetObject’ which depending on user’s travel type, will create \u0026 return object of ‘BusTravel’ or ‘ TrainTravel’. ‘BusTravel’ or ‘ TrainTravel’ have common functions like passenger name, Origin, destination parameters. \n\n\n## Strategy and Singleton Patterns\nQ. You are asked to develop a mobile application for a Famous Shopping Cart system.\nThis application has the option for the user to shop in either an online mode or in an offline mode. If the user is connected to the network, your application would fetch the product list from the server, which will be called by the NetworkManager and if the user is not connected to the server the product list will be fetched from local database using\nDatabaseManager. You have a product object which contains product id, name and price.\nThe database manager and network manager has one method getProductList which will return array of products.\n\nNote: You will require a global method in your main named bool checkAccessibility() it will return true if internet is connected and false if internet is not connected\n\nHint: Use singleton and strategy pattern.\n\n\n\n## How to Run\n1- Install these:\n * [Java SE Development Kit 8 (JDK 8)](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)\n * After installing JDK 8, install [NetBeans IDE](https://netbeans.org/downloads/)\n\n2- Open NetBeans IDE. Click on File -\u003e Open Project and browse to the project you want to open say \"Factory Method\" and select it. It will load the NetBeans project. (There are basically two separate NetBeans Projects named *Factory Method* and *Strategy and Singleton Patterns*)\n\n\n\u003chr\u003e\n\n\n## Author\nYou can get in touch with me on my LinkedIn Profile: [![LinkedIn Link](https://img.shields.io/badge/Connect-harismuneer-blue.svg?logo=linkedin\u0026longCache=true\u0026style=social\u0026label=Follow)](https://www.linkedin.com/in/harismuneer)\n\nYou can also follow my GitHub Profile to stay updated about my latest projects: [![GitHub Follow](https://img.shields.io/badge/Connect-harismuneer-blue.svg?logo=Github\u0026longCache=true\u0026style=social\u0026label=Follow)](https://github.com/harismuneer)\n\nIf you liked the repo then kindly support it by giving it a star ⭐ and share in your circles so more people can benefit from the effort.\n\n\n## Contributions Welcome\n[![GitHub Issues](https://img.shields.io/github/issues/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples.svg?style=flat\u0026label=Issues\u0026maxAge=2592000)](https://www.github.com/harismuneer/Factory-Singleton-and-Strategy-Design-Patterns_Examples/issues)\n\nIf you find any bugs, have suggestions, or face issues:\n\n- Open an Issue in the Issues Tab to discuss them.\n- Submit a Pull Request to propose fixes or improvements.\n- Review Pull Requests from other contributors to help maintain the project's quality and progress.\n\nThis project thrives on community collaboration! Members are encouraged to take the initiative, support one another, and actively engage in all aspects of the project. Whether it’s debugging, fixing issues, or brainstorming new ideas, your contributions are what keep this project moving forward.\n\nWith modern AI tools like ChatGPT, solving challenges and contributing effectively is easier than ever. Let’s work together to make this project the best it can be! 🚀\n\n\n## License\n[![MIT](https://img.shields.io/cocoapods/l/AFNetworking.svg?style=style\u0026label=License\u0026maxAge=2592000)](../master/LICENSE)\n\nCopyright (c) 2018-present, harismuneer                                                        \n\n\u003c!-- PROFILE_INTRO_START --\u003e\n\n\u003chr\u003e\n\n\u003ch1\u003e \u003ca href=\"#\"\u003e\u003cimg src=\"https://media.giphy.com/media/hvRJCLFzcasrR4ia7z/giphy.gif\" alt=\"Waving hand\" width=\"28\"\u003e\u003c/a\u003e\nHey there, I'm \u003ca href=\"https://www.linkedin.com/in/harismuneer/\"\u003eHaris Muneer\u003c/a\u003e 👨🏻‍💻\n\u003c/h1\u003e\n\n\n\u003ca href=\"https://github.com/harismuneer\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/harismuneer\" alt=\"Total Github Stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/harismuneer?tab=followers\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/harismuneer\" alt=\"Total Github Followers\"\u003e\u003c/a\u003e\n\n\u003chr\u003e\n\n- \u003cb\u003e🛠️ Product Builder:\u003c/b\u003e Agile Product Manager with 5+ years of hands-on experience delivering SaaS solutions across sales, recruiting, AI, social media, and public sector domains. Background in Computer Science, with a proven track record of scaling products from inception to $XXM+ ARR, launching 3 top-ranking tools on Product Hunt, and developing solutions adopted by 250+ B2B clients in 40+ countries.  \n \n- \u003cb\u003e🌟 Open Source Advocate:\u003c/b\u003e Passionate about making technology accessible, I’ve developed and open-sourced several software projects for web, mobile, desktop, and AI on my \u003ca href=\"https://github.com/harismuneer\"\u003eGitHub profile\u003c/a\u003e. These projects have been used by thousands of learners worldwide to enhance their skills and knowledge.\n\n- \u003cb\u003e📫 How to Reach Me:\u003c/b\u003e To learn more about my skills and work, visit my \u003ca href=\"https://www.linkedin.com/in/harismuneer\"\u003eLinkedIn profile\u003c/a\u003e. For collaboration or inquiries, feel free to reach out via \u003ca href=\"mailto:haris.muneer5@gmail.com\"\u003eemail\u003c/a\u003e.\n\n\u003chr\u003e\n\n\u003ch2 align=\"left\"\u003e🤝 Follow my journey\u003c/h2\u003e\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://www.linkedin.com/in/harismuneer\"\u003e\u003cimg title=\"Follow Haris Muneer on LinkedIn\" src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/harismuneer\"\u003e\u003cimg title=\"Follow Haris Muneer on GitHub\" src=\"https://img.shields.io/badge/GitHub-100000?style=for-the-badge\u0026logo=github\u0026logoColor=white\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.youtube.com/@haris_muneer?sub_confirmation=1\"\u003e\u003cimg title=\"Subscribe on YouTube\" src=\"https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge\u0026logo=youtube\u0026logoColor=white\"/\u003e\u003c/a\u003e \n  \u003ca href=\"mailto:haris.muneer5@gmail.com\"\u003e\u003cimg title=\"Email\" src=\"https://img.shields.io/badge/Gmail-D14836?style=for-the-badge\u0026logo=gmail\u0026logoColor=white\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\u003c!-- PROFILE_INTRO_END --\u003e\n\n\n\n\n","funding_links":["https://www.cyfylabs.com"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharismuneer%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharismuneer%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharismuneer%2FFactory-Singleton-and-Strategy-Design-Patterns_Examples/lists"}