//honeypot demagogic

 Forum DhammaCitta. Forum Diskusi Buddhis Indonesia

Author Topic: [HELP] Programming  (Read 17239 times)

0 Members and 1 Guest are viewing this topic.

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #30 on: 22 December 2010, 01:19:31 PM »
sebelumnya saya termasuk orang yg fanatik sama delphi.

tapi sekarang trend programming sudah mengarah kepada open source dan cross platform, sedangkan delphi masih nempel sama M$. Delphi XE yg terbaru, juga masih belum mengusung cross platform yg sangat ditunggu2 oleh para delepoper seluruh dunia. hal ini membuat delphi jadi tidak populer. alternatif pengganti delphi adalah lazarus. tapi lazarus tumbuh terlalu lambat, tidak mampu mengejar ketinggalan.

gw suka Delphi karena hasil compilenya stand alone. jadi hasil compiled nya ga tergantung lagi dg library lain --- di platform M$ Windows tentunya.
secara default, semua library yg dibutuhkan ter-static linking dg application binary, yet file & memory usage sizenya masih kecil.
utk Desktop programming, saya cuma ketemu Delphi & sodaranya C Builder, IDE yg begini... cmiiw

skr saya pakai Lazarus karena... (Anda benar) 1. cross platform (tp harus direcompile). 2. IDE nya tidak memakan resource seganas Delphi (Delphi yg support Unicode tentunya... jgn bandingkan dg Delphi 7 ke bawah).
utk Lazarus, ada 1 fitur yg sangat keren menurut saya. yaitu pemilihan widgets utk GUI, programmer ga perlu pusing lagi dg lib2 widgets, tanggung jawab ini menjadi tanggung jawab tools nya (Lazarus). saya suka sekali fitur ini...

utk aplikasi web dan device, kayanya memang bukan bidang Lazarus... malah menurut saya Delphi tidak focus krn merambah ke framework2 microsoft... jadi saya rasa sih Lazarus udah cukup mature dan mungkin akan menjadi tonggak hidupnya Pascal mengambil alih dari tangan Delphi (harapan pribadi jg sih...). jika dilihat dari websitenya, imho perkembangan Lazarus sangat aktif.

tuh lihat... bener kan kata saya... sangat aktif... lari terus, ga capek2 ;D
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #31 on: 22 December 2010, 01:23:22 PM »
gw suka Delphi karena hasil compilenya stand alone. jadi hasil compiled nya ga tergantung lagi dg library lain --- di platform M$ Windows tentunya.
secara default, semua library yg dibutuhkan ter-static linking dg application binary, yet file & memory usage sizenya masih kecil.
utk Desktop programming, saya cuma ketemu Delphi & sodaranya C Builder, IDE yg begini... cmiiw

skr saya pakai Lazarus karena... (Anda benar) 1. cross platform (tp harus direcompile). 2. IDE nya tidak memakan resource seganas Delphi (Delphi yg support Unicode tentunya... jgn bandingkan dg Delphi 7 ke bawah).
utk Lazarus, ada 1 fitur yg sangat keren menurut saya. yaitu pemilihan widgets utk GUI, programmer ga perlu pusing lagi dg lib2 widgets, tanggung jawab ini menjadi tanggung jawab tools nya (Lazarus). saya suka sekali fitur ini...

utk aplikasi web dan device, kayanya memang bukan bidang Lazarus... malah menurut saya Delphi tidak focus krn merambah ke framework2 microsoft... jadi saya rasa sih Lazarus udah cukup mature dan mungkin akan menjadi tonggak hidupnya Pascal mengambil alih dari tangan Delphi (harapan pribadi jg sih...). jika dilihat dari websitenya, imho perkembangan Lazarus sangat aktif.

tuh lihat... bener kan kata saya... sangat aktif... lari terus, ga capek2 ;D

saya juga berharap demikian, senangnya kalau bisa terus berbicara dalam bahasa Pascal. bahasa yg sangat estetis menurut saya, tidak seperti bahasa JAWA, walaupun akhirnya saya terpaksa harus berbicara JAWA juga ;D

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #32 on: 22 December 2010, 03:29:31 PM »
saya juga berharap demikian, senangnya kalau bisa terus berbicara dalam bahasa Pascal. bahasa yg sangat estetis menurut saya, tidak seperti bahasa JAWA, walaupun akhirnya saya terpaksa harus berbicara JAWA juga ;D
utk desktop kayanya java (Swing) performance nya loyo deh... suruh nunggu minum kopi dulu utk starting :P
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline morpheus

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 2.750
  • Reputasi: 110
  • Ragu pangkal cerah!
