General Coding Flashcards

1
Q

Statically Typed Languages

A

The type of variable is known at compile time.

  • You must declare the type of each variable explicitly and the type info is checked during compilation

Ex: Java, C++, C#, Swift, Rust, Go

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Pros: Static Typed Languages

A
  • Type checking: reduces runtime errors and improves code reliability
  • Performance: Leads to optimizations during compilation
  • Clarity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Dynamically Typed Languages

A

The type of variable is determined at runtime.

  • You don’t need to declare types explicitly. The language inverse the type based on value assigned

Ex: Python, JS, Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Pros: Dynamic Typed Languages

A
  • Flexibility: variable types can at runtime
  • Less boilerplate
  • Ease of use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Weakly Typed Languages

A

More flexible approach to type conversions, often performing implicit conversions between types

Languages: JS, PHP

Ex: implicit conversion of number to string

Let number = 10
let text = “the number is “ + number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Compile Time

A

A programs source code is translated into machine code/executable code

  • Before the program is executed

Compiler checks for
1. Syntax and type checking which must be resolved before the program can run
2. Optimization
3. Code generation (executable code or byte code from the source code which is then ready to be executed by computer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Runtime

A

When a compiled program is actually executed by the computer

  • When a programs code is run and the program interacts with user

Key Characteristics
1. Programs instructions are executed by the CPU
2. Dynamic behavior occurs like memory allocation, dynamic typing, user input handling. Errors not caught at compile time are found here

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Source file

A

Contains human readable code written in a programming language

  • The starting point for creating executable programs or other outputs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

when to source your env

A

When you want to load environment variables from it into your current shell session before running your application

  • Node js projects usually use dotenv package which automatically loads in variables from env file
  • Go Projects usually require manually sourcing the .env file or using a package like godotenv to load environment variables.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Node.js

A

a JS runtime built on Chromes V8 JS engine

  • allows devs to run JS code on the server side (outside of a web browser)
  • Known for its nonblocking event driven architecture
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Key features of Node.js

A
  • Async and event driven: uses an event driven model which makes it lightweight and efficient. Useful for building real time applications that require high throughput
  • Single threaded: handles multiple connections concurrently. This avoids the overhead of creating multiple threads for each connection
  • NPM: comes with this
  • Cross platform: can run on various operating systems like windows, macOS and linux
  • Built in modules: provides rich set of built in modules for performing common tasks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

NPM

A

Largest ecosystem of open source libraries and packages

  • allows for devs to easily manage and share reusable code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Chromes V8 JS Engine

A

An open source JS engine developed by Google

  • Is used in the chrome web browser to execute JS code
  • Compiles JS directly to native machine code which makes it very fast
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How Node.js works

A

JS execution
- node.js uses the V8 engine to execute JS code. The V8 engine then compiles JS to machine code which is then executed by the computers processor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Client side Javascript

A

Environment: Runs in the Web browser

Use cases:
- user interface interactions like manipulating the DOM
- Event handling
- Form validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Server side Javascript

A

Environment: Runs in Node.js

Use cases:
-HTTP web servers to handle client requests and serve responses
- APIs
- Background tasks