Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/hitowomusubu/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
プログラミングの始め方 | 夢を叶える塾
スポンサーリンク

プログラミングの始め方

ホームページのリニューアルに伴い一部のページは新しいサイトにリダイレクトされます。

 

今回はプログラムを動かすまでに何が必要かについてです。
この連載の中で具体的なものは扱いません。
プログラムを動かすまでに、どんな流れを辿らないといけないのかをまとめたいと思います。

言語を選ぶ

本来何を作るのかが決まっているうえで、プログラム言語を選びます。
しかし、まずはプログラミングについて学ばなければ、何を作れるのかもよくわかりません。
ここではその大切な「何を作るのか」はさておき、「プログラムを動かす」ことを目標に話を進めていきます。

学びを左右する

これからプログラムを動かすというとき、まずやるべきことはプログラム言語を選ぶことです。
これからはじめようとする方向けに書いていますので、これからの学びを左右しますので慎重に選んで頂きたいと思います。
しかし、ここで慎重になりすぎても時間がもったいないので、ある程度気合で決めてしまって良いと思います。
プログラム言語はかなり種類がありますので一つ一つ調べようと思うとそれだけで大変ですからね。
私も一覧等をまとめてみたいなと思いますが、「プログラム言語 一覧 おすすめ」みたいに検索して選んでみてください。
私のおすすめは「java」か「VBA」です。

結局はお好きなもので

プログラム言語はそれぞれソースコードを書く環境や、実現できる事が変わってきます。
例えばExcelシートを所定の書式で作成する事を目的としているのであれば、「VBA」一択でしょう。
ただ、基本的にプログラミングを学ぶ上で重要な事は、アルゴリズムを作れるようになる事です。
これはどの言語であっても基本的には変わりません。
そういうものではお好きなものを選択頂いて問題ないかと思います。
なお、私はこの連載の後、まずは「VBA」を中心に解説したいと思っていますので、もしよければ「VBA」をお選びいただければ幸いです。
一応理由もありまして、それはこの次の「環境を整える」という点と、「言語がわかりやすい」という点で有利だからです。

環境を整える

プログラム言語を選んだら次にやるべきことは環境を整える事です。
プログラムを動かすためには準備が必要です。

パソコン(OS)は初めからなんでも知っているわけではありません。
プログラム言語もそれを覚えさせなければパソコンはプログラムを理解できません。
プログラムを実行するまでに、いくつかのインストール作業が必要になります。

コンパイラ

一つはプログラムの命令をパソコンが理解できるようにするための「コンパイラ」です。
パソコンはプログラムに書かれた命令を解釈しながら動作しているわけではないんですね。
プログラムに書かれた命令を、パソコンが動作できる状態に変換する操作を「コンパイル」と言います。
この「コンパイル」をするための「コンパイラ」をインストールします。
それぞれの言語でコンパイラが違ってきますので、それぞれの言語に合わせたコンパイラをインストールしてください。

言語によっては特にコンパイルする必要なく動作するものもあります。
「VBA」は厳密にはコンパイルするのですが、コンパイルを意識することなく実行できます。
おすすめの理由の一つです。
コンパイルを学べないという点ではデメリットですけどね。

エディタ

ソースコードを記述するための「メモ帳」や「word」のようなテキストを記述するエディタが必要です。
ただ、「word」で作成したドキュメントは文字以外のデータを含むので使えません。

ソースコードの記述速度はテキストエディタによって変わってきます。
また、テキストエディタにはプログラム言語に合わせてその命令文を解釈して色を変えてくれたりするものがあります。
このような便利機能を使いこなせると、記述の間違いにも気付きやすくなります。

さくらエディタ

私のおすすめのテキストエディタは「さくらエディタ」です。
キー入力を覚えさせ、それを再現させる機能を持っています。
「文頭に「a」を入力し、文末にカーソルを移動させ「b」を入力して「→」により次の行に移動する。」
これを覚えさせ、次々再現させていくと、各行の文頭に「a」が、文末に「b」が次々と入力されていきます。
便利です。
また、フォルダ配下のファイルのテキスト検索機能があったり、範囲選択で複数行に同じキー入力が出来たり、とにかく便利機能が沢山ついています。

使わない場合もある

「java」の「Eclipse」が有名ですが、エディタからコンパイラから全て含まれた統合開発環境というものもあります。
特定のプログラム言語に特化した環境ですから、エディタでソースコードを記述していると、間違いを指摘してくれたりします。
この場合特にエディタを用意する必要はありません。
なお、「VBA」も同じようにオリジナルの開発環境がありますのでエディタは不要です。

開発環境

先のエディタで書きました。
プログラム言語によっては、プログラミングがしやすくなる環境を用意されていたりします。
本来コンパイルという作業も、ハードルの高い操作を行う必要があるのですが、開発環境を使う事によってボタン一つでコンパイルできます。
ただ「java」の「Eclipse」をインストールするのも、初めての人にとっては少々ハードルがあります。
「VBA」は「Excel」さえインストールされていれば使えます。
「VBA」をお勧めしている理由の一つです。

その他

これ以外にもプログラムによっては必要なものがあったりします。
例えばファミコンであれば、カセットだけあっても動きません。
ファミコン本体が必要です。
このようなソフトウェアを動作させる母体が必要になるものもあります。
が、プログラミングを学ぶ上ではいったん考えなくても良いでしょう。

ソースコードを書く

ここまででプログラムのソースコードを入力し、実行できるまでの環境がそろいました。
とりあえずプログラム言語のサンプルコードを入力してみましょう。

コンパイル

「ソースコードを入力していざ実行」の前にコンパイルが必要です。
プログラム言語によってはコンパイルしなくても実行できるものもありますが。

コンパイル自体は先に書いていますのでそれ以上の事はありません。
ただ、コンパイル時にソースコードのチェックをしています。
記述誤りが無いか等をチェックしてくれます。
ここで誤りがあることに気づいてもらえると修正は楽です。
気付いてもらえないと、どこに間違いがあるのかわからず途方に暮れてしまいます。

実行する

いよいよ実行できます。
サンプルコードによって異なりますが、「コンニチハ」等と画面に表示される事でしょう。
思った通りに動くかわかりませんが、入力したサンプルコードが無事に動くと、一つのハードルを越えたことになります。
ここからは色々なサンプルコードを入力して、そのアルゴリズムを動かしながら理解する事ができるようになります。
プログラミングが始まった瞬間と言えるでしょう。

終りに

プログラムとは言えないような、「コンニチハ」を表示する事ができるようになるまで、道のりは長いと感じるかもしれません。
このような壁がいくつもあったりするわけですが、これからはじめる人を待ち受ける壁を参入障壁と呼んだりします。
参入障壁は越えるまでは大変なものですが、越えてしまえば自分を守ってくれる壁に変わります。
どんどん壁を越えて誰もたどり着けないところまで進んでしまえるようになれると良いですね。

にほんブログ村 地域生活(街) 東北ブログへ にほんブログ村 地域生活(街) 東北ブログ 米沢情報へ にほんブログ村 教育ブログへ にほんブログ村 教育ブログ 塾教育へ
スポンサーリンク