04.8.2008

オブジェクトについて

仕事が始まって一週間。
早いものです。
といっても、まだ仕事ではたいしたことはしてませんが・・・。

とりあえず先週からはサムネイルを生成するプログラムを書いています。
GD使って、jpgを圧縮するやつです。
とりあえずネットで使えそうなライブラリを検索。
このくらいなら自分で作ってもよさそうだけど・・・。
というか、以前バイトでも全く同じようなものを作りました。

今回の自分の新しい要素としては以下の二点。

  1. オブジェクト志向で書く
  2. コマンドから呼び出せる

オブジェクトというのはプログラミングの作法の一種です。
ある動作をさせるときのサブ動作群をまとめて一つの対象として考える書き方です。
例えば「ファイル」というオブジェクトがあると考えるならば
「開く」、「保存する」、「閲覧する」とか、そういった関連する動きをひとまとめにしたもの。

現在ではJAVAを始め、様々な言語でのプログラミングでは
当然のスキル(?)とされています。
反対にオブジェクト指向ではない書き方の一つとして
スクラッチ、またはベタ書きと呼んでいる書き方があります。
これは一つの動作に対する手順をそのままプログラムとして書くやりかたです。

オブジェクト指向のメリットとしてはなによりも拡張性と再利用性です。
拡張性とは、関連するオブジェクトを連結させることで
より複雑な処理を簡単に(簡潔に)プログラミングできるということ。
再利用性というのは、関連する動作群の基盤を作っておくことで
似たような処理があったときには、それを再利用ができるということです。

デメリットとしては比較的きちんとした設計をしないと
拡張性や再利用性が低くなってしまうということと
プログラミングに時間がかかるということです(短期的に見れば)。

一方スクラッチのメリットとしては手早く書けるということと
人間の思考方法に沿って書けるということです。
デメリットとしては、再利用性がないので
類似する処理にたいしても重複するようなソースを書く必要がでてくるということです。

・・・今日は二番目のコマンドからphpを呼び出すプログラムについて書こうと思ったんだけど
前のアルバイトをやめるときに、オブジェクトについて書くということを約束していたので
今日はオブジェクトについてもうちょっと書いてみようと思います。

ページ: 1 · 2 · 3 · 4

Trackback address for this post

Trackback URL (right click and copy shortcut/link location)

52 trackbacks

