"
"18 martial arts"? "I said that he encountered a problem with multiple languages. I said in reply:
Many languages can only be able to understand a little bit, no need to be proficient in every kind of
But if you only have a little one or two languages.
Because I saw some applications about Java reflex technology, I suddenly thought that the RTTI of Delphi was also very strong, so I tried to take the data set and use RTTI to implement it. It is done in two nights (if it is not because of the wrong object - the base class uses TOBJECT, it should be used to use TPERSISTENT), and it is very simple.
Suppose there is an adodataset control, connecting the Rosewin database, SQL is:
SELECT * from Employee
Now you have to display the EmployeeiD, FirstName, LastName, and LastName in ListView. I have implemented a data set agent class through RTTI, making the code greatly simplified (these two days to fight out some author writing). The result is roughly as follows:
Type
TPDSemPloyee = Class (TMPROXYDATASET)
Published
Property EmployeeiD: Integer Index 0 Readinteger;
Property Firstname: String Index 1 Readstring Write Setstring;
Property Lastname: String Index 2 Readstring Write Setstring;
END;
...
EMP: = tpdsemployee.create (adodataset1);
While Emp.Foreach Do
With listview1.add do
Begin
CAPTION: = INTOSTR (EMP.EMPLOYEEID);
Subitems.add (Emp.Firstname);
Subitems.Add (Emp.lastname);
END;
Emp.free;
Compare the traditional implementation code, the benefits are 显尔 易见.
But when I realize this TMPROXYDATASET class, I can't help but feel sad, I have been thinking three years ago.
Three years ago, Delphi6 just launched, I found that its SOAP function was achieved through Delphi powerful RTTI, why didn't I think of going to study Delphi's RTTI?
This time, or because I saw some Java information, I may still think that more about some other languages is very important. Especially recently, the dynamic language has become more concerned, although they cannot compare with native development, but they have important inspirational significance in a lot of development ideas.
After doing this stuff, I realized that Delphi is actually in all native development languages, the most dynamic, is not much lower than the virtual machine-based Java and C # low. It's just a long-term development of RAD, I have not experienced it. The programmer is getting hampened under RAD.