Re: [HELP] Programming
« Reply #33 on: 22 December 2010, 05:07:04 PM »
pascal hancur gmn?
delphi terjun bebas gmn?

... Lazarus itu kan meniru Delphi... kalau Delphi udah uzur, Lazarus ikut?
maksudnya banyak penambahan belakangan seperti reintroduce tadi... kalo sampe bisa override ancestor class berarti mangkin susah ditrace dan dibaca, padahal tujuan utama pascal adalah readability dan diutamakan untuk kalangan akademik yg ingin belajar programming.

pencipta pascal (wirth) pernah mengeluh hal yg sama, setelah pascal ditambahin ini itu sama borland. pascal tidak lagi murni, malah mulai membentuk sekte2 baru dengan penambahan ajaran2 non-otentik ke dalam kitab suci pascalitaka... mungkin ini adalah upaya kausalya.
* I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it
* Neo, sooner or later you're going to realize just as I did that there's a difference between knowing the path and walking the path

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #34 on: 22 December 2010, 05:28:33 PM »
maksudnya banyak penambahan belakangan seperti reintroduce tadi... kalo sampe bisa override ancestor class berarti mangkin susah ditrace dan dibaca, padahal tujuan utama pascal adalah readability dan diutamakan untuk kalangan akademik yg ingin belajar programming.

pencipta pascal (wirth) pernah mengeluh hal yg sama, setelah pascal ditambahin ini itu sama borland. pascal tidak lagi murni, malah mulai membentuk sekte2 baru dengan penambahan ajaran2 non-otentik ke dalam kitab suci pascalitaka... mungkin ini adalah upaya kausalya.


btw saya jadi binggung dg reintroduce ini...
kenapa keyword reintroduce ini perlu?
di C++ ga ada keyword ini, sementara virtual --- override masih sama...
reintroduce ---> tidak perlu keyword karena memang menimpa...

fitur pemanggilan parent method, imo sama sekali tidak diperlukan...
ada yg bisa kasih contoh kegunaannya?



(TParent(child)).doSomething;

atau

(child as TParent).doSomething;

code mana yg benar? & dalam kenyataan, problem apa yg perlu solusi kaya gini...
child class perlu panggil parent class 'dari luar'.
Spoiler: ShowHide

imo, code begini tidak pernah terpanggil... kecuali
Code: [Select]
var holder: ^TParent;

holder :=  [at] achildInstance;
^holder.doSomething;

ini malah akan sebabkan bug :o
« Last Edit: 22 December 2010, 05:38:49 PM by tesla »
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #35 on: 22 December 2010, 05:51:28 PM »
mungkin ini bisa sedikit mencerahkan

Quote
Suppose you developed an awesome framework using language X and released it as version 1. Your users raved at all it could do and it became heavily used. Flush with success, you decide to release version 2 with even more awesomeness. You specifically made sure it was fully backward compatible. Suddenly, you users started reporting strange behaviors. Their own virtual methods were being called at strange times. Many reported that their old code would not compile with the new version. Strange. All the same objects, methods, and functionality still remained. All you did was add a few virtual methods to some base classes, some new object types, and some new optional functionality. What happened?

The override and reintroduce directives serve to eliminate this problem by requiring that in order to actually override a virtual method you must use the override directive in place of the virtual directive. If you happen to introduce your own virtual method that has the same name as one of your ancestors' virtual methods, the compiler now warns you, but will still do the right thing. In this case, using reintroduce, not only suppresses that warning, it also serves to document in the source you intended to do that.

Without the override and reintroduce directives, you would not be able to continually evolve your framework without fear of breaking all your users. And if your users had to make massive modifications every time a new version is released, then they would be loathe to adopt the new version. Finally, using "override" also allows the framework designer to change the type of virtual in the ancestors without breaking user code. For instance, in Delphi many methods are marked "dynamic" which is a table-based runtime method lookup form of polymorphism. It's doesn't perform quite as fast as a regular virtual so it is usually used for methods that are rarely overridden and/or are responses to user actions where the extra overhead is never noticed. Suppose in V1 of the framework a method was marked "dynamic" but in practice it ended up being overridden and called more than you intended. In V2, you could change it to "virtual" without fear of user's code being broken.

