2020年秋学期 - オブジェクト指向プログラミング基礎 / FUNDAMENTALS OF OBJECT-ORIENTED PROGRAMMING
|
B4004 オブジェクト指向プログラミング基礎 FUNDAMENTALS OF OBJECT-ORIENTED PROGRAMMING |
特設科目 Special Seminars 2 単位 |
| 実施形態 | 完全オンライン |
| 開催日程 | 秋学期 木曜日5時限 |
| 担当教員 | 箕原 辰夫(ミノハラ タツオ) |
| 関連科目 |
前提科目(必須): B4001 前提科目(推奨): B6135,B4001,B4002 前提科目(関連): C2101,C2077,B6135,B4005,B4004 |
| 開講場所 | SFC |
| 授業形態 | 講義、実習・演習 |
| 履修者制限 |
履修人数を制限する Only the selected students can take this course. |
| 履修条件 |
Pythonの基礎的なプログラミング Basic ability of programming with Python 「情報基礎1」の単位を取得していること。プログラミングについて「情報基礎2」相当の知識があれば履修が可能だが、 You must have earned credits of "Fundamentals of Information Technology 1". If you have knowledge equivalent to "Fundamentals of Information Technology 2" about programming, you can take this course, otherwise it is strongly recommended to take "Fundamentals of Information Technology 2" beforehand. |
| 使用言語 | 日本語 |
| 連絡先 | minohara@sfc.keio.ac.jp |
| 授業ホームページ | http://web.sfc.keio.ac.jp/~minohara/lectureslide/swift/ |
| 同一科目 | |
| 学生が利用する予定機材/ソフト等 |
Xcode, Swift, BBEdit, MacBook Air/Pro Xcode, Swift, BBEdit, MacBook Air/Proなど |
| 設置学部・研究科 | 総合政策・環境情報学部 |
| 大学院プロジェクト名 | |
| 大学院プロジェクトサブメンバー | |
| ゲストスピーカーの人数 | 0 |
| 履修選抜・課題タイプ=テキスト登録可 | false |
| 履修選抜・選抜課題タイプ=ファイル登録可 | true |
| GIGAサティフィケート対象 | |
| 最終更新日 | 2020/09/23 13:31:32 |
科目概要
オブジェクト指向プログラミング言語を用いたプログラミング科目です。プログラミング実習も行ないます。Python既修者を対象として、プログラミング言語としてはSwiftを扱います。プログラミング言語の修得が主体となる授業になっています。Swiftを用いて、基本的なプログラミングの仕方を復習すると共に、Swift流のプログラミングを学んでいきます。SwiftインタープリタとSwift言語標準のライブラリを扱いながら、オブジェクトを利用する形でのプログラミングパラダイムを身に付けていけるような実習型の講義を行ないます。アプリケーションの開発は、通常の授業回では行なわないので注意して下さい。
In this lecture, the object oriented programming using with Swift scripting language are mainly studied. Because Python language that has been learned in the previous lecture classes focuses on web application, the main target of this lecture is to follow up developing the ability of basic programming for making applications. Using Swift interpreter and the standard libraries, students studies the programming paradigm, especially using the objects of the standard libraries. The style of lecture is to the discipline of the typing keys of keyboard according to program coding, and to the practice of making programs.
授業シラバス
主題と目標/授業の手法など
オブジェクト指向プログラミングをスクリプト言語Swiftをベースに学んでいます。Pythonでプログラムの基礎教育を受けた人を対象に、Swiftのインタープリタを基本としてのプログラミングの開発を通して、最終的にはオブジェクト指向特有の様々な概念モデルを学んでいきます。しかしながら、講義の主な目的は、Swiftというプログラミング言語を用いて、プログラミングの基礎を学ぶことにあります。オブジェクト指向やクラス設計などの進んだ内容を受講したい人は、別のクラスの授業を履修した方が良いでしょう。授業スタイルは、講義を行ない、間にプロジェクタに映し出されたプログラムを入力してもらうという実習を挟んでいく形の授業展開になります。実習の際に、落ちこぼれないようにプログラムのテキストは、SFSの方にもアップロードする予定でいます。実際にプログラムを入力していきながらの受講となりますが、教員側は、その場でコメントも入力しますので、何をプログラムしているのか理解して貰いながら進んでいくことになります。その際に、タイピングや開発環境の問題などで引っ掛からないようにしておいて下さい。特に毎回、新しい概念モデルが出てきますので、英語の専門用語にアレルギーを起こさないように注意してください。
開発環境はXcodeに包含されているSwiftのインタープリタと開発エディタとしてBBEditを用います。Xcodeは、非常に大きいので、第1回の授業開始前にダウンロードしておいて下さい。実習は通常教室なので、各自のMacBookに開発環境をインストールして行なってもらいます。なお、WindowsではXcodeもBBEditも稼働しませんので、MacBookを用意して下さい。なお、アプリケーション開発以外では、Ubuntu/Linux上でSwiftが動きますので、その環境が自分で用意できる人は、その環境で受講しても構いません。ただし、Ubuntu上では、アプリケーション開発はできません。
The students study the concept of object oriented programming with Swift language. In this lecture, the students handle the integrated developing environment based on interpreter, and various concept models those are specific to the object oriented programming. The target of this lecture is to design programs through studying each primary method on the programming. Each lecture is interleaved with the practices in those the programs displayed on projector. Those programs are also written by students themselves. The source text of programs will be uploaded to SFS. The comments on program those express how each part of program functions at the total algorithm are also typed in the practice, so that students understand meaning of the notation of the part of the program. Because quantity of typing is large, students should have trainings of typing English words. The newer concept words will be introduced to in each lecture class, so that students must be familiar with English terminologies.
Xcode are selected as the main developing environment. The settings of the developing environments will be customized to the lecture class, so that the students can get references the customization by the web lecture page. Because the lecture class room is a normal class room, and is not a computer room, each student should bring own MacBook. The developing environments for the lecture are installed by students themselves.
教材・参考文献
1) 荻原 剛志, 詳解 Swift 第5版, SBクリエイティブ, 2019, 580ページ, ISBN-13: 978-4815604073.
2) マーク 山崎, Swiftに挫折しそうになった人のための さらさら読めるSwift解説, Kindle版, 2018, 527ページ.
3) The Swift Programming Languages (Swift 5 Edition), Apple Computer, 2019, iBook.
提出課題・試験・成績評価の方法など
最終課題とその報告書も含め、課題を4〜5回程提出してもらいます(SFSからの提出)。試験は行いません。成績の評価は、授業への参加度(授業内で簡単な復習テストなどを行ないます)および提出課題によって行ないます。
Including the program for the final assignment and its report, the assignments should be submitted via SFS about four ~ five times. There is no final exam in this lecture. The evaluation of the result of each student is based on the aggressiveness to each lecture class and the submission of the assignments.
履修上の注意
第1回目の授業に必ず出席して下さい。そこで開発環境の設定をします。1回目の授業に来ない人がいると、その人のために2回目以降の授業で時間が潰れてしまいます。
プログラミング言語としてのSwiftに注目して講義を進めていきますので、アプリケーション開発のためにSwiftを受講したい人は避けた方が良いと思います。
情報基礎1および2の講義内容がかなり理解できている人のための授業になっています。単位を取得するためだけに履修を考えている人には、かなり苦痛になる可能性があります。
自分のノートPCを利用しての実習になります。Windowsでは、Xcodeが対応していませんので、MacBook Pro/Airを利用して下さい。
また、訓練式の演習の部分が多くありますので、自分のMacBookにおいて英語のタイピングが遅い人には「決定的に不利」になります。英語のタイピングが遅いと授業で何をしているのかわからないことになりますので、予め注意して下さい。
また、追加の授業回として、第8回・第14回・第15回・第16回の内容を予定しています。授業中あるいはSFSでアナウンスしますので、希望者は受講して下さい。
In addition to MacBook Air/Pro as the standard PC in this class, since Xcode development environment does not run under Windows.
Some additional lecture classes will be set for making up the assignment and for explaining application programming techniques with Swift.
授業計画
第1回 オブジェクト指向プログラミングへの導入
[Introduction to Object Oriented programming]
1−1.オブジェクト指向プログラミング言語の系譜
1−2.環境環境の設定
1−3.オブジェクト指向モデルの基本
1-1. Genealogy of object oriented programming languages
1-2. Settlement of Interactive Development Environment
1-3. Object oriented programming model
第2回 型と式・変数と代入
[ Type, expression, and assignment]
2−1.型とリテラル
2−2.構造的なリテラル
2−3.式と評価
2−4.変数と代入
2-1. Primitive types and those literals
2-2. Structural literals
2-3. Expression and evaluation
2-4. Using variables and assignment
第3回 ターミナルへの入出力
[Input/output to terminal]
3−1.ターミナルからの入力
3−2.オプショナル型
3−3.値の型変換
3−4.ターミナルへの出力
3-1. Input from terminal
3-2. Optional type
3-3. Type conversion of value
3-4. Output to terminal
第4回 条件分岐
[Conditional branch]
4−1.条件分岐
4−2.オプショナル束縛のついた条件分岐
4−3.論理式
4-1. Conditional branch
4-2. Optional binding in "if" statement
4-3. Logical expression
第5回 Switch文
5−1.if式
5−2.switch文
5−3.switch文の様々なバリエーション
5-1. "if" expression
5-2. "switch" statement
5-3. variations of "switch" statement
第6回 繰返し
[Repetition]
6−1.while文による繰返し
6−2.繰返しのネスト
6−3.束縛のついたwhile文
6−4.repeat while文
6-1. Repetition with "while" statement
6-2. Nesting "while" statements
6-3. "while" statement with optional binding
6-4. "repeat while" statement
第7回 主要制御構文
[Control statements]
7−1.for文による繰返し
7−2.範囲指定とfor文
7−3.繰返しと整数剰余と整数除算
7−4.その他の制御構文
7−5.制御構文の組合わせ
7-1. Repetition with "for" statement
7-2. Range specification in "for" statement
7-3. Modular operation and division operation in repetition
7-4. Other control statements
7-5. Combination of control statements
第8回 標準ライブラリ
[Standard libraries]
8−1.オブジェクトの利用
8−2.ライブラリの中でのオブジェクト
8−3.実数式と実数における誤差
8−4.Foundationライブラリ上の数学関数
8-1. Using objects
8-2. Object classes in the standard libraries
8-3. Expressions of real numbers and Errors in calculations of real numbers
8-4. Mathematical functions in Foundation library
第9回 関数定義
[Defining functions]
9−1.関数定義の仕方と定義された関数の呼出し
9−2.Swift特有のパラメータの渡し方
9−3.グローバル変数の宣言と使用
9−4.値を返す関数
9−5.整数演算のアルゴリズム
9-1. Definition of function and function call
9-2. Swift-specific parameter passing
9-3. Global variables in a function
9-4. Functions returning values
9-5. Algorithms using integer numbers
第10回 再帰関数とクロージャ
[Recursive functions and closure]
10−1.再帰関数
10−2.高階関数の利用
10−3.クロージャ
10-1. Recursive function
10-2. High-order functions
10-3. Closure
第11回 ジェネリック関数
[Generic function]
11−1.ジェネリック関数
11−2.ジェネリック関数と高階関数
11−3.内部関数
11−4.guard文
11-1. Generic function
11-2. Generic function and high order function
11-3. Internal function
11-4. Guard statement
第12回 配列(リスト)
[Operations on array]
12−1.配列と初期値代入
12−2.配列の範囲指定
12−3.配列への典型的な操作
12−4.配列のソート・シャッフル・頻度など
12-1. Array and its initial value assignment
12-2. Range specification on array
12-3. Typical operations on list
12-4. Sort, shuffle on list and requiring frequencies of data
第13回 2次元配列・文字列配列
[ lists]
13−1.配列と高階関数
13−2.2次元配列
13−3.文字列配列
13-1. Array and high order function
13-2. Matrix
13-3. Array of strings
第14回 文字列・タプル・イテレータ
[String, tuple, and iterator]
14−1.文字列に対する関数
14−2.ファイルの入出力・インターネットWebページからの入力
14−3.文字列と配列の変換
14−4.タプル
14−5.イテレータ、集合クラス
14−6.ハッシュテーブル (辞書クラス)
14-1. Functions on string
14-2. File input/output, and Input from web pages on internet
14-3. Conversion between array and string
14-4. Tuple
14-5. Collection and iterator
14-6. Dictionary (hash table)
第15回 第15回 クラスの定義
[Class definitions]
15−1.クラスの使用
15−2.コンストラクタの定義
15−3.総合的なクラスの定義
15ー4.継承を伴うクラス定義
15ー5.データの2進数表現
15-1. Class definition
15-2. Constructor
15-3. Class with functions
15-4. Class definition with inheritance
15-5. Binary representations of values
第16回 Swift UI
[Swift UI]
16−1.Swift UIを使ったアプリケーションの開発
16−2.ユーザからの入力を伴うGUIのプログラミング
16-1. Application development with Swift UI
16-2. GUI Programming with user interactions
15回目に相当するその他の授業計画
Swiftを用いたGUIアプリケーションの作成
Swift Play Ground
GUI application coded with Swift
Swift Play Ground