Title: Code Refactoring based on SOLID Principles · Issue #6 · flyworker/java-workshop · GitHub
Open Graph Title: Code Refactoring based on SOLID Principles · Issue #6 · flyworker/java-workshop
X Title: Code Refactoring based on SOLID Principles · Issue #6 · flyworker/java-workshop
Description: Hi developers I was looking through your code and found some SOLID principles that were being violated, here are my suggestions on how to fix it: In Cloud.java, the interface had too many responsibilities, so it's better if you separate ...
Open Graph Description: Hi developers I was looking through your code and found some SOLID principles that were being violated, here are my suggestions on how to fix it: In Cloud.java, the interface had too many responsib...
X Description: Hi developers I was looking through your code and found some SOLID principles that were being violated, here are my suggestions on how to fix it: In Cloud.java, the interface had too many responsib...
Opengraph URL: https://github.com/flyworker/java-workshop/issues/6
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Code Refactoring based on SOLID Principles","articleBody":"Hi developers\r\nI was looking through your code and found some SOLID principles that were being violated, here are my suggestions on how to fix it: \r\n\r\nIn Cloud.java, the interface had too many responsibilities, so it's better if you separate each responsibility in one interface on its own: \r\n`public interface Loggin {\r\n public boolean login(String userName, String password);\r\n}`\r\n\r\n`public interface Upload {\r\n public void upload(String file); \r\n}`\r\n\r\n`public interface Download {\r\n public String download(String file);\r\n}`\r\n\r\nLeaving Cloud just handeling the files, like this: \r\n`public interface Cloud {\r\n public void listFiles();\r\n}`\r\n\r\nNow in Fly.java, interface that implements Bird, the main issue is Penguin causing the method fly() throw an error, since penguins cannot fly, instead I suggest the next model: \r\n\r\nUML Diagram\r\n\r\n\r\nAnd finally in CaoCloaud.java you're using a direct object of CloudImp, taking advantage of the interfaces i suggested to creat in the problem with Cloud, we can fix it using your own class AbstractClouad.java and the interfaces, adding a new interface for FastDownload, something like this: \r\n\r\nUML Diagram \r\n\r\n\r\nThat would be all, thanks for reading and I hope this helps a little :)\r\n\r\n\r\n","author":{"url":"https://github.com/eimmy-o","@type":"Person","name":"eimmy-o"},"datePublished":"2024-11-12T22:59:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/6/java-workshop/issues/6"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:13b1c866-a731-fac8-a9c7-2e3aa4b8fc7a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD0E:23810A:9D1BD7:C9E1B3:69923855 |
| html-safe-nonce | 6cf747b06763f820c6b11e32f123de24d4143f9aeb61d09b252764173eb4dc2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDBFOjIzODEwQTo5RDFCRDc6QzlFMUIzOjY5OTIzODU1IiwidmlzaXRvcl9pZCI6IjE2ODY5MzU5MDAwNTM5NzcxNzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8892b99850c188bab020e3c3751f8c2f2f6608347806df42116623fe66bd4e76 |
| hovercard-subject-tag | issue:2653568408 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/flyworker/java-workshop/6/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5fdb257bb0882f583bd736b34e7423b5593be896fac40aafd0e94d2a8d7cb2e3/flyworker/java-workshop/issues/6 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5fdb257bb0882f583bd736b34e7423b5593be896fac40aafd0e94d2a8d7cb2e3/flyworker/java-workshop/issues/6 |
| og:image:alt | Hi developers I was looking through your code and found some SOLID principles that were being violated, here are my suggestions on how to fix it: In Cloud.java, the interface had too many responsib... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eimmy-o |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/flyworker/java-workshop git https://github.com/flyworker/java-workshop.git |
| octolytics-dimension-user_id | 8363795 |
| octolytics-dimension-user_login | flyworker |
| octolytics-dimension-repository_id | 100090200 |
| octolytics-dimension-repository_nwo | flyworker/java-workshop |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 100090200 |
| octolytics-dimension-repository_network_root_nwo | flyworker/java-workshop |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width