Delphi's Object Pascal language isn't the only language to recognize this problem. C# requires the use of an "override" directive for the exact same reason. The C++ standards committee is finally recognizing the problem and are modifying the language to support it... sort of. In C++, if a method's name and parameter list matches an ancestor's virtual, then it is an override (even if you don't say "virtual" on the descendant!). For the upcoming new C++ standard, if you specify "virtual" and the signatures don't match then it is a new virtual method introduced on current class. If there is a signature match with the ancestor and the writer didn't intend to override, then the "new" keyword is used to tell the compiler that this is a new virtual for this class.

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #36 on: 22 December 2010, 05:53:29 PM »
dan ini

Quote
If you declare a method in a descendant class that has the same name as a method in an ancestor class then you are hiding that ancestor method - meaning if you have an instance of that descendant class (that is referenced as that class) then you will not get the behavior of the ancestor. The compiler will give you a warning.

Now you have one of two choices to suppress that warning message:

Adding the keyword reintroduce just lets the compiler know you are hiding that method and it suppresses the warning. You can still use the inherited keyword within your implementation of that descended method to call the ancestor method.
If the ancestor's method was virtual or dynamic then you can use override. It has the added behavior that if this descendant class is cast back as the ancestor, then the call to that method will always be to the descendant method (which then may optionally call the ancestor through inherited).
So difference between override and reintroduce is in polymorphism. With reintroduce, if you cast the descendant class as the parent, then call that method you will get the ancestor method, but if you have it cast as the descendant method then you will get the behavior of the descendant. With override you always get the descendant If the ancestor method was neither virtual nor dynamic, then reintroduce is your only option (actually you could use a class helper, but we won't go there now).

In spite of what Malach said, you can still call inherited on a reintroduced method, even if the parent was neither virtual nor dynamic.

Essentially reintroduce is just like override, but it works with non-dynamic and non-virtual methods, and it does not replace the behavior if the object instance is cast back as the ancestor.

Further Explanation:

Reintroduce is a way of communicating intent to the compiler that you did not make an error. The traditional way of overriding a method in an ancestor is with the override keyword, but it requires that the ancestor method was virtual or dynamic, and that you want the behavior to change when the class is cast as the ancestor class. Now enter finalize. It lets you tell the compiler that you did not accidentally create a method with the same name as an ancestor method (which would be annoying if the compiler didn't warn you about) and this allows you to override a method that is not virtual or dynamic or if you don't want the behavior changed when the class is cast as the ancestor.

Offline seniya

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 3.469
  • Reputasi: 169
  • Gender: Male
  • Om muni muni mahamuni sakyamuni svaha
Re: [HELP] Programming
« Reply #37 on: 22 December 2010, 07:14:31 PM »
sebelumnya saya termasuk orang yg fanatik sama delphi.

tapi sekarang trend programming sudah mengarah kepada open source dan cross platform, sedangkan delphi masih nempel sama M$. Delphi XE yg terbaru, juga masih belum mengusung cross platform yg sangat ditunggu2 oleh para delepoper seluruh dunia. hal ini membuat delphi jadi tidak populer. alternatif pengganti delphi adalah lazarus. tapi lazarus tumbuh terlalu lambat, tidak mampu mengejar ketinggalan.

Bukannya ada Kylix, versi cross platform dari Delphi????
"Holmes once said not to allow your judgement to be biased by personal qualities, and emotional qualities are antagonistic to clear reasoning."
~ Shinichi Kudo a.k.a Conan Edogawa

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #38 on: 22 December 2010, 07:33:57 PM »
Bukannya ada Kylix, versi cross platform dari Delphi????

Kylix udah lama tewas, dibunuh sama penciptanya sendiri

Offline morpheus

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 2.750
  • Reputasi: 110
  • Ragu pangkal cerah!
Re: [HELP] Programming
« Reply #39 on: 22 December 2010, 11:04:46 PM »
Essentially reintroduce is just like override, but it works with non-dynamic and non-virtual methods, and it does not replace the behavior if the object instance is cast back as the ancestor.
oh, kirain mengganti code yg ada di parent ala ruby.

kalo yg ruby itu konon not recommended oleh pakar oop dan software engineering:
http://en.wikipedia.org/wiki/Open/closed_principle
tapi pernah juga kepepet pake.
* I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it
* Neo, sooner or later you're going to realize just as I did that there's a difference between knowing the path and walking the path

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #40 on: 27 December 2010, 06:13:27 PM »
btw di Lazarus

TTimer kok sepertinya ada bug
Enabled := False; Enabled := True; (maksudnya di off kan sementara, kemudian di On kan)

di cek enabled nya udah jadi true, tapi onTimer nya ga ter eksekusi
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

 

anything