View Single Post
05/11/14, 01:02 AM   #40
CatoTheElder
Join Date: May 2014
Posts: 44
Angry

Originally Posted by Brainling View Post
In the professional world, mixing your code and layout are absolute no-no's. UI programming 101 stuff.

That said, this isn't a professional environment. If people are more comfortable in pure code, let them use pure code. Bugs and maintenance headaches caused by this aren't likely to lose anyone money or cause direct harm to a 'business'. People are writing these add-ons for fun, and in many cases aren't professional software engineers. Provided their style of coding isn't directly causing client issues (high memory and/or CPU usage), I'm all for letting people do things the way they are comfortable and find fun.

Personally I'll be going the route of using XML and virtual XML templates for my UI, as that's the environment I feel comfortable in coming from a professional web and WPF background. The idea of layout markup being fundamentally separated from the code is like a warm blanket for me.
This has been a huge argument, for a long time. I am a professional software developer (linux kernel and drivers), so I can do API scripting, but it is far more difficult, especially without documentation. That said, in a professional environment you need to maximize your efficiency. This means clear memory when you're done with it (especially arrays/tables), dispose of objects when they're no longer required, minimize indexing/searching arrays etc. This is the reason XML should not be used at all. It is insecure, inefficient, and as a result requires more system resources than necessary.

ESPECIALLY IF YOU HOOK OnUpdate() - OnUpdate() gets called every frame re-draw (ie 60 FPS = 60 calls to OnUpdate(). This creates a huge drain on system resources, even from minimal code.

XML:
Parses file, creates templates (or objects) on addon load, loads them into memory in the global name space, and leaves them there forever, allowing another to modify/overwrite your controls, accidentally or otherwise. So, bad security, bad memory management. Don't use XML.

Professional LUA Script:
Controls are dynamically loaded in to memory when needed.
Controls are protected from tampering by being in a private memory space
Controls are dynamically unloaded, freeing memory as soon as the control is no longer required.
Multiple controls can easily be created by using a function.

I've seen addons that require higher memory usage, and CPU utilization than entire operating systems. This is why it shouldn't be "okay" for people to "do things the way they are comfortable."

I spend a lot of time and effort keeping my system optimized, and poor code is extremely frustrating, especially from so-called professional web developers. Gee, I wonder what GUI is used to make your operating sytem's GUI? ... Oh, right, that's an infinite loop. At the bottom, the GUI is written in code. Absolute no-nos? Please, stop talking.

Last edited by CatoTheElder : 05/11/14 at 01:04 AM. Reason: ignorant people piss me off
  Reply With Quote