1 / 24

CSC 2400: Computer Systems

Explore the key design goals of C and Java programming languages, their implications, and differences, with a focus on safety, security, efficiency, and flexibility. Discover how these languages approach memory management, portability, and security.

schofield
Download Presentation

CSC 2400: Computer Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 2400: Computer Systems Week 1 – C versus Java

  2. Reminders • Sign up for ZyBook – VILLANOVACSC2400RobsonFall2019 • HW 1 – Due a week from todayhttp://www.csc.villanova.edu/~mprobson/courses/csc2400/hw1.html • Sign up for Piazza (23/42) - https://piazza.com/villanova/fall2019/csc2400

  3. CSC 2400-001 Survey Statistics • Familiar with Unix • 1yes, 18 no • Familiar with C • 2yes, 17 no (barely) • Familiar with C++ • 3 yes (sorta), 16 no (barely) • Compute the sum of all integers from 1 to 100 • 18 yes, 1 no • Binary to decimal • 7yes, 12 no

  4. CSC 2400-002 Survey Statistics • Familiar with Unix • 2yes, 21 no • Familiar with C • 2 yes (somewhat), 21 no • Familiar with C++ • 8 yes (mix), 15 no • Compute the sum of all integers from 1 to 100 • 20 yes, 3 no (maybe) • Binary to decimal • 7 yes (maybe), 16 no (IDK, probably not)

  5. Hierarchy of Computer Languages Source: https://thebittheories.com/levels-of-programming-languages-b6a38a68c0f2

  6. C vs. Java: Design Goals • Java design goals • Support object-oriented programming • Allow same program to be executed on multiple operating systems • Support using computer networks • Execute code from remote sources securely • Adopt the good parts of other languages (esp. C and C++) • Implications for Java • Good for application-level programming • High-level • Virtual machine insulates programmer from underlying assembly language, machine language, hardware • Portability over efficiency • Security over efficiency • Security over flexibility

  7. C vs. Java: Design Goals • C design goals • Support structured programming • Support development of the Unix OS and Unix tools • As Unix became popular, so did C • Implications for C • Good for system-level programming • But often used for application-level programming – sometimes inappropriately • Low-level • Close to assembly language; close to machine language; close to hardware • Efficiency over portability • Efficiency over security • Flexibility over security

  8. C vs. Java: Design Goals • Differences in design goals explain many differences between the languages • C’s design goal explains many of its eccentricities • We’ll see examples throughout the course

  9. C vs. Java: Overview (cont.) • Bad things you can do in C that you can’t do in Java • Shoot yourself in the foot (safety) • Shoot others in the foot (security) • Ignore wounds (error handling) • Dangerous things you must do in C that you don’t in Java • Explicitly manage memory via malloc() and free() • Good things you can do in C, but (more or less) must do in Java • Program using the objected-oriented style • Good things that you can’t do in C but can do in Java • Write completely portable code

  10. C vs. Java

  11. C vs. Java (cont.)

  12. C vs. Java (cont.)

  13. C vs. Java Example

  14. C vs. Java (cont.)

  15. C vs. Java Example

  16. C vs. Java (cont.)

  17. Source: https://www.xkcd.com/292/

  18. C vs. Java Example

  19. C vs. Java (cont.)

  20. C vs. Java Example

  21. C vs. Java (cont.)

  22. C vs. Java Features • Java • Object-oriented • Portable • Secure • C • Efficient • Flexible • Lower level (closer to the system)

More Related