구분 | 요구분석 | 설계 |
---|---|---|
산출물 | 요구분석명세서 | 설계서 |
관점 | what | how |
특성 | 개념적, 추상적 | 사용 환경을 반영해 구체적 |
비교 | 플랫폼(운영체제, 프레임워크 등)을 고려하지 않음 | 비기능 요구사항, 제약사항, 플랫폼 고려 |
const printSumResult = () => {
const result = GetSum(10);
console.log(`1-10의 합: ${result}`)
}
const getSum(num: number) => {
let sum = 0;
for(let i = 1; i <= num; i++) {
sum += i;
}
return sum;
}
section .data
msg db "Hello World"
section .text
global_start
_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 12
syscall
mov rax, 60
mov rdi, 0
syscall
c언어
#include <stdio.h>
int main() {
printf("Hello World!");
}
python
print('Hello, world!')
typescript
class Stack<T> {
private size: number;
private data: T[] = [];
constructor(num: number) {
this.size = num >= 1 ? Math.floor(num) : 1
}
getMaxSize () {
return this.size;
}
getCurrentSize () {
return this.data.length;
}
push (item:T) {
if (this.data.length < this.size) {
this.data.push(item);
} else {
throw console.log("full stack");
}
}
pop() {
if (this.data.length !== 0) {
return this.data.pop();
} else {
throw console.log("empty stack");
}
}
}
class NameStack<T> extends Stack<T>{
private name: string;
constructor(num: number, name: string) {
super(num);
this.name = name;
}
getName () {
return this.name;
}
}
interface Coordinate {
x: number;
y: number;
}
function parseCoordinate(obj: Coordinate): Coordinate;
function parseCoordinate(x: number, y: number): Coordinate;
function parseCoordinate(arg1: unknown, arg2?: unknown): Coordinate {
let coord: Coordinate = {
x: 0,
y: 0,
}
if (typeof arg1 === 'object') {
coord = {
...(arg1 as Coordinate)
}
} else {
coord = {
x: arg1 as number,
y: arg2 as number,
}
}
return coord;
}
/* 리스코프 교체 원칙 미준수
abstract class Instructor {
constructor() {}
getMoney(time:number) {
return 120000 * time;
}
}
*/
// 리스코프 교체 원칙 준수
abstract class Instructor {
getMoney(price:number, time:number): number {
return price * time;
};
}
class InstructorOne extends Instructor {
getMoney(time:number) {
return 90000 * time;
}
}
출처:
쉽게 배우는 소프트웨어 공학 2판, 김치수, 한빛아카데미