revising Flashcards

(64 cards)

1
Q

spring-boot

A

java framework for web-app development

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

thread

A

a complete unit of execution in a process;
threads share code, resources, memory, runtime details, state of process…;

“like a process but within a process” ?

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

wrapper classes

A

a way to use data types as objects;
int myInt = 5 -> Integer myInt = 5;

use when working with arrays/iterables, since they can only store objects/instances not raws;

use when intializing something with the value “null” to avoid a compile error

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

JRE

A

java runtime environment;
runs on top of OS providing everything a program needs to run:
- classloader for required classes
- verifier to ensure code is accurate
- interpreter

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

JDK

A

java development kit; implements specification / provides software for working with Java applications

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

in a suitably complex system,

A

there is a certain irreducible number of errors; any attempt to fix observed errors results in the introduction of other errors

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

microservice architecture

A

an architectural style in which the system is constructed from communicating microservices; each microservice runs in its own container, usually in cloud based systems

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

AJAX

A

Asynchronous JavaScript and XML

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

react; single responsibility principle

A

react is commonly used in combination with HTML and CSS, but each language only serves one responsibility:

HTML for presenting information and structure;
CSS for style of information;
JavaScript for interactions/data

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

ECMA6 is dynamically typed;
variables can…
the interpreter…

A

Dynamically-typed languages are those (like JavaScript and most others) where
- variables can hold any type of value at any time,
- the interpreter assigns/checks types when code is executed, not during compilation

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

const

A

defines a constant reference to a value, not an unchanging value; use const to declare a new variable, array or function

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

hooks

A

functions that:
- add state to a function component (useState)
- run code at specific times (useEffect)

allow one to “hook into” react features from function components; allows one to use react without classes

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

architectural influences

A

nonfunctional product characteristics;
product lifetime;
software reuse;
number of users;
compatibility;

these all affect how the software is built

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

nonfunctional product characteristics

A

security, performance; things that are necessary for a good product, but not the focus of the product.

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

influence of software reuse

A

reusing large components from other products saves time and effort, but this constrains architectural choices: design must fit around the software that is being used

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

influence of number of users

A

performance will be affected by the number of users at once; build a system that can be scaled easily

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

influence of software compatibility

A

allows users to adopt product on a different system; limits architectural choices such as database used

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

maintainability-performance tradeoff

A

a maintainable system is made of small parts that can be easily changed, but if many components are communicating with each other, the software will run slower

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

how to best design security

A
  • a series of layers so an attacker has to get through all of them before the system is penetrated;
  • implement as separate components so that if one is attacked the others remain;
  • use different technologies in different layers so it’s harder to breach each one
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

security vs usability

A
  • layered security means users have to remember information that would be used to protect their data, slowing down their interaction with the system;
  • it’s best to use an architecture that doesn’t enforce unnecessary measures
  • use architecture that provides helper components that reduce the load on users
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

redundancy

A

components detect failure -> switch the operation to another component when failure is expected (circuit breakers are a good example);
implementing redundancy increases time and cost of development and adds complexity, possibly introducing bugs

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

architectural design questions

A

how should the system be organized?; how should components be distributed and communicate with each other?; what technologies should you use in building the system and what components should be reused?

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

design guidelines / best practices

A

single responsibility for each component;
coherent interfaces that change rarely;
avoid duplicating functionality

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

abstraction

A

