>
> That does not mean that testing that code will ever be easy. If anyone 
> knows how to test the Qt code, I would appreciate knowing how.


> Edward
>

No, it never will be easy, but it can be made easier than it is now. The 
way to achieve this is straightforward but it requires some effort. The 
coupled modules should be decoupled as much as possible. From the current 
state it is not obvious how decoupling can be achieved, but the decoupling 
process must start somewhere. It can't be started unless you as Leo's 
creator and main developer do not wish to consider decoupling as a worthy 
goal. Let me give an example of the unnecessary couplings I have in mind.

About a year ago, when I was experimenting with the history_tracer plugin, 
I wished to create a small window with the scale and a text widget. 
Changing the scale widget should show in the text widget the version of the 
selected node. I wished to have syntax highlighting in the text widget. 
Now, Leo has several classes related to highlighting the source code, but I 
could not use any of them. They are all coupled to the commander, so it is 
not possible to use them for highlighting anything other but the body 
widget. The idea behind object oriented programing is code reuse. But with 
the current implementation of syntax highlighters in Leo the code reuse is 
not possible. I had to implement another highlighter if I wanted to make a 
qt display widget. In this particular case I have found that it was easier 
for me to make a web display of the history. Can the PygmentsColorizer or 
JEditColorizer  be decoupled from the commander? The answer is yes, they 
can. Both of them currently use commander instance to check the tree in 
order to find which language should they highlight and to access 
configuration. Instead it should be the commander's responsibility to 
configure them and tell them which language should they use. They should 
not bother themselves with the tree. After all they are highlighting only 
the text of one widget. If they were implemented that way, it would have 
been trivial to use them on any text widget. This is just one small 
example. To fix this some changes are necessary on both sides in the 
colorizers and in the commander. But those changes will never be made 
unless you Edward are willing to accept that code can be simplified and 
that the simplification on its own is a worthy goal. The usual response 
from you in the past was that the code was sound as it was and that no 
changes should be made, that the code was inherently complex and that we 
couldn't do anything about it.

I really believe that doing decoupling piece by piece, module by module, 
can make Leo's code much easier to test and more importantly easier to 
(re)use.

Vitalije

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ca8edc96-7297-4212-a410-2670e31b73fe%40googlegroups.com.

Reply via email to