You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@eventmesh.apache.org by "Alonexc (via GitHub)" <gi...@apache.org> on 2023/04/27 02:51:46 UTC

[GitHub] [eventmesh] Alonexc opened a new issue, #3827: [Enhancement] Do some code optimization.[MessageQueue]

Alonexc opened a new issue, #3827:
URL: https://github.com/apache/eventmesh/issues/3827

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Enhancement Request
   
   ![image](https://user-images.githubusercontent.com/91315508/234746690-ab2900e3-c79c-4d88-8ce8-00c05706decd.png)
   ![image](https://user-images.githubusercontent.com/91315508/234746695-0039207e-7c95-4fca-b101-2307c6d16506.png)
   ![image](https://user-images.githubusercontent.com/91315508/234746704-98e9c3fc-f5d7-4a85-9633-848ded7e2f2c.png)
   located at:
   eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/broker/MessageQueue.java line 32,68,87,105,129,152,178,
   eventmesh-storage-plugin/eventmesh-storage-standalone/src/test/java/org/apache/eventmesh/storage/standalone/broker/MessageQueueTest.java line 46,53,60,67,74,81,94
   analysis and explanation:
   a. Public class variable fields do not respect the encapsulation principle and has three main disadvantages:
   Additional behavior such as validation cannot be added.
   The internal representation is exposed, and cannot be changed afterwards.
   Member values are subject to change from anywhere in the code and may not meet the programmer’s assumptions.
   By using private attributes and accessor methods (set and get), unauthorized modifications are prevented.
   b. Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they’re using one variable but are really using another.
   
   
   ### Describe the solution you'd like
   
   a. Change to use the private final modifier.
   ![image](https://user-images.githubusercontent.com/91315508/234746762-1f802337-f969-4b3a-86f6-a480bf92d44b.png)
   ![image](https://user-images.githubusercontent.com/91315508/234746776-d27a8482-5a79-4f1d-b5ef-538bf3c55c43.png)
   ![image](https://user-images.githubusercontent.com/91315508/234746789-9fde7c22-5933-44e1-9b06-fc8f7a1f82af.png)
   
   b. 'lock' rename.
   ![image](https://user-images.githubusercontent.com/91315508/234746822-a98f7a85-6a1e-40ed-97c8-60347b267a6d.png)
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [eventmesh] xwm1992 closed issue #3827: [Enhancement] Do some code optimization.[MessageQueue]

Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 closed issue #3827: [Enhancement] Do some code optimization.[MessageQueue]
URL: https://github.com/apache/eventmesh/issues/3827


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org