When you're programming, it's important to avoid the mistake of creating circular dependencies. Circular dependencies make it hard to maintain code in the long run, reduce code reusability, and can cause errors. In this video, learn how to identify circular dependencies and remove them in your code.
- [Instructor] When you're programming, … it's important to avoid the mistake … of creating circular dependencies. … Circular dependencies make it hard to maintain code … in the long run, reduce code reusability, … and can cause errors. … For example, let's say I wrote this program here. … I defined four functions, … after which I called the function rug_dim, … which is supposed to select the dimensions for a rug in feet … and display them. … Note that in the definition of rug_dim … width is determined by calling the function getWidth. … Which generates and returns a random width. … And length is determined by calling the function getLength. … Now, in the definition of getLength, … the function chooseLength is called. … And in the definition of chooseLength, getLength is called. … This indicates a circular dependency. … I'll run this cell now to show you what happens. … As you can see, I got a RecursionError. … This is due to the circular dependency … between the chooseLength function …
Skill Level Intermediate
1. Avoid Mistakes in Coding Practices
2. Avoid Mistakes in Structuring Code
3. Avoid Mistakes in Handling Data
4. Avoid Mistakes in Machine Learning
Using redundant features1m 45s
Get started with Python1m 7s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.