Thread Tools Display Modes
04/24/14, 12:30 PM   #41
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by LilBudyWizer View Post
I don't agree with stripping white space and such. Programmer automate thyself. If you want the white space stripped out then strip the white space out as you parse it. It's senseless to make the source difficult to read so a parser has an easier time at it..
I feel a few people are not understanding what I am asking for here.


Tell me the difference between the following two lines of code:


function getSomething()
function getSomething()

At fist glance, NADA. When I run this through HG to commit, it is going to tell me that line 2 is different, hence a "change" from line #1. Why?


Because it has white space (20 extra spaces) at the end of the line.


It has nothing to do with obfuscation. I am definitely not advocating using a minify, like for javascript, to pack all the code into a single line =)
  Reply With Quote
04/24/14, 01:08 PM   #42
Vicster0
 
Vicster0's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 82
Originally Posted by Joviex View Post
I feel a few people are not understanding what I am asking for here.


Tell me the difference between the following two lines of code:


function getSomething()
function getSomething()

At fist glance, NADA. When I run this through HG to commit, it is going to tell me that line 2 is different, hence a "change" from line #1. Why?


Because it has white space (20 extra spaces) at the end of the line.


It has nothing to do with obfuscation. I am definitely not advocating using a minify, like for javascript, to pack all the code into a single line =)
I could see where this would matter... In a large project that many different people are working on.

IMO - If you are developing by yourself and/or don't use git or a similar tool to track your code changes then this is a not really a big deal.
  Reply With Quote
04/24/14, 01:30 PM   #43
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Originally Posted by LilBudyWizer View Post
One is media libraries or databases where the size can be substantial.
LibMediaProvider only comes with media contained in the game files by default. If anyone wants to create an extra package of media for the library to pull from, that is a separately installed addon.

For databases, just like the library code, only one set will be retained in memory. The rest will not be. If your hard drive has 500GB on it, I don't see how 1MB makes a difference. If your computer has 8GB of RAM, I don't see how 1MB of static memory makes a difference (it will even disappear when the garbage collector runs next).

Originally Posted by LilBudyWizer View Post
The other is where the library provides an interface for the user. ZAM Stats is an example of that. It's not a library, but should be. It should be using LibStub and not ZAM_Stats. It really is a library with an example of using it.
Now this is not true. ZAM_Stats is a framework - an addon with an open API so that additional plugins may be created for and installed with it. It is in no way a library.

Originally Posted by LilBudyWizer View Post
I'm really baffled as to how Seerah avoids saved variables since, as far as I know, it's the only way to write a file.
I never said that I don't use saved variables. I said that I don't use ZOS's special saved variables API. Whatever the name of your saved variable is in the .txt file, whatever you set that to in your code, that variable will be saved upon /reloadui or logout. It works the exact same way in WoW.
  Reply With Quote
04/24/14, 01:31 PM   #44
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Originally Posted by Joviex View Post
When I run this through HG to commit, it is going to tell me that line 2 is different, hence a "change" from line #1. Why?
I have a "why" question, too. Why would you be running someone else's code through HG to commit?
  Reply With Quote
04/24/14, 06:40 PM   #45
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by Seerah View Post
I have a "why" question, too. Why would you be running someone else's code through HG to commit?
You mean like all the updating that Wykkyd does for the mhQuestTools for which I wrote an extension?


Everytime he updates, I have to first check for diffs in his own code.


one of his modules uses CR line endings, which makes it look like every single line changed since the module I commit uses CR+LF.


So, I first have to save the module he edited, with CR+LF, to make sure the diff runs correct.


Same for any stray whitespace, which is why, in SciTE I have a pre-time save that strips whitespace from the end of lines =)


I can deal with it, but we were, someone was, asking for standards. I consider that to be a standard, and, to the point above, nicer when you have multiple people say, working in/on a library of functionality that is shared.


If it is local and solo then do whatever the heck you want!
  Reply With Quote
04/24/14, 07:35 PM   #46
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
Something I have done with my latest addon is try to segregate the naming within my global namespace for the addon.

In it's simplest forms, where I have a namespace of MyAddon I add a table named .UI for all UI elements.

This means there is no chance of having naming issues where a UI control and a function have the same name

