기초가 중요하지 않을까요?
스프링은 다음과 같은 기술들의 집약이다.
- 서비스 지향 구조(Service Oriented Architecture)
- 컴포넌트 기반 개발(Component Based Development)
- 객체 지향 프로그래밍(Object Oriented Programming)
- 절자 지향 프로그래밍(Procedure Programming)
- 기계어/어셈블리어
스프링을 이해하려면 스프링 그 이전의 기술들이 뭔지는 알아야 할 것이다. 이번 챕터에서는 스프링 이전의 기술들을 훑어보게 될 것이다.
기계어
컴퓨터는 사실 0과 1밖에 다루지 못한다. 초기의 컴퓨터가 이해할 수 있는 언어는 기계어 뿐이었다. 기계어는 동작하는 컴퓨터에 따라 형식이 달라서 동작하는 컴퓨터에 맞는 형식으로 작성해야하고 인간이 작성하기엔 비인간적인 형식이다. 기계어도 외우면 어느정도 코딩할 수 있겠지만... 난 아직도 기계어로 코딩하는 세상이었으면, 개발자는 꿈도 안꿨을듯?
어셈블리어
어셈블리어는 조금 더 인간 친화적인 언어이다. 기계어를 일대일로 매핑하여 인간이 이해하기 쉬운 단어로 만든 것이다.
기계어 010101을 어셈블리어 ADD로 매칭하여 인간은 좀 더 외우기 편한 코드를 작성할 수 있게되었다.
하지만 여전히 컴퓨터는 기계어로 밖에 동작을 못하기 때문에 어셈블리 코드를 기계어로 변환해주어야 하는데, 이러한 역할을 수행하는 소프트웨어를 어셈블러(Assembler)라고 한다.
또한, 다른 종류의 컴퓨터와는 상호호환이 안되어서 각자 다른 어셈블리어로 코딩해야한다.
C 언어
기계어와 어셈블리어의 문제점에는 복잡한 코드도 있지만 그것보다는 타 아키텍쳐와의 호환성이 가장 큰 문제이다.
C 언어는 다음과 같은 원칙으로 설계되었다.
- One Source: 하나의 C 소스 파일만 작성
- Multi Object: 기종마다 하나씩 기계어 목적 파일을 생성
- Use Anywhere: 모든 컴퓨터에서 실행 가능
// C Source File
int main(){
int a = 1 + 3;
return 0;
}
위와 같은 C 언어 소스 코드와 컴파일러만 있으면 어떤 종류의 컴퓨터에서도 프로그램을 동작시킬 수 있다.
는 사실 이상향이었고, 운영체제마다 조금씩 다른 C 언어에 대한 정책 때문에 같은 코드로 모든 컴퓨터에서 동일한 동작을 바라기에는 문제가 있다. 그래서, 조금씩 다른 운영체제에 맞게 수정이 필요하다.
C++
드디어 이 시리즈에서 중점으로 학습하고자 하는 객체 지향이 등장했다. C++는 C 언어에 객체 지향 개념을 도입한 언어이다. 객체 지향에 대한 내용은 후에 연재될 챕터에서 진행하자.
JAVA
자바는 진정한 의미의 객체 지향 언어이다. C++에서 객체 지향 개념이 도입되었지만, C++은 객체가 없이도 프로그램을 만들 수 있다.
// C++ Source File
int main(){
a = 1 + 3;
return 0;
}
해당 코드는 굉장히 간단한 C++ 프로그램이다. 그리고 객체는 사용하지도 않았다. 이렇기에 C++를 진정한 객체 지향 언어라고 하지 않는 것이다.
하지만, 자바가 갖는 진정한 의미는 이런 것이 아닌 가상 머신(Virtual Machine)에 있다. C 언어의 철학은 One Source Multi Object Use Anywhere였는데, 자바는 조금 변경되어 Write once Use Anywhere이다. 자바 소스 파일 하나가 자바 목적 파일로 컴파일되어 어떤 컴퓨터 환경에서도 JVM만 있으면 실행될 수 있다.
'Study > OOP with Java' 카테고리의 다른 글
[OOP with JAVA] 3. 메서드 스택 프레임 (0) | 2023.07.30 |
---|