Support » Plugin: Bug Library » Developer Necessities

  • Great concept. I would also be interested in even helping you develop this plugin. Simply because it is a great head start on something I already need myself. However, it’s current state has some serious design flaws. So I have made a little thing below for you to read. These are the things I will be changing within the plugin for my own site’s usage. I have also commented on why it is important to make these changes.

    Tip: NEVER use ID’s unless it is a single component on a page.
    Comment: When trying to iterate over multiple items on a page using jQuery
    cannot find more than one instance of an ID. Items must be found through a class instead. Meaning, #odd or #even, trying to change the background color using jQuery.css() will find the first instance and quit. Even if done from within a jQuery.each() it will find the first instance and abort leaving all other items un-touched. Iterations can only be done via a class. The easy way to remember this is only a single instance can have an ID. just like a database, you cant have 2 items with the same ID.

    Let’s put it this way. ID’s are actually so rarely used for this reason you never find them in professional code.

    To prove my point, wordpress templates, made by wordpress, have #page & #respond but everything else is a class.

    http://wordpress.org/extend/plugins/bug-library/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am confused. You have done some pretty advanced things in your plugin. Your code does not speak amateur by any means. Just the logic. I seriously hope I am not offending you because I mean no harm whats-so-ever! You have done a good job at making sure every item spit out has a method to reference. Meaning, some people forget to wrap certain items with either a div, span or even give a table a class or ID. You have made sure every item has a wrapper, it’s just that you have applied names in either the wrong place or given something an ID that should be a class. Otherwise you did go through the trouble to be particular about the items. Do you see why I am confused?

    Let’s put it this way… If you said to me you are a newbie I would not be surprised. But when reading your code I would assume you are advanced and been around a while. But then I see ID’s from hell makes me think you are not versed on JavaScript, yet you have JavaScript in your code already.

    Well… anyway… I don’t know you.. but I want to talk to you for some reason. You must be like a genius at an early stage or age or something like that. I am compelled to talk to you about this plugin.

    My name is Cory and I live in the state of Florida in the USA.

    Alright, I’ll bite…

    Part of the beauty of an open-source system is that we have developers of all skill levels contributing en masse to help make the world a better place. Everybody is at a different level of programming competence, and it’s not really fair to call someone a noob purely on the grounds that they used a coding convention that you would deem inappropriate, whether it is correct or not. I might even go so far as to say that such remarks are irrelevant and counter-productive – this is a support queue, not a complaints line, and YOU are the one asking for a favor.

    After all, if you can do it better… why don’t you? A simple answer might be because it takes time, probably time that you don’t have. So instead of making off-topic remarks, let’s focus on the core issue and be appreciative of the time it took to create this plugin. Talking down to people makes you come across as having an inflated ego and that sets others up to discriminate against you.

    That said, your tone comes across well and is generally supportive, so thank you on that front! It is way too easy to come across as a jerk when one might simply trying to provide constructive feedback.

    In the spirit of providing constructive criticism and working towards a solution, let’s see if we can turn this around!

    < /hypocritical off-topic rant >

    I’m starting to dig into this plugin as well and having difficulty applying some custom scripting to the plugin filters. Having all of these elements set to IDs instead of classes makes it challenging to write efficient Javascript selectors!

    It also seems that some of the HTML structure forces the display of some elements in ways that work against established styles.

    • Would it be possible to convert the ID items to classes?
    • Could we add extra classes to aid in addressing items?
    • Some of the wrapper attributes are counter-intuitive, could these be grouped more appropriately?
    • Would it be a better idea to let themes style list items instead of forcing <br /> tags into the page structure?

    As an example, the id bug-library-filter-currentproduct appears twice in the filters list. While this is technically invalid HTML since ID attributes should be unique, it would be totally valid as a class! It looks like there are some even-odd attributes set as IDs as well that could benefit from a class conversion.

    Sometimes it can be tough for developers to work around forced line breaks. I’m currently styling the filters and attempting to create a more horizontal layout, and having breaks at the end of each line makes it hard to accomplish. I could use CSS to display:none the <br /> elements, but then what if those elements were needed for a single section? Perhaps it is easier to let themes decide how to display elements… and that means less work for the plugin developer as well! As an alternative, elements can be styled for block or inline display to produce desired results.

    A very minor adjustment might be to move the bug-library-currentfilters div into the bug-library-filters div to provide structure consistency. This is a totally cosmetic change though and is subjective to the author.

    Here’s a proposed update to the bug-library.php file: http://pastebin.com/s2BXaAia. This file cleans up some of the filter HTML – it doesn’t touch the rest of the code, but it might serve as an example for how classes could work just as well (if not better) than IDs.

    I do see that there are more areas in this file with numerous &nbsp; characters that could probably have some restructuring applied as well, but… I don’t have time right now 😀

    @yannick – thanks for your hard work on this plugin!

    @cory – thanks for opening this topic! I’m Eric, and I live in Victoria BC, nice to meet you 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Developer Necessities’ is closed to new replies.