Editing 754: Dependencies
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
| date = June 16, 2010 | | date = June 16, 2010 | ||
| title = Dependencies | | title = Dependencies | ||
− | | image = | + | | image = Dependencies.png |
| titletext = The prereqs for CPSC 357, the class on package management, are CPSC 432, CPSC 357, and glibc2.5 or later. | | titletext = The prereqs for CPSC 357, the class on package management, are CPSC 432, CPSC 357, and glibc2.5 or later. | ||
}} | }} | ||
==Explanation== | ==Explanation== | ||
− | |||
− | + | {{incomplete|this explain is still a horror for non programmers.}} | |
− | + | Often, a program needs other programs to work. Part of computer science is figuring out which programs are needed by this program. However, sometimes two programs could depend on each other, making it impossible to install the program. In the comic, in order to take course CPSC 432, you have to take course CPSC 432, which means it is impossible to take this course. | |
− | + | ; Comic | |
+ | :A {{w|compiler}} is a computer program that translates a program written in one computer language -- C++, for example -- into an equivalent program written in another language, say x86 machine code, or JavaScript, or C. See also [[303: Compiling]]. | ||
− | + | :Modern compilers typically not only translate one language into another, but in the process verify that the input program is a legal example of the programming language in question; a C++ to C compiler should not take an illegal C++ program and produce an illegal C program; rather, it should inform the user that the input was incorrect. One of the ways in which programs are determines to be incorrect is through an analysis of how the different parts of the program depend on each other. | |
− | |||
− | |||
− | |||
− | |||
− | + | :For example, one portion of a program might be responsible for representing a person. Another portion of the program might be responsible for representing the fact "employees are a kind of person", and yet another might be responsible for "managers are a kind of employee". The compiler could reason that the employee code depends directly on the person code. It could also reason that the manager code depends directly on the employee code. It could then conclude logically that the manager code depends indirectly on the person code. | |
− | : | + | |
− | : | + | :Many programming languages require that these sorts of dependencies be free of cycles. It would be an error in many programming languages to say, for instance, that a manager is a kind of employee, an employee is a kind of person, and a person is a kind of manager, because a diagram of the dependencies would contain a loop. A developer who is writing a compiler must therefore understand first how to identify dependencies in a program, and second, how to determine whether a particular set of dependencies is legal or illegal. |
+ | |||
+ | :There are numerous other problems in compiler construction which require understanding dependencies. For example, suppose a program must make two lengthy computations, call them X and Y, and then sum the result. Clearly the final sum X + Y cannot be computed until both X and Y are computed; the sum depends on X and Y. If the computation to produce Y does not depend on the result of computation X, then Y can be computed before X. If the computation to produce X also does not depend on the result of Y, then X may be computed before Y. If both X and Y are independent of each other then the compiler is free to choose whichever ordering it believes to be most efficient. By analyzing dependencies between different computations the compiler can ensure that the translated form of the program is both correct and efficient. | ||
+ | |||
+ | :Solving dependency management problems is also necessary in many areas of programming other than compiler design, such as package management, discussed below. | ||
− | : | + | :On college campuses, course names indicate the department and level of a course. CPSC would be one way to express Computer Science classes. The first digit is usually corresponds to the number of years that an undergraduate student has been studying; a 400-level course would be aimed at students in their fourth year of study. |
− | : | + | :The comic envisions a college computer science course (CPSC432) focusing on dependency resolution which has itself as a prerequisite. That is, you must complete this course before you can enroll in it, which is clearly impossible. This is analogous to the sort of problem that the dependency analyzer in a modern compiler must notice and inform the user about. Ironically, the cyclic dependency here is the easiest one to spot: the cycle where a thing depends directly on itself. |
− | : | ||
− | + | ;Title Text | |
− | : | + | :{{w|Package management}} is a problem in software deployment similar to compiler dependency resolution, except that the dependencies are collections of files known as "packages". For example, a software package might require that a particular operating system security patch be already installed. That patch might in turn require other packages be installed, and so on. A package installer must know the dependencies of a package and be able to figure out whether any required packages are missing before continuing with the installation. |
− | : | + | :The title text posits a course on package management which is dependent not only on itself (a cyclic dependency), but also on the course presented in the main comic, which has a higher course number. A dependency from a 300-level course to a 400-level course is very unusual because it implies that in order to take a third-year course, you must already have completed a fourth-year course. |
− | |||
− | : | + | :glibc is a commonly-used package on Unix systems. Its inclusion as a course prerequisite blurs the line between the course material and the course itself. |
− | |||
− | : | + | ==Transcript== |
+ | :A portion of a page from an imaginary course catalog. | ||
− | + | :Page 3 | |
− | + | :[A table with four columns labeled Department, Course, Description, and Prereqs. Under 'Department' it reads, "computer science". Under 'course' it reads, "CPSC 432". Under 'Description' it reads, "Intermediate compiler design, with a focus on dependency resolution." Under 'Prereqs' it reads, "CPSC 432".] | |
{{comic discussion}} | {{comic discussion}} | ||
[[Category:Programming]] | [[Category:Programming]] | ||
[[Category:Recursion]] | [[Category:Recursion]] |