You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Description: We apply Extract method because it breaks down the long and complex ‘main’ into smaller methods like initializeCloudSim, createAndSubmitVm, and createAndSubmitCloudlet, making the program flow clearer and easier to follow.
Benefits:
Maintainability: Allows modifying specific parts of the configuration (like VMs or Cloudlets) without affecting the rest of the code, simplifying management and updating.
Modularity: Facilitates reusing methods in other contexts or tests, reducing code duplication.
Debugging: Helps identify and fix bugs more easily by isolating logic into separate methods.
Previous Design:
From line 51 to 157 the main method. More than 100 lines.
Paragraph locked by Anonymous User
Problem Description: The constructor of the cloudlet class has more than three parameters in the constructor thus violating long parameter list. The solution is as follows: Introduce a parameter object. Create a dedicated class to encapsulate the related parameters. Pass an instance of this class as a single parameter to the method.
Benefits: Improved readability, maintainability, and testability.
Feel free to submit your code as a PR, so that we can discuss it over there.
Encapsulation is indeed useful for extensibility purposes, but I don't see the reason for it in such "primitive" use-cases (e.g., keep track of the number of submitted vms and cloudlets); What sort of additional behaviors are you envisioning for vmSubmitted, vmsDestroyed etc?. The downsite is that we'll just pollute the jvm memory with more useless object allocations.
Replace Data Value with Object:
CloudDataCenterBroker.java
Replace primitive fields like cloudletsSubmitted, vmsRequested, vmsAcks, vmsDestroyed with dedicated classes or objects
Benefits: Encapsulation or additional behavior.
Inline Method
Problem Description The getSeekTime(in size) method is a simple method that is used as a getter twice.
Benefits Consider writing the expression on a single line to avoid using the temporary variable seekTime.
Move method
CloudSim Host.java
Issue Description
Methods related to VM migration can be moved to a dedicated VmMigrationManager class.
Benefits: Helps with the single responsibility principle by balancing the load of the main class into helper classes.
Extract method
Problem Description: We apply Extract method because it breaks down the long and complex ‘main’ into smaller methods like initializeCloudSim, createAndSubmitVm, and createAndSubmitCloudlet, making the program flow clearer and easier to follow.
Benefits:
Maintainability: Allows modifying specific parts of the configuration (like VMs or Cloudlets) without affecting the rest of the code, simplifying management and updating.
Modularity: Facilitates reusing methods in other contexts or tests, reducing code duplication.
Debugging: Helps identify and fix bugs more easily by isolating logic into separate methods.
Previous Design:
From line 51 to 157 the main method. More than 100 lines.
Paragraph locked by Anonymous User
Extract class
Problem Description: The constructor of the cloudlet class has more than three parameters in the constructor thus violating long parameter list. The solution is as follows: Introduce a parameter object. Create a dedicated class to encapsulate the related parameters. Pass an instance of this class as a single parameter to the method.
Benefits: Improved readability, maintainability, and testability.
The text was updated successfully, but these errors were encountered: