여러 프로젝트를 진행하면서, 내가 왜 Typescript를 쓸까? Typescript를 쓰면서 얻게 되는 이점은 이런거였구나.. 등 많은 생각을 했다

내가 제일 크게 느꼈던 Typescript의 장점은..

일반적으로 말하는 타입스크립트의 장점을 떠나서, 백엔드의 DTO(Data Transfer Objects)를 type으로 정의해두면 정말 편리했다.

1. 백엔드로 부터 받는 데이터 구조를 type으로 정의하면 프론트에서 데이터를 처리할 때 발생할 수 있는 타입 관련 오류를 방지할 수 있었다.

  • 예를 들면, price이 string인지 number인지에 따른 오류를 사전 방지할 수 있음..!

2. 백엔드에서 데이터 구조에 변경 사항이 있을때, 쉽게 반영할 수 있어 편리했다.

그리고 자동 완성 이것도 정말.. Typescript를 놓을 수 없는 이유 중에 하나다.
type을 정의해 놓아서 변수나 함수 입력할 때 자동 완성되는 게 좋다. 오타도 줄일 수 있고..

일반적인 내용

Typescript의 특징

1. 컴파일 언어, 정적 타입 언어

  • 자바스크립트는 동적 타입의 인터프리터 언어로 런타임에서 오류를 발견할 수 있
  • 타입스크립트는 정적 타입의 컴파일 언어이며 타입스크립트 컴파일러 또는 바벨(Babel)을 통해 자바스크립트 코드로 변환됨
  • 오류를 코드 작성 단계에서 발견할 수 있으며, 실행 속도가 빠르지만, 타입을 지정해야 하는 번거로움과 컴파일 시간이 필요

2. 자바스크립트 슈퍼셋(Superset)

  • 타입스크립트 : 자바스크립트 기본 문법에 타입스크립트의 문법을 추가한 언어
  • 자바스크립트에 추가된 문법을 포함하는 언어로, 유효한 자바스크립트 코드는 타입스크립트로 변환 가능

3. 객체 지향 프로그래밍 지원

  • ES6(ECMAScript 6)에서 새롭게 사용된 문법을 포함
  • 클래스, 인터페이스, 상속, 모듈 등의 객체 지향 프로그래밍 패턴을 제공

Typescript 장점

1. 오류를 잡아내기 쉬움

  • 컴파일 과정에서 오류를 발견하기 때문에, 런타임 전에 문제점을 잡아낼 수 있음
  • 자바스크립트는 실행 시점에서만 오류를 발견

2. 협업에 도움이 됨

  • 코드의 가독성 : 타입 지정은 주석처럼 작동하여, 다른 개발자들이 코드를 쉽게 이해하고 파악할 수 있게 도와줌

3. 자바스크립트 호환

  • 자바스크립트와 100% 호환됨
  • 프론트엔드 및 백엔드에서 자바스크립트를 사용하는 모든 곳에서 사용 가능

'Project' 카테고리의 다른 글

[SSS refactoring] plan  (0) 2023.12.10
[Cryptography Project] DES 구현 (Java)  (0) 2020.11.13
[C++] A vending machine controller  (0) 2020.07.12

DES 개념과 동작 과정

bskwak.tistory.com/177

 

[Crytography] DES란?

DES(Data Encryption Stadard) - Block cipher plaintext를 64bit의 block으로 나눠 56bit의 key를 이용해 다시 64bit의 ciphertext를 만들어내는 알고리즘 - Symmetric cipher 암호문을 작성할 때 사용하는 암호..

bskwak.tistory.com

 

내가 작성한 코드

class를 크게 세가지로 만들었다.

createKey : key를 생성하는 class

Encrypt : plaintext를 encrypt하는 class

DesMain : main함수를 포함하는 class

 

 

코드는 깃허브 참고

https://github.com/bosunKwak/OOP/tree/main/JAVA/DES%20implementation

 

bosunKwak/OOP

Contribute to bosunKwak/OOP development by creating an account on GitHub.

github.com

 

'Project' 카테고리의 다른 글

내가 Typescript를 쓰는 이유  (0) 2024.01.12
[SSS refactoring] plan  (0) 2023.12.10
[C++] A vending machine controller  (0) 2020.07.12

BASIC REQUIREMENTS

 

1. Input:

 1) Coin: 10,50,100, but other coins can be possible.

 2) Selection of items~ beverages, coffees, anything is possible.

 

2. Output:

 1) List of the items with selectable number

 2) When you select the items, a short introduction can be displayed

 3) The current sum of the inserted coins

 4) When you select an item, out the item from a list of items.

 

3. Functions:

 1) It gets coins and sells the items.

 2) It is possible to sell the items until the coin balance is greater than the price of the lowest-priced item

     As a matter of course, the customer can cancel the transaction and get the rest of the coins back.

 3) Every time when it sells the items, it sends a state of current storage to its owner.

 4) If the number of items in the item list is less than a certain value, it sends order to get additional items from the management center.

 5) If the center sends the additional items, it will add the items to the item list.

 

4. Select items you favor and complete the requirements with your additional functionality (optional).

 

 

코드

https://github.com/bosunKwak/OOP/tree/main/C%2B%2B/vendingmachine

 

bosunKwak/OOP

Contribute to bosunKwak/OOP development by creating an account on GitHub.

github.com

 

 

'Project' 카테고리의 다른 글

내가 Typescript를 쓰는 이유  (0) 2024.01.12
[SSS refactoring] plan  (0) 2023.12.10
[Cryptography Project] DES 구현 (Java)  (0) 2020.11.13

+ Recent posts