Information dummy question about code and the good practice - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12) +--- Thread: Information dummy question about code and the good practice (/showthread.php?tid=379421) |
dummy question about code and the good practice - Nanomani - 2024-11-15 Just to be sure about code and the good/best practice. sometime the code can be like this (eg : Skin Estuary) : syntax 1 :
syntax 2 :
syntax 3 (syntax 1 mixed with syntax 2) :
Of course I have make some test in my side. All seems to be the same for me. is there only a reading confort for each coder or there is something to know about a practice vs an other practice ? Thanks for any answers. RE: dummy question about code and the good practice - pkscout - 2024-11-15 They are, as you have seen, all the same. For what you've shown, that's just a coding preference. I would suggest picking one and sticking with it though, or at some point you'll end up with a dangling item that will mess everything up. And if you're modding an existing skin, I'd follow whatever convention the original skinner used. RE: dummy question about code and the good practice - Nanomani - 2024-11-16 (2024-11-15, 23:25)pkscout Wrote: They are, as you have seen, all the same. For what you've shown, that's just a coding preference. I would suggest picking one and sticking with it though, or at some point you'll end up with a dangling item that will mess everything up. And if you're modding an existing skin, I'd follow whatever convention the original skinner used. Thanks a lot for your explaination very clear. EDIT : I never has the opportunity to say thank you too for your perfect addon "script.audio.profiles". RE: dummy question about code and the good practice - jurialmunkey - 2024-11-16 There is one very minor difference not covered here. When defining *defaults* for an include you use the "default" attribute instead of the "value" attribute in the param tag.
Notice that the attribute (A) approach is not interchangeable for defining defaults and values because the param "type" is made explicit by the attribute. Whereas in the element (B) approach, the same line of code can be used for defining both defaults and values because the param "type" is implicit in the element. A is more "proper" and is especially useful if you ever need to do a find/replace; whereas B is more convenient for copy/pasting and writing code quickly. RE: dummy question about code and the good practice - Nanomani - 2024-11-16 (2024-11-16, 05:58)jurialmunkey Wrote: Notice that the attribute (A) approach is not interchangeable for defining defaults and values because the param "type" is made explicit by the attribute. Very interesting information. I never thinking about that. Thanks a lot for sharing your "huge" experience. |