Presentation is loading. Please wait.

Presentation is loading. Please wait.

Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”

Similar presentations


Presentation on theme: "Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”"— Presentation transcript:

1 Source Code Basics

2 Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code” Collection of these is what a program “binary” is

3 Op Codes

4 Punch Cards

5 But…

6 Machine Code Punch-card like instructions still used today – Called machine code, or (technically incorrect) assembly language Now we convert human-readable instructions into this What a program “binary” is. What companies sell and is too complex to figure out how it works exactly… but sometimes….

7 Source Enter 2 nd generation programming languages – First (most significantly) C – C++ – Java More for humans – using English words

8 C++ and Java

9 JVM Sometimes called the Java Runtime Environment (JRE) The java program is the JVM/JRE Is why Java is secure (checks and controls java code, isolates it) and portable (java code just needs to worry about the JVM)

10 Languages: C++ C++ Pro: Fast! Con: Have to worry about so many details, complex -> slow to implement (just like machine code)

11 Languages: Java Java Pro: Worry about less (e.g. memory), fully object oriented (more in line with real world), less machine oriented Con: Slow (mostly) run speed, very slow load speed

12 Languages: 4 th Generation Ruby, Swift, Python, Shell Pros: Worry about even less, more human centric (even like natural language), higher programmer efficiency Cons: Even slower (but computers are getting faster), loss of control over some things (like memory)

13 4 th Generation Non-compiled Java and C# is halfway (still compile for the interpreter) Likely to dominate most programming as computers speed up and problems get more complex Interpreter is like the JVM, each language needs one (ruby, python, sh) Bad for learning… hide too many fundamentals

14 The Point Never have a general argument about which language is “better” Always pros and cons. There are tradeoffs Only which language is best for the given problem or project

15 Java Source Java enforces rules: Every source code file must be.java Every file must have a matching class definition with exact same name (case sensitive!) Brackets {} groups “blocks” of code All normal code must belong to a class

16 Example Java


Download ppt "Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”"

Similar presentations


Ads by Google