Trackback from: Kppc [訪問者]
Really a good article. Thanks for sharing your thoughts.
2009/11/28 @ 00:06
Trackback from: Claims Reduction [訪問者]
Lovely article. Thank you for sharing this.
2009/11/28 @ 06:16
Trackback from: Benefit Bridge [訪問者]
Wonderful piece of writing.Keep sharing.
2009/11/28 @ 07:04
Trackback from: Health Care [訪問者]
Love to read this article. Thank you for sharing.
2009/11/28 @ 10:13
Trackback from: Public Agencies [訪問者]
This is a very good article. Like to read more from you.
2009/11/28 @ 11:25
Trackback from: Schools [訪問者]
Your article is very nice to read. Keep writing.
2009/11/28 @ 13:27
Trackback from: Know Consumer Law [訪問者]
Awesome piece of writing.Really nice of you to share this.
2009/11/29 @ 06:04
'I find nothing so dear as what is given me'...Montaigre
2009/12/01 @ 06:13
Trackback from: Sell Gold jewelry [訪問者]
'Never examine the teeth of a gift horse'...Hieaonymus
2009/12/23 @ 09:08
Pay beforehand was never well served.
2009/12/23 @ 11:02
The cemeteries are filled with people who thought the world couldnt get along without them.
2009/12/23 @ 12:26
Throw a lucky man into the sea and he will come up with a fish in his mouth.
2009/12/23 @ 13:43
Everyone is wise until he speaks.
2009/12/23 @ 14:55
If a man fools me once shame on him. If he fools me twice shame on me.
2009/12/26 @ 14:20
Trackback from: candida cure [訪問者]
Time is the soul of business.
2010/01/08 @ 02:17
Trackback from: Business Email List [訪問者]
The pot calls the kettle black.
2010/01/09 @ 02:04
Pay beforehand was never well served.
2010/01/10 @ 00:56
Trackback from: 737 area code [訪問者]
There are four things every person has more of than they know sins debt years and foes.
2010/01/11 @ 20:01
Trackback from: Sinrex [訪問者]
It takes two to tango.
2010/01/15 @ 07:15
Time will tell.
2010/01/16 @ 04:53
If you want your dreams to come true dont over sleep.
2010/01/16 @ 10:17
An ounce of patience is worth a pound of brains.
2010/01/20 @ 13:27
Fools rush in where angels fear to tread.
2010/01/21 @ 14:49
Trackback from: FillerUp Club Scam [訪問者]
The proverb is something musty.
2010/01/30 @ 04:06
All roads lead to Rome.
2010/01/30 @ 04:36
A reed before the wind lives on while mighty oaks do fall.
2010/01/30 @ 04:56
Were it not for hope the heart would break.
2010/01/30 @ 05:04
Trackback from: You Can't Say No Scam [訪問者]
Physician heal thyself.
2010/01/30 @ 05:16
Trackback from: stock picks [訪問者]
This is a new way of thinking for me.
2010/02/01 @ 06:14
Trackback from: oil stocks [訪問者]
It's amazing to think so many can read what you are saying here.
2010/02/01 @ 07:23
May God bless you to live as long as you want to and want to as long as you live!
2010/02/04 @ 09:54
Trackback from: Uninsured Motorist [訪問者]
Since we cannot get what we like let us like what we can get.
2010/02/04 @ 11:08
Trackback from: Synaura [訪問者]
Every invalid is a physician.
2010/02/05 @ 04:15
Trackback from: Zurvita Review [訪問者]
Marrying is easy its housework thats hard.
2010/02/05 @ 04:19
Trackback from: Visalus Review [訪問者]
Nine tailors make a man. the literal meaning is that a gentleman must select his attire from various sources it is now also associated with bellringing
2010/02/05 @ 04:20
You cannot get a quart into a pint pot.
2010/02/06 @ 20:45
Never put off till tomorrow what may be done today.
2010/02/06 @ 21:23
Tomorrow is often the busiest day of the week.
2010/02/06 @ 21:58
Trackback from: vancouver sports bar [訪問者]
Fantastic stuff here =D Thank you!
2010/02/11 @ 04:17
Trackback from: area code lookup [訪問者]
Good stuff!
2010/02/15 @ 11:38
Trackback from: 201 area code [訪問者]
Thanks for sharing your thoughts.
2010/02/15 @ 11:47
Trackback from: 202 area code [訪問者]
I enjoyed your post. Thanks for sharing.
2010/02/15 @ 11:50
Trackback from: 203 area code [訪問者]
Nice little write up. Thanks! ;)
2010/02/15 @ 12:10
Trackback from: 204 area code [訪問者]
Hey, thanks for posting. Good stuff!
2010/02/15 @ 12:16
Trackback from: 205 area code [訪問者]
Thanks for sharing your thoughts.
2010/02/15 @ 12:34
Trackback from: best guitar lessons [訪問者]
What an insightful article. Thank you for sharing.
2010/02/19 @ 06:20
Trackback from: jamorama [訪問者]
What an insightful article. Thanks for sharing.
2010/02/19 @ 06:28
Trackback from: oil stocks [訪問者]
Thanks for taking the time to post this. I'm going to start to follow your blog, check out my oil stocks newsletter
2010/02/21 @ 03:51
Good fences make good neighbors.
2010/02/26 @ 14:51
No matter how often a pitcher goes to the water it is broken in the end.
2010/02/28 @ 07:58
Trackback from: Contact Phone Snoop [訪問者]
Well said! Love your work man, keep it up :)
2010/03/07 @ 14:48
Trackback from: PhoneSnoop.org Legal [訪問者]
Good topic that I have been looking for-Thank You
2010/03/07 @ 14:54

コメントを残す


Your email address will not be revealed on this site.

頂いたURLは表示されます。
PoorExcellent
(改行が自動で <br /> になります)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)