Lua Code:
  1. MyAddon = {}
  2. MyAddon.vars = ZO_SavedVars:NewAccountWide("MyAddon_SavedVariables", 1, nil, MyAddon.defaults)
  3.  
  4. MyAddon.UI = {}    -- Table for holding UI controls.
  5. MyAddon.UI.TLW = WINDOW_MANAGER:CreateTopLevelWindow("MyAddonTopLevelFrame")
  6. MyAddon.UI.TLW:SetAnchor(CENTER)
  7. MyAddon.UI.TLW:SetDimensions(200, 50)
  8.  
  9. MyAddon.UI.WindowTitle = WINDOW_MANAGER:CreateControl("MyAddonWindowTitle", myAddonTopLevelFrame, CT_LABEL)
  10.  
  11. function MyAddon.WindowTitle(myText)
  12.   MyAddon.UI.WindowTitle:SetText(myText)
  13. end

It helps me keep things tidy and is really handy when inspecting with zgoo.

MyAddon - the global namespace declared for the addon.
MyAddon.vars - this is the saved variables.
MyAddon.UI - this is for frames/controls.
  Reply With Quote
04/24/14, 07:57 PM   #47
Saucy
 
Saucy's Avatar
Join Date: Apr 2014
Posts: 20
Originally Posted by Joviex View Post
You mean like all the updating that Wykkyd does for the mhQuestTools for which I wrote an extension?


Everytime he updates, I have to first check for diffs in his own code.


one of his modules uses CR line endings, which makes it look like every single line changed since the module I commit uses CR+LF.


So, I first have to save the module he edited, with CR+LF, to make sure the diff runs correct.


Same for any stray whitespace, which is why, in SciTE I have a pre-time save that strips whitespace from the end of lines =)


I can deal with it, but we were, someone was, asking for standards. I consider that to be a standard, and, to the point above, nicer when you have multiple people say, working in/on a library of functionality that is shared.


If it is local and solo then do whatever the heck you want!
For my projects I use two files that "define and maintain consistent coding styles" [1]. It helps me keep consistency across all projects I make. I must admit I'm not 100% sure about the differences between CR+LF and LF or when/which to use. I know CR+LF is for Window's newlines.

.gitattributes is used for Git (I'm not sure if it exist something for SVN/etc).

[1]: http://editorconfig.org/

file: .editorconfig
Code:
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
file: .gitattributes
Code:
* text eol=lf
  Reply With Quote
04/24/14, 11:49 PM   #48
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by Saucy View Post
For my projects I use two files that "define and maintain consistent coding styles" [1]. It helps me keep consistency across all projects I make. I must admit I'm not 100% sure about the differences between CR+LF and LF or when/which to use. I know CR+LF is for Window's newlines.

.gitattributes is used for Git


I use mercurial and tfs, they both provide the same type of mechanism, however it does not fix inconsistent files using two different line feeds.


Which to the greater point is about having our establishing some standards.
  Reply With Quote
04/25/14, 05:24 AM   #49
Vicster0
 
Vicster0's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 82
Originally Posted by Joviex View Post
You mean like all the updating that Wykkyd does for the mhQuestTools for which I wrote an extension?
Everytime he updates, I have to first check for diffs in his own code.
one of his modules uses CR line endings, which makes it look like every single line changed since the module I commit uses CR+LF.
So, I first have to save the module he edited, with CR+LF, to make sure the diff runs correct.
Same for any stray whitespace, which is why, in SciTE I have a pre-time save that strips whitespace from the end of lines =)
I can deal with it, but we were, someone was, asking for standards. I consider that to be a standard, and, to the point above, nicer when you have multiple people say, working in/on a library of functionality that is shared.
If it is local and solo then do whatever the heck you want!
Maybe I'm crazy but I feel like the "standard" you are looking for here is something that has been historically sought after in the coding world for some time...

I think the issue you are highlighting here is less of an ESO UI Modification Standardization issue and more of a global code formatting issue. In my line of work, I regularly switch between Windows, Linux, and MacOS(yes, just still Linux, I know) systems, transferring files between them all many many times just in a single day. The CR+LF or LF only is something I need to be cognizant of at all times. I feel your pain, but I don't think it's a battle that needs to be fought here.

I believe we should be focusing on standards, conventions, and techniques where it relates to the code itself and less the formatting and white space.

This is quickly turning into a conversation about Indent/Bracing styles. A conversation that I personally LOATHE.

  Reply With Quote
04/25/14, 02:08 PM   #50
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by Vicster0 View Post
Maybe I'm crazy but I feel like the "standard" you are looking for here is something that has been historically sought after in the coding world for some time...

I think the issue you are highlighting here is less of an ESO UI Modification Standardization issue and more of a global code formatting issue. In my line of work, I regularly switch between Windows, Linux, and MacOS(yes, just still Linux, I know) systems, transferring files between them all many many times just in a single day. The CR+LF or LF only is something I need to be cognizant of at all times. I feel your pain, but I don't think it's a battle that needs to be fought here.
Sounds like you need a better system =) We use all 3 platforms as well, daily, and auto-translates happen when people push Xcode up or push from VS. That is more a tooling problem -- automation.