focus on essential elements of a system or component without concern for details;
reduce complexity (of system / UI) so you can
- isolate changes
- improve maintainability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
decomposition
analyzing large-scale components and representing them as finer components*; localizing relationships into the same module, reducing shared dependencies and using local data when possible
26
layers of functionality (UAABD/T)
UI (HTML to collect input, JavaScript for actions); Authentication; Application-specific functionality; basic shared services, database + transaction management
27
Authentication + UI management layer
includes components for user authentication and web page generation
28
base shared service layer
this layer establishes services used by the application layer
29
database and transaction layer
provides services such as transaction management and recovery; may not be required if the application doesn't use a database
30
architectural design principles - what should programmers keep in mind?
REAPM replaceability, extensibility, age-appropriate, programmability, minimum work
31
replaceability
the list of applications shouldn't be hard-wired into the system; users should be able to replace applications in the system with alternatives; users can mod your system
32
extensibility
users + system admin should be able to create their own versions of the system
33
programmability
it should be easy to make one's own applications by linking existing applications in the system; similar to extensibility
34
services
stateless components -> can be replicated and migrate from one computer to another or accessed through the internet; service-oriented architecture is easier to scale and is resilient to failure
35
what is a thread
a path through a running program; independent path through a process; assigned path by the OS
36
circuit breaker
typically in microservices, can be in servers; if a service stops working, the circuit breaker overrides efforts to call that service again and instantly returns errors. after a cooldown time, the breaker allows a few test requests to see if the service is working again. repeat until it passes the test requests.
37
SOLID: L
Liskov's principle: subclasses should replace classes without breaking the program
38
SOLID: I
Interface segregation; each interface should only have one responsibility
39
SOLID: D
dependency inversion principle; high level and low level modules should depend on abstractions; details should depend on abstractions, not the other way around
40
spring-boot
a server system / framework; built on maven or another project manager, generally done in java;
41
maven
build system for software/servers
42
tomcat
heavy-use web server for running java applications
43
thymeleaf
template engine for HTML; has its own namespace + sublanguage of HTML
44
declarative language
state what the result should be, not how it should be reached
45
imperative language
must state steps to clarify how one wants something achieved
46
functional testing
test the program on a larger scale than unit tests; tests the entire system
47
privacy
keeps personal data from being seen by unauthorized parties
48
availability threats
an attacker attempts to deny access to the system for legitimate users
49
pros of dynamically typed programs
faster, flexible
50
cons of dynamically typed programs
errors occur at runtime; harder to maintain large codebases; slower performance
51
useState
adds state to a function component
52
useEffect
run code at specific times
53
switching between asynchronous tasks
import asyncio async def my.task(n): > print(f"my.task: starting{n}") > await asyncio.sleep(n) # non-blocking delay sync def sequential_main( ) : > await my task ( 3 ) > await my task ( 1 ) async def gather_main( ) : > await asyncio.gather( my_task ( 3 ) , my_task ( 1 ) ) -- - import asyncio - async is a keyword for this function telling it to wait for other tasks to run for n seconds - "await" to run both tasks in order, wait for each to finish before moving on - call several tasks at once, not synchronous
54
await asyncio.sleep(n) is what?
non-blocking delay; run something else, then check if this finished execution
55
declarative react example: return JSX display
import { useState } from "react"; export default function App() { const [count, setCount] = useState(0); return ( >
> {count > 5 ? Yeah! : Click away...}
>
); } -- - import useState hook - define App, which can be exported from the file to move elsewhere - const [count, setCount] = useState(0); - return JSX display
56
ES6 class, model of car
class Model extends Car { constructor(name, mod) { super(name); this.model = mod; } show() { return this.present() + ', it is a ' + this.model } } const mycar = new Model("Ford", "Model T"); mycar.show(); -- - class Model extends Car - constructor with all args needed - super; get name from extending Car class - this.model for instance of class Model - define and call show()
57
find element with the id root, store in the variable “container”
const container = document.getElementById(‘root’);
58
implement runnable
public class MyRunnable implements Runnable { @Override public void run() { System.out.println("Thread is running..."); } public static void main(String[] args) { Thread thread = new Thread(new MyRunnable()); thread.start(); // starts the new thread } } -- - public class myrunnable implements the built-in interface runnable - override run method, output message - public static void main(String[] args) - Thread thread to instantiate new thread - thread.start to begin executing a new thread
59
extend thread
class MyThread extends Thread{ @Override public void run(){ System.out.println("Thread is running"); } } public class Main { public static void main(String[] args){ MyThread t1 = new MyThread(); MyThread t2 = new MyThread(); t1.start(); t2.start(); } } -- - MyThread extends the class Thread - extend (public void) run() to execute a message when it runs - create thread objects in Main class main(String[] args) - run() or t.start();
60
value of container (root) becomes React object in DOM
const root = ReactDOM.createRoot(container);
61
render the root React object
root.render(

Hello

);
62
imperative javascript
for (let i = 0; i < numbers.length; i++) { if (numbers[i] > 10) { result.push(numbers[i]); } } -- tells the system how to do something step by step
63
functional test
class LoginFunctionalTest { private WebDriver driver; @BeforeEach void setUp() { driver = new ChromeDriver(); driver.get("https://example.com/login"); } @Test void testLoginSuccess() { WebElement usernameField = driver.findElement(By.id("username")); WebElement passwordField = driver.findElement(By.id("password")); WebElement loginButton = driver.findElement(By.id("login-btn")); usernameField.sendKeys("user1"); passwordField.sendKeys("secret123"); loginButton.click(); WebElement welcomeMessage = driver.findElement(By.id("welcome")); Assertions.assertTrue(welcomeMessage.isDisplayed()); }
64
unit test
class CalculatorTest { @Test void testAdd() { Calculator calc = new Calculator(); int result = calc.add(2, 3); assertEquals(expectedresult, result); } }