Override VS Overload
Overriding
상속에서 나온 개념
부모 클래스의 메소드를 하위 클래스에서 재정의 하는 것
Overloading
같은 이름의 메소드를 여러개 정의하는 것
매개 변수의 타입이 다르거나 갯수가 달라야 한다.
리턴 타입과 접근 제어자는 영향을 주지 않는다.
다형성
하나의 메소드나 클래스가 있을 때 이것들이 다양한 방법으로 동작하는 것을 말한다.
취미의 연장선으로 필요한 컴퓨터로 하는 모든 이야기
상속에서 나온 개념
부모 클래스의 메소드를 하위 클래스에서 재정의 하는 것
같은 이름의 메소드를 여러개 정의하는 것
매개 변수의 타입이 다르거나 갯수가 달라야 한다.
리턴 타입과 접근 제어자는 영향을 주지 않는다.
하나의 메소드나 클래스가 있을 때 이것들이 다양한 방법으로 동작하는 것을 말한다.
노드로 이어진 자료 구조
국제표준화 기구에서 개발한 모듈.
이론적으로 네트워크의 역할을 계층별로 나눠서 설명하는 것
상위계층에서 온 데이터에 헤더와 트레일러를 씌워 캡슐화를 하는데, 헤더에는 주로 송신자와 수신자, 트레일러에는 주로 오류검출을 위한 데이터를 씌운다.
|Layer|Data|Layer|Desc|Desc2|
|7|Data|Application|Network Process to Application|사용자가 편리하게 사용할 수 있는 UI 제공|
|6|Data|Presentation|Data representation and Encryption|어플리케이션 별로 이해 가능한 포맷으로 데이터를 변환해주며, 데이터 암호화, 복호화 압축등의 기능도 제공|
|5|Data|Session|Interhost communication|양 끝단의 응용프로세스가 통신을 관리하기 위한 방법을 제공한다|
|4|Segment|Transport|End-to-End Connection and Reliability|서비스를 구분하고 데이터의 전송을 담당하는 계층. 상위계층에서 넘어온 데이터를 안전하게 전송하도록 제어기능을 제공하고, 수신한 데이터를 정확한 어플리케이션으로 전달하는 역할|
|Layer|Data|Layer|Desc|Desc2|
|3|Packet|Network|Path Determination and IP (Logical Addressing)|논리적 주소를 기반으로 데이터 전송 경로를 결정하는 계층. 통신이 가능한 물리적인 구역을 논리적으로 구분시켜 식별하게 해줌. 경로를 결정하는 역할도 있다.|
|2|Frames|Data Link|Mac and LLC (Physical addressing)|물리적으로 구성된 네트워크 환경이며, 통신 프로토콜을 지원해주는 계층|
|1|Bits|Physical|Media, Signal and Binary Transmission|데이터링크 계층에서 받는 bit열을 전기신호(0, 1)로 전송하는 역할|
우선 순위 큐(데이터들은 우선순위를 가지고 있고, 높은 우선순위가 먼저 나간다.)를 위하여 만들어진 자료구조
배열, 연결리스트, 힙을 이용하여 힙을 구현할 수 있다.
네트워크 트래필 제어
운영체제 작업 스캐줄링
한동한 세상 돌아가는 일에서 멀어진거 같다는 생각이 들었다. CS CS 뭐 이러길래 CS가 뭐냐고 물었더니
CS (Computer Science)라고 한다고 한다. 그래서 검색을 해봤더니 컴공에서 배우는 커리큘럼이라고 한다는데.. 다들 그렇게 쓰는데, 나만 모른다면 안되자나.
암튼 프로그래머스로 뭔가 검증을 받을 일이 있었는데, 현타가 왔다. 툴에대한 이질감도 좀 들었고, 검색제한과 어시스턴스의 기능이 빠진곳에서의 현실자각이라고 할까...
앞으로 열흘간 기본부터 다시 한번 다지는 시간을 가져보려고 한다.
주소 | 메모리 | |
---|---|---|
~ | 스택 영역 | 컴파일타임 - 함수 호출과 관계되는 지역변수와 매개변수가 저장. 함수의 호출시 할당. 완료시 소멸 |
힙 영역 | 런타임 - 동적 할당(malloc) | |
데이터 영역 | 전역/정적 변수, 문자열 상수 저장 | |
0 | 코드 | 실행할 프로그램 코드(어셈블리) |
스택 영역은 메모리의 높은 주소에서 낮은 주소로 할당됨.
스택영역에 저장되는 함수의 호출 정보를 스택 프레임(stack frame)이라고 함
힙 영역은 메모리의 낮은 주소에서 높은 주소로 할당됨.
사용자에 의해 메모리 공간이 동적으로 할당되고 해제된다.
스택은 지역변수를 사용하고 소멸하기 때문에, 스택과 힙이 충돌하는 오버플로우 발생 가능성
설계 문제에 대한 해답을 문서화 하기 위해 고안된 형식 방법이다. 건축학에서 부터 발전하였다.
Gof(Gang of Four)라 불리는 네명의 컴퓨터 과학 연구자들이 쓴 서적 'Design Patterns: Elements of Reusable Object-Oriented Software('재이용이 가능한 객체지향 소프트웨어의 요소')'이다.
graph LR
A(Action)-->C(Controller)
C(Controller)-->V(View)
C(Controller)-->M(Model)
M(Model)-->V(View)
Model, View, Controller로 구성되어 있다.
Controller는 1:n으로 view와 연결됨
Controller는 View를 선택할 뿐 직접 업데이트는 하지 않는다? (View는 Controller를 알지 못함)
단순
View와 Model의 의존성이 높다.
graph LR
A(Action)-->V(View)
P(Presenter)-->V(View)
V(View)-->P(Presenter)
P(Presenter)-->M(Model)
M(Model)-->P(Presenter)
Model, View, Presenter로 구성되어 있다.
Presenter는 View에서 요청한 정보로 Model을 가공하여 View에게 전달해 준다.
Presenter는 View와 1:1 관계이다.
graph LR
A(Action)-->V(View)
V(View)-->VM(View Model)
VM(View Model)-->M(Model)
M(Model)-->VM(View Model)
Model, View, View Model로 구성되어 있다.
View Model은 View를 표현하기 위해 만든 View를 위한 Model이다.
MVVM패턴은 Command 패턴과 Data Binding 두가지 패턴을 사용하여 구현되었다.
ViewModel과 View는 1:n 관계이다.
노마더코딩 리액트 기초배우기
ReactJS를 보다가 여기까지 흘러들어왔다.
Create React App
흘러 들어온김에 좋은 기술하나 배워가보자. 쿨럭.
설치법은 간단하다
npx create-react-app my-app
cd my-app
npm start
이렇게 하면, 로컬페이지가 로드된다.
JSX는 리액트 컴포넌트를 만들때 사용되는 언어
아래와 같은 코드가 JSX라고 한다.
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
현재 위치: 리액트 기초 배우기 #5 ReactJS로 웹 서비스 만들기
내가 뭘하려다가 ReactJS까지 흘러왔는지 순간 까먹었다. 내가 하고 싶은건.. 아마존 NoSQL 사용이였는데 말이다... 쿨럭.
뭐 하는김에 제대로 하면 좋지. 취미생활코딩이니까...
오늘은 여기까지.
Process LifeCycle | UI LifeCycle |
---|---|
App Launched | Entered Foreground |
App Terminate | Became Active |
... | ... |
AppDelegate | SceneDelegate |
---|---|
Process LifeCycle | UI LifeCycle |
Scene LifeCycle | Entered Foreground |
Session Created | Became Active |
Session Discarded |
iOS12까지는 하나의 앱은 하나의 window로 구성되어 있었다.
iOS13부터는 window의 개념이 scene으로 변경되었으며, 하나의 앱은 여러개의 scene을 가질수 있게 되었다.
다시 말해 하나의 앱에서 여러개의 scene을 보여줄수 있게 되었다.
AppDelegate의 역할 중 UI의 상태를 알 수 있는 UILifeCycle에 대한 부분을 SceneDelegate가 하게 되었다.
[SceneDelegate] scene(_:, willConnectTo:, options:)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
scene이 앱에 추가될 때 호출. 단 여기서 ViewController와 같은 클래스 객체를 만들어 사용할 때, 아직 viewDidLoad()가 호출되지 않음
sceneDidDisconnect(_ 🙂
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
scene의 연결이 해제될 때 호출
sceneDidBecomeActive(_: )
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
app switcher에서 선택되는 등 scene과의 상호작용이 시작될 때 호출
sceneWillResignActive(_:)
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
print("[SceneDelegate] sceneWillResignActive(_ scene: UIScene)")
}
사용자가 scene과의 상호작용을 중지할 때 호출(다른 화면으로의 전환과 같은 경우)
sceneWillEnterForeground(_:)
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
print("[SceneDelegate] sceneWillEnterForeground(_ scene: UIScene)")
}
scene이 foreground로 진입할 때 호출
sceneDidEnterBackground(_:)
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
print("[SceneDelegate] sceneDidEnterBackground(_ scene: UIScene)")
}
scene이 background로 진입할 때 호출
AppDelegate에는 Session LifeCycle에 대한 역할이 추가되었다.
SceneSession은 앱에서 생성한 모든 scene의 정보를 관리한다.
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
UIKit은 UIWindowScene 객체를 사용하는 앱 UI의 각 인스턴스를 관리한다. Scene에는 UI의 하나의 인스턴스를 나타내는 windows와 view controllers가 들어있다. 또한, 각 scene에 해당하는 UIWindowSceneDelegate 객체를 가지고 있고, 이 객체는 UIKit과 앱 간의 상호작용을 조정하는데 사용된다.
Scene들은 같은 메모리와 앱 프로세스 공간을 공유하면서 서로 동시에 실행된다. 결과적으로 하나의 앱은 여러 Scene과 Scene delegate 객체를 동시에 활성화 할 수 있다.
(Scenes - Apple Development Document)
UISceneSession 객체는 Scene의 고유의 런타임 인스턴스를 관리한다. 사용자가 앱에 새로운 Scene을 추가하거나 요청하면, 시스템은 그 Scene을 추적하는 session 객체를 생성한다. 그 Session에는 고유한 식별자와 scene의 구성 세부사항(configuration details)가 들어있다.
UIKit은 session 정보를 그 Scene 자체의 생명주기동안 유지하고 app switcher에서 사용자가 그 Scene을 클로징하는 것에 대응하여 그 session을 파괴한다.
session 객체는 직접 생성하지 않고 UIKit이 앱의 사용자 인터페이스에 대응하여 생성한다.
또한, 아래 함수를 통해서 UIKit에 새로운 Scene과 Session을 프로그래밍적 방식으로 생성할 수 있다.
(UISceneSession - Apple Development Document)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>)
iOS12이하는 단일 window 환경임으로, 아래와 같이 Scene처리를 제거할 수 있다.
var window: UIWindow?