This is ultimately why I backed off the thread. Whitespace is a standard, as is any form of code formatting. Semicolons, line breaks after { }, how many indents for a tab, etc...

And while I love XKCD, it only applies outside your studio. For my studio, and the 20 engineers I supervise, they adhere to S&P for code, commits, design documentation, sizzle work, code analysis, requirement analysis, etc...

The point is: It is fully controllable in a controllable environment.

Here, obviously not +)

The ONE thing I think we can all agree upon: Global space should be "clean" so no one is stepping on someone else.

Otherwise, yes, if you want to use LF and 8 spaces for a single tab, kudos.


If you source is open, and sharable, it will just mean that when I integrate it, I will adhere it to my standards, which will cause me local problems on any updates/merges from subsequent updates you push in the future, that I want to incorporate.

That is also, simply, a local cost benefit analysis on whether someone wants to spend that time resource because it outweighs the benefit.

Thus, my long winded post, longer, I am advocating more for "MODULARITY" and libraries.

At least with a good library, code has the potential to have a larger group work on it, with a set standard, that you can expect, versus, picking through 5x iterations of the same idea, all with a different layout and verbiage.
  Reply With Quote
04/25/14, 05:17 PM   #51
Vuelhering
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 169
Originally Posted by Joviex View Post
For my studio, and the 20 engineers I supervise, they adhere to S&P for code, commits, design documentation, sizzle work, code analysis, requirement analysis, etc...

The point is: It is fully controllable in a controllable environment.

Here, obviously not +)
Right-o.

I have written coding standards for businesses and tons of procedural specifications.
And the big difference was that all those people, and me, were being paid to adhere to them.

When I, or you, or anyone is doing their own addon even if they plan on releasing it, the only obligation they have is to themselves. If they plan on making money, or having it be popular, or whatever then (and only then) they have an obligation to their users.

When they are coding in a team, then they have an obligation to their team members.

But at no point do they have an obligation to other addon programmers.
  Reply With Quote
04/25/14, 11:12 PM   #52
LilBudyWizer
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 32
Originally Posted by Joviex View Post
I feel a few people are not understanding what I am asking for here.


Tell me the difference between the following two lines of code:


function getSomething()
function getSomething()

At fist glance, NADA. When I run this through HG to commit, it is going to tell me that line 2 is different, hence a "change" from line #1. Why?


Because it has white space (20 extra spaces) at the end of the line.


It has nothing to do with obfuscation. I am definitely not advocating using a minify, like for javascript, to pack all the code into a single line =)
You misunderstand me. Run it through a program that strips out unnecessary white space, blank lines and comments then run the output of that program through diff. Programmer automate thyself. By the time a programmer could get through checking for extraneous white space on 100 lines a program could process millions of lines. You have a computer, use it.
  Reply With Quote
04/26/14, 12:22 AM   #53
LilBudyWizer
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 32
Originally Posted by Seerah View Post
LibMediaProvider only comes with media contained in the game files by default. If anyone wants to create an extra package of media for the library to pull from, that is a separately installed addon.

For databases, just like the library code, only one set will be retained in memory. The rest will not be. If your hard drive has 500GB on it, I don't see how 1MB makes a difference. If your computer has 8GB of RAM, I don't see how 1MB of static memory makes a difference (it will even disappear when the garbage collector runs next).


Now this is not true. ZAM_Stats is a framework - an addon with an open API so that additional plugins may be created for and installed with it. It is in no way a library.


I never said that I don't use saved variables. I said that I don't use ZOS's special saved variables API. Whatever the name of your saved variable is in the .txt file, whatever you set that to in your code, that variable will be saved upon /reloadui or logout. It works the exact same way in WoW.
What LibMediaProvider does and what all possible addons might do are two totally different topics. I was using media generically, i.e. movies, pictures and sound, and not referring specifically to LibMediaProvider. More generally I meant if a library is physically large it should be distributed separately. Media files is the only thing I can think of that might be large. Scripts certainly are not going to be. Databases could be. I think, in general, an addon should be standalone with no dependencies, but there's one exception. I wasn't talking about 1MB, but hundreds of megabytes.

