In: Computer Science
1) What steps can you take to ensure that code changes made to your dependencies will not impact your code?
2) Describe the process of mocking and give some examples of scenarios where it might be used. How does this help us?
1) Over the years, technology has been revolutionized in our daily lives. Technology growth is rapid and has created amazing tools and resources, putting useful information at our fingertips. While creating a new project with scope for long term usage, Usage of correct dependencies is one of the important aspect in project maintenance. Newer version of dependencies will be released in-order to overcome the issues from previous versions and able to compatible with the advanced technology. There are few steps to ensure that code changes made to your dependencies will not impact your code. First, make sure that you have a complete list of project tasks and schedule a workshop with your team so they can collaborate on the To Do list because many dependencies fall during the handoff of a task to another team. Then work out where the natural links are between activities and these are internal dependencies that occur within the environment of the project itself. Later define the external dependencies that are required for the project. Choose the right dependency type for the link you want to create between your tasks. In 90% of situations the finish-to-start dependency will be the right one, but think creatively about how you use all these types. If your dependency list includes a reliance on suppliers then pick someone who can monitor the relationship with that supplier and check that they are on track to complete their tasks. Enter the correct dependency information into your project schedule. When you update your schedule in your project management software with dependency data you’ll notice that the end date of the project will change. The software automatically calculates the impact of linking tasks on the plan and works out the fastest time that you can complete the project. When dependencies go wrong, The impact of getting a dependency wrong can be devastating for a project. That’s why it’s important to monitor dependencies regularly and communicate effectively between the team so that everyone knows when to expect work to be coming their way. Managing dependencies isn’t a one-off activity, so you’ll need to monitor the dependencies between tasks as the project progresses. So finally, understanding task dependencies lets you manage the project work more efficiently and make sure that the right resources are lined up at the right time to get everything done.
2) Mocking is a process that is used in unit testing when the unit being tested has external dependencies. During mocking, We'll be creating a fake version of an external or internal service that can stand in for the real one, helping your tests run more quickly and more reliably.The purpose of mocking is to isolate and focus on the code being tested and not on the behavior or state of external dependencies. In mocking, the dependencies are replaced by closely controlled replacements objects that simulate the behavior of the real ones. In mocking, Your implementation interacts with an object’s properties, rather than its function or behavior, a mock can be used. For example, whenever you run a test, you’re exercising the implementation. So when a delete or create function happens, you’re letting it create a file, or delete a file. This work is not efficient, and the data it creates and deletes is not actually useful. Furthermore, it’s expensive to clean up, because now you have to manually delete something every time. This is a case where mocking/stubbing can help a lot. Using mocks to fake the external functionality help you create tests that are independent. For instance, say that the test writes a file to /tmp/test_file.txt and then the system under the test deletes it. The problem then is not that the test is not independent; it is that the system calls take a lot of time. In this instance, you can mock the file system call’s response, which will take a lot less time because it immediately returns.