{"id":20575549,"url":"https://github.com/janbaig/visitor-design-pattern","last_synced_at":"2025-03-06T10:45:59.906Z","repository":{"id":161528392,"uuid":"610991435","full_name":"janbaig/visitor-design-pattern","owner":"janbaig","description":"Implementation and Explanation of the Visitor Design Pattern","archived":false,"fork":false,"pushed_at":"2024-01-22T15:48:18.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T21:50:46.820Z","etag":null,"topics":["design-patterns","tutorial","visitor-design-pattern"],"latest_commit_sha":null,"homepage":"https://janbaig.netlify.app/posts/visitor_design_pattern/","language":"C++","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/janbaig.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":"2023-03-07T22:14:13.000Z","updated_at":"2025-01-07T02:55:24.000Z","dependencies_parsed_at":"2024-01-22T17:46:20.857Z","dependency_job_id":"e40a6b84-a997-42aa-8422-ef6a97f23280","html_url":"https://github.com/janbaig/visitor-design-pattern","commit_stats":null,"previous_names":["janbaig/visitor-design-pattern"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbaig%2Fvisitor-design-pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbaig%2Fvisitor-design-pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbaig%2Fvisitor-design-pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbaig%2Fvisitor-design-pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janbaig","download_url":"https://codeload.github.com/janbaig/visitor-design-pattern/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242196308,"owners_count":20087765,"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":["design-patterns","tutorial","visitor-design-pattern"],"created_at":"2024-11-16T05:39:33.855Z","updated_at":"2025-03-06T10:45:59.884Z","avatar_url":"https://github.com/janbaig.png","language":"C++","readme":"# Visitor Design Pattern\n\n### Description\nThe visitor design pattern is a behavioural design pattern that allows for the separation of algorithms from the objects on which they operate. \n\nAdding new methods within subclasses works fine if the program being developed isn't complex - simply add the methods to each of the individual subclasses. For example, if we have an Animal parent class, each of the Animal subclasses may need to implement a `makeSounds()` method. However, when our codebase consists of dozens of new methods to be implemented for dozens of subclasses, the code within each subclass becomes cluttered and often becomes difficult to maintain.\n\nThe visitor design pattern solves this problem. It allows for the addition of methods into subclasses *without modifying* the existing subclasses themselves. So, if we need all of our subclasses to implement the `makeSound()` method, instead of _individually_ going into each subclass and adding it, we can instead couple all the `makeSound()` implementations for each subclass in one place. That way we only need to visit one section in our code and modify that section alone - effectively resulting in all subclasses having implementations of `makeSound()` without having to visit each and every subclass separately.\n\n\n\u003e Check out a [blog](https://janbaig.netlify.app/posts/visitor_design_pattern/) I've written explaining the concept in far greater detail if you'd like to learn more! 👾\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanbaig%2Fvisitor-design-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanbaig%2Fvisitor-design-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanbaig%2Fvisitor-design-pattern/lists"}