Lecture Notes in Computer Science- P43 potx

5 205 0
Lecture Notes in Computer Science- P43 potx

Đang tải... (xem toàn văn)

Thông tin tài liệu

Virtual Education System for the C Programming Language 199 Most lecturers have felt that there were difficulties in teaching concepts of com- puter programming. For example, it is difficult for students to comprehend the over- flow and underflow concepts. Thus, we hope that Flash animations will help students understand concepts. The Flash animation in Fig. 3 shows when an overflow occurs. Learners can easily grasp the concept of overflow for an integer type variable. Fig. 2. An HTML page for lecture notes Fig. 3. Flash animation for explanation of the overflow concept 200 I. Moon et al. More interactive content made by Java Applets are provided. Learners can enter proper values into the Applet and observe which results are returned. The printf func- tion writes formatted output to standard_out (stdout). There are many cursor control sequences and conversion characters for the printf command. The learner needs to comprehend the effects of control character usage. Therefore we implemented a Java Applet for printf. The Applet for the printf function in Fig. 4 waits for 3 values of integer-type variable a, double-type variable b, a character-type variable and a format for printout, which learners can select from a list box, shown in Fig. 5, or enter their own into the output format text box. Using this Applet, learners can very easily ob- serve the relation between print formats and printout results, which give learners dif- ferent types of experiences about print formats. Fig. 4. Applet for the printf function Fig. 5. List box for format selection Fig. 6 is an applet for an iterative statement ( while, do-while , for, nested for , break, continue ). After students choose a panel in a Top-down panel, and insert a value in a user input textbox, they can confirm the result of the program for the cho- sen value. Virtual Education System for the C Programming Language 201 Fig. 6. Interactive statement applet A pointer is a variable that contains the address of another variable. Since a pointer contains the address of an object, it is possible to access the object indirectly through the pointer. Pointers are so commonly used as references in general, partly because they are sometimes the only way to express a computation, and partly because they usually lead to more compact and efficient code than can be obtained by other means. However, it is difficult for students to understand the concept of a pointer. Therefore we implemented a pointer applet. Fig. 7 is an applet for comprehension of the con- cept of a pointer address. After students choose an item from a selection box and guess the result, they can in fact confirm the result. Fig. 7. Numeric calculation An animation or visualization for comprehension of the algorithm concept is the most efficient means to learn different types of algorithms. Sorting is one of the most peda- gogical exercises to introduce algorithms. Sorting refers to algorithms that take the items from the array and put them in order. The goal of the sort applet is to present students with a visual way to understand the means by which the most common algorithms work, 202 I. Moon et al. and how different approaches can yield different results under different conditions. We hope this java applet will help students understand the intricacies of sorting, and also popularize a visualization method as a pedagogical tool to teach algorithms. We imple- mented the following algorithms: bubble sort , selection sort, insertion sort, shell sort and quick sort. To test that the algorithms performed the sort correctly, a small data set was chosen and executed step by step. The Sort applet is composed of a source component and an animation pad component. The pads are filled with unordered numbers, as shown in figure 8 [15][16]. Learners select one of the different types of sorting algorithms shown in Fig. 9, in order to understand its principle. They can understand the sorting procedure systematically, through graphics. Learners effectively understand and analyze the advantages and disadvantages of each type of sorting algorithm. Fig. 8. Applet for understanding a sorting algorithm 2.2 Implementation of a Web-Based C Compiler Intranet Compilers Architecture; during software development it is important to jus- tify which components of the software should run on the client machine and which components should run on the server. Client side programs – Java Applets - are trans ferred through the network when requested and execution is performed entirely on the Fig. 9. Sorting method selection Virtual Education System for the C Programming Language 203 client machine that made the request. This enables sharing of the computational cost between the server and client. This approach can be used when programs to be trans- ferred to users are moderate in size, or are to be cached on the client machine, or the data is to be transferred between server and client, in case the application is run on the server, when it is very large. In the case of platform independent solutions, such as Java, lower computational performance may be prohibitive. Using CG,I much less information has to be passed to the server. The server executes instructions based on the given information and sends the results back to the local machine that made the request. This is used in the opposite cases, when the software package is large or must not be released to the user, or when the amount of data to be transferred is small. However, large number of clients that access the server simultaneously would make the CGI-based approach undesirable. Therefore, in order to solve this problem, we implemented a web-based C compiler. Our system for C programming uses none of the commercial software packages. This makes the system independent of the process of commercial software development, in which a particular version of the software might become obsolete very quickly. Our system uses a server side compiler in the LINUX environment, through the Internet, instead of using a desktop commercial compiler. Therefore not all students need purchase and install a commercial compiler on their PC in order to study the C Programming Language. They just connect to our system using a Java Applet and send their C language source code to the server side, then, the result of program execution will be be returned to them. The web-based C compiler shown in Fig. 10 is implemented by Java I/O Applet and GCC at the server- side. This system is providing a web-based compiler to make learning content to change program code directly and confirm it exactly. Utilization of the web-based compiler will be economically helpful to students who do not have a separate C com- piler. In Fig. 11, a Java I/O Applet receives program source code from the clients., In Fig. 12, it makes them a file and passes them for compilation via GCC In Figs. 13-14, GCC's execution result or error messages will be returned to the clients by the Java I/O Applet. Fig. 10. Functional diagram of a web-based compiler . 6. Interactive statement applet A pointer is a variable that contains the address of another variable. Since a pointer contains the address of an object, it is possible to access the object indirectly. as shown in figure 8 [15][16]. Learners select one of the different types of sorting algorithms shown in Fig. 9, in order to understand its principle. They can understand the sorting procedure. development, in which a particular version of the software might become obsolete very quickly. Our system uses a server side compiler in the LINUX environment, through the Internet, instead of using

Ngày đăng: 05/07/2014, 09:20

Tài liệu cùng người dùng

Tài liệu liên quan