{"id":24716851,"url":"https://github.com/samyam81/fly-weight","last_synced_at":"2025-03-22T09:21:35.023Z","repository":{"id":241706610,"uuid":"807460945","full_name":"samyam81/Fly-Weight","owner":"samyam81","description":"This repository contains a Java implementation demonstrating the Flyweight design pattern, which is used to minimize memory usage and improve performance by sharing as much data as possible with related objects. ","archived":false,"fork":false,"pushed_at":"2024-05-29T07:00:41.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T09:14:24.622Z","etag":null,"topics":["java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samyam81.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-05-29T06:36:16.000Z","updated_at":"2024-06-23T12:07:31.000Z","dependencies_parsed_at":"2024-05-29T19:55:03.069Z","dependency_job_id":null,"html_url":"https://github.com/samyam81/Fly-Weight","commit_stats":null,"previous_names":["samyam81/fly-weight"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyam81%2FFly-Weight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyam81%2FFly-Weight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyam81%2FFly-Weight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyam81%2FFly-Weight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samyam81","download_url":"https://codeload.github.com/samyam81/Fly-Weight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244932987,"owners_count":20534270,"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":["java"],"created_at":"2025-01-27T09:14:27.956Z","updated_at":"2025-03-22T09:21:35.002Z","avatar_url":"https://github.com/samyam81.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fly-Weight\n\nThis repository contains a Java implementation demonstrating the Flyweight design pattern, which is used to minimize memory usage and improve performance by sharing as much data as possible with related objects. In this example, the Flyweight pattern is applied to a weapon shop scenario.\n\n## Contents\n\n- [Introduction](#introduction)\n- [Usage](#usage)\n- [Structure](#structure)\n\n## Introduction\n\nThe Flyweight pattern is utilized here to optimize the creation and management of various types of guns in a weapon shop. By sharing common parts of gun objects, memory usage is reduced, and performance is improved.\n\n## Usage\n\nTo run the application, execute the `Application.java` file located in the `src` directory. This will simulate enumerating the shelves of the weapon shop, showcasing the creation and shooting of different types of guns.\n\n```java\npublic class Application {\n\n    public static void main(String[] args) {\n        WeaponShop shop = new WeaponShop();\n        shop.enumerateShelves();\n    }\n}\n```\n\n## Structure\n\nThe project consists of the following key components:\n\n- `WeaponShop`: Represents the weapon shop where guns are stored and enumerated. It uses the Flyweight pattern to manage guns efficiently.\n- `GunFactory`: Implements the Flyweight factory responsible for creating and caching different types of guns.\n- `GunType`: Enumerates the various types of guns available in the shop.\n- `Shooting`: Defines the interface for shooting behavior.\n- Gun implementations (`HandGun`, `Musket`, `Sniper`, `Submachine`): Concrete implementations of different types of guns.\n```\n\nFeel free to use or modify it further!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyam81%2Ffly-weight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamyam81%2Ffly-weight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyam81%2Ffly-weight/lists"}