With ZAM Stats it's a matter of opinion. The author could have distributed it as a library. There is absolutely nothing preventing him from doing so. We seem to both agree that's an exception and he really shouldn't have. Whether we call a framework a special type of library that is in no way a library or makes not a bit of difference to the point. My point is that the standard should be whether a user directly interacts with the addon independent of any addon using it. ZAM Stats is a prime example of that. You have configuration options that apply to all addons. It makes no sense to have 20 paths to that because you have 20 panels installed. It only makes intuitive sense to a user to configure those 20 panels through one addon that is ZAM Stats. My opinion though is it's a library, a framework is a library, a particular type of library. One of the two types of libraries it is preferable a developer distribute standalone. Physically large ones being the other exception.

I didn't know that about saved variables. Personally, it shouldn't be so. The only that should be accessible is what an addon should see. I would love to hear a compelling argument for not using those functions because arrogance is the only reason I can think of. I've been a programmer for 30 years and I've certainly engaged in my fair share of arrogance and been bitten in ass for it many times as well. Putting it in assembler seemed a good idea at the time, but ten years down road the guy stuck supporting it calls me about it and it doesn't seem such a good idea any more.
  Reply With Quote
04/26/14, 12:27 AM   #54
Vicster0
 
Vicster0's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 82
Originally Posted by Joviex View Post
Sounds like you need a better system =) We use all 3 platforms as well, daily, and auto-translates happen when people push Xcode up or push from VS. That is more a tooling problem -- automation.
Unfortunately, there is no better system for us - I work in enterprise storage and the differences are because of going form one storage system or compute node to another and then to my workstation, a server, or my laptop. Though I do develop software to "assist" my team and myself, I am by no means a software engineer by trade thus, it's not my work.

As far as the rest goes, I totally agree with you. I think the objective of the standards and conventions being discussed in this thread is one of avoiding stepping-on-toes, as it where. Which obviously deals mostly with the manner in which you declare and use globals and their naming, the usages and inclusion of libraries, etc.

And of course, if you work on a team of authors - much like the matter of being a software engineer for a living - I would highly suggest discussing and deciding on standards regarding styles and whitespace... amongst yourselves. :P In a controlled environment, this is something that not only should be done, must be done. On this scale, it's basically a moot point.
  Reply With Quote
04/26/14, 03:01 AM   #55
LilBudyWizer
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 32
I don't really see it as any different than in the enterprise. You don't have control over the programmers. Haha if you think you do in the enterprise. You can enforce standards in the enterprise. Only in your dreams. This is no different than having 3K programmers in an enterprise. You have amateur programmers. What do you think a end user writing a macro for an excel spreadsheet is? Even if you're CIO you cannot dictate from on high that everyone is going to rewrite their code to conform to your standard because you don't have the budget for it. That CEO, COO and CFO trump your ass when they can't run the cash registers in the store because you have all your programmers reformatting comments. This, really, no different than the enterprise.
  Reply With Quote
04/26/14, 03:50 PM   #56
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Originally Posted by LilBudyWizer View Post
With ZAM Stats it's a matter of opinion. The author could have distributed it as a library. There is absolutely nothing preventing him from doing so. We seem to both agree that's an exception and he really shouldn't have. Whether we call a framework a special type of library that is in no way a library or makes not a bit of difference to the point. My point is that the standard should be whether a user directly interacts with the addon independent of any addon using it. ZAM Stats is a prime example of that. You have configuration options that apply to all addons. It makes no sense to have 20 paths to that because you have 20 panels installed. It only makes intuitive sense to a user to configure those 20 panels through one addon that is ZAM Stats. My opinion though is it's a library, a framework is a library, a particular type of library. One of the two types of libraries it is preferable a developer distribute standalone. Physically large ones being the other exception.
I am the author of ZAM Stats. ZAM Stats is an independent addon. The user interacts directly with ZAM Stats. It has 3 base modules, and allows for more to be added. I'm starting to think that you haven't looked at how the addon works or even used it. Just because something has an API, doesn't mean it's a library. Just because something is modular, doesn't mean it's a library.

Originally Posted by LilBudyWizer View Post
I didn't know that about saved variables. Personally, it shouldn't be so. The only that should be accessible is what an addon should see. I would love to hear a compelling argument for not using those functions because arrogance is the only reason I can think of. I've been a programmer for 30 years and I've certainly engaged in my fair share of arrogance and been bitten in ass for it many times as well. Putting it in assembler seemed a good idea at the time, but ten years down road the guy stuck supporting it calls me about it and it doesn't seem such a good idea any more.
It's not arrogance. It's how the game works. All the API does is allow for what the ZOS devs wanted to use for their profile support. These functions weren't even in the released API, they were dug out. If I wanted to create my options on my own rather than use LAM, you wouldn't call that arrogance, for example.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Addon Etiquette

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off