two dropdown menus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Cornford

    #31
    Re: two dropdown menus

    Matt Kruse wrote:[color=blue]
    > Richard Cornford wrote:[color=green]
    >> You comments so far centre on the way my script is not configurable
    >> to every permutation of possible deployment.[/color]
    >
    > My comments point out common requirements for developers around the
    > world trying to implement a date-picker popup. Having had my date
    > picker available for qutie some time, and having received hundreds of
    > suggestions and feature requests,[/color]

    What proportion have you fulfilled? Did you notice the post today form
    someone who wants to drag select a range of dates? I wonder how that
    would work for month/year spanning ranges but I can see it being a very
    realistic requirement. For example, an Intranet application for booking
    holidays where nobody would ever be entitled to more than, say, 8 weeks
    off at a stretch, and so the interface would never have to span more
    than 3 months of dragged selection.

    <snip>[color=blue]
    > ... . Surely no one can meet all requirements that anyone might
    > have. But solving the vast majority of typical requirements is
    > definitely possible.[/color]

    Surly it is entirely possible to meet all requirements that anyone might
    have (assuming that they are technically achievable) because no matter
    what those requirements may be they will be specific and finite. Your
    problem is that it is not practical to meet all possible requirements in
    one piece of javascript all at the same time.
    [color=blue]
    > My point in raising those questions was to show that your
    > solution is very specific to a single set of requirements,[/color]

    As it was designed to be.
    [color=blue]
    > and therefore not very useful to very many people.[/color]

    As long as it is useful in the context for which it was created then it
    is doing its job.

    <snip>[color=blue]
    > This is not to knock
    > your solution - it may be _perfect_ for someone. The point is to
    > examine what 'value' each of our aproaches offers to potential
    > developers who wish to implement a date picker.
    >
    > If someone wishes to implement a date picker using your philosophy of
    > javascript development, they would need to download your code,[/color]

    Someone using my "philosophy of javascript" would have no need to be
    downloading my example. They would start by reading their specification,
    then design their script, then they would write it themselves.
    [color=blue]
    > fully understand it (and it is unreadable to most people),[/color]

    That would do nobody any harm, but it is not necessary.
    [color=blue]
    > then customize it to add the required functionality.[/color]

    It would almost certainly be more efficient (in terms of time to
    implement and the resulting code) to design the script for the
    requirements that apply to it than try to customise a script designed
    with different requirements.
    [color=blue]
    > This could be very time-consuming.[/color]

    Trying to reverse engineer a script that you don't understand and then
    get it to do something other than what it was designed to do would be
    very time consuming. You will be hard pressed to find anyone
    recommending that as a development strategy.

    However, given a repertoire of well tried and tested low level
    functions/components/objects, an understanding of the design issues and
    a familiarity of common patterns in implementation, creating a specific
    script for the context and specification doesn't have to be that time
    consuming at all.
    [color=blue]
    > Or, they could download my library, customize the display with a few
    > lines of code using built-in parameters and methods, and have their
    > requirements met in a few minutes. And have the date picker work on a
    > wider range of browsers.[/color]

    Assuming that there specification was achievable within the inevitably
    limited features of your library. Otherwise they stand a very good
    chance of not being able to find them implemented in any library and
    either having to find an expert to implement it for them or wishing they
    had learnt how to do it themselves.
    [color=blue]
    > At the expense of an additional few kb of code 'bloat'.
    >
    > If you were a non-expert developer ...[/color]

    As I said, amateurs can do as they like, they have no responsibility to
    others. Professional and non-expert do not sit well together, though I
    cannot deny that web development is full of people for whom "non-expert
    developer" would be a very good title (but I doubt they would appreciate
    it).

    Server-scripting some years ago, a client decided that one of our web
    applications needed a facelift beyond what could be accommodated in the
    style sheets. They commissioned a firm of HTML designers to create
    templates for all of the interface pages and then had us install the
    server-side logic into the templates.

    Not in itself a bad idea, but the HTML designers unfortunately fell into
    a category that would deserve the title "non-expert". At the time I had
    been playing with GIF files and their format, and had written a
    loss-less batch GIF re-compressor. It did no more than identify which
    colours where actually used in a GIF image and re-arranged to color
    table and image to color table mappings so that the table was a size
    that accommodated all of the colours used, but was no bigger,
    re-encoding the image using that new color table. Running the images
    directory that came with the HTML templates through my re-compressor
    reduced the total size of that directory to (literally) 1/10 of the size
    that it was originally (without changing the color of a single pixel in
    any of the images within it). The originals had all been created with
    256 item color tables (the maximum for GIF) regardless of the number of
    colors used.

    The images themselves had been created without any grasp of what was
    appropriate for their application. A common background color carried
    over from the HTML to the images, and expressible in the CSS as a
    six-character hex color value, was reproduced in the images as a four
    color random dither pattern. GIF colors are 24 bit, it could have been
    one flat color instead of a pattern of four, and if it had been the GIF
    compression algorithms would have packed those background regions down
    to a tiny fraction of there actual size (and the color tables could have
    been even smaller as well). Just in the images alone we were looking at
    total bandwidth wastage of two orders of magnitude.

    The HTML was no better; tables within tables within tables. Our project
    manager looked at all this and said: "it is what the client has provided
    and we are not being paid to fix it", so we did our jobs and delivered
    to schedule. The client withdrew the site after a month and reverted to
    the old one because they were fed up with fielding complaints from their
    users that the new version was too slow to be useable (making the whole
    exercise a total waste of money for them).

    And that is what you get from professionals who turn out to be
    "non-expert developers"; script bloat on top of image bloat on top of
    HTML bloat. It doesn't do the users any good, and it doesn't do the
    clients any good, no matter how convenient it may be for those
    "profession als" never to have to learn the skills they purport to be
    selling.

    <snip>[color=blue]
    > You have offered a solution which meets the requirements of very
    > very few developers. I have offered a solution which meets the
    > requirements of thousands of developers.[/color]

    I have no interest in meeting the requirements of thousands of
    developers. I have an interest in meeting the requirements of a
    specification, and doing the best job of that I can of that.

    <snip>[color=blue][color=green]
    >> I notice that you assert that this additional flexibility can be
    >> accommodated in 5K.[/color]
    >
    > Your code is 23k, mine is 34k. So, I estimated wrong - an additional
    > 11k is required. But that also adds many more features than what I
    > noted ;)[/color]

    When I look at you calendar example page I find it importing a 58K JS
    file. Because it has dependencies on - PopupWindow -, -date - and -
    AnchorPosition - (oddly your dependency list for CalendarPopup doesn't
    list - date - but uses its functions anyway). While examining my file
    would reveal that my date picker code employs:-

    InitializeMe
    getElementWithI d
    associateObjWit hEvent
    getSimpleExtPxI n
    HideCovered (needs getSimpleExtPxI n (or equivalent interface))
    compatModeTest
    getWindowState (needs compatModeTest)

    - as independent low-level components that it is depended upon. As low
    level components they stand a reasonable chance of also finding
    themselves
    being used by other non-date picker code in any actual deployment. In
    much the same way as you might argue that - PopupWindow -, -date - and -
    AnchorPosition - could. Though the lower the level of the component the
    more likely it is to find use in other code.

    But for purposes of comparison it would be more reasonable to compare
    your 58K deployment code against my 23K, or your 35K date picker
    specific code against my 15K date picker specific code. With those
    numbers we see a difference exceeding the size of the smaller.

    Although a more meaningful comparison would run both through a JS
    minimiser of some sort and compare what come out to provide a measure of
    unavoidable differences, as large blocks of comments don't really need
    to be being sent to the user, and so impacting on bloat comparisons
    (unless copyright restrictions require them to remain)). And the
    minimiser would have to be a version that re-wrote identifiers so that
    the differences in identifier naming styles was also removed from the
    comparison.

    But it remains the case that I can produce a date picker implementing
    any specific features required, including any not already covered by
    your library, and come up with something more or less the same size,
    because different requirements would displace the code need for other
    approaches. While if your library wants to cover new requirements it
    needs additional features and you have no choice but make it bigger.

    Richard.


    Comment

    • Matt Kruse

      #32
      Re: two dropdown menus

      Richard Cornford wrote:[color=blue]
      > What proportion have you fulfilled?[/color]

      I would say 80-90% of the requests I get are now covered by the library. I
      only implement those features that might be useful to a number of people (or
      myself). If there are unusual or unique requirements, I instruct the
      developer where additional code could be plugged in.
      [color=blue]
      > Did you notice the post today form
      > someone who wants to drag select a range of dates?[/color]

      Nope. That would be cool, though :)
      But I'd still prefer a "start date" and "end date" interface.
      [color=blue]
      > Your problem is that it is not practical to meet all possible
      > requirements in one piece of javascript all at the same time.[/color]

      It is practical to meet most of the possible requirements, and that's my
      goal.
      [color=blue][color=green]
      >> If someone wishes to implement a date picker using your philosophy of
      >> javascript development, they would need to download your code,[/color]
      > Someone using my "philosophy of javascript" would have no need to be
      > downloading my example. They would start by reading their
      > specification, then design their script, then they would write it
      > themselves.[/color]

      Of all the web developers out there, I would bet that only a small fraction
      could implement a date picker resembling either one of our solutions. If
      everyone wishing to have javascript functionality needed to write their code
      from scratch (or pay someone to do so) then there wouldn't be much js out
      there.

      Expecting code to be designed and written from scratch is incredibly
      unrealistic, IMO. Even if you think that is the way things should be, you
      will _always_ be in the minority. If you wish to code for the minority, then
      that's your approach. My approach is to give the greatest value to the
      greatest number of people. There will always be a market for my approach.
      [color=blue]
      > I have no interest in meeting the requirements of thousands of
      > developers. I have an interest in meeting the requirements of a
      > specification, and doing the best job of that I can of that.[/color]

      Which is where we fundamentally differ. But while I say your approach is
      fine - just not what I choose, you say that my approach is fundamentally
      flawed. *shrugs*

      I've found that distributing my code to thousands of users has a lot of
      benefits:

      1) It makes me consider situations and environments I otherwise might have
      not thought of, making my solution more robust for my own future use

      2) It encourages me to add features that I might otherwise have skipped, and
      in turn give me a more powerful tool to use on my own. I've added features
      to scripts before, thinking it was an odd requirement. Then later, realized
      I did have a use for the same thing, and it was already coded.

      3) It benefits me personally by bringing traffic to my site and even being
      quite nice financially, via donations.

      I enjoy building tools more than anything. Small nuggets which perform
      specific tasks in the best way possible, which can be plugged into
      applications. In and of itself, a date picker is useless. But it's a tool to
      be used to achieve a higher goal, and that's what intrigues me.
      [color=blue][color=green]
      >> Your code is 23k, mine is 34k. So, I estimated wrong - an additional
      >> 11k is required. But that also adds many more features than what I
      >> noted ;)[/color]
      > When I look at you calendar example page I find it importing a 58K JS
      > file.[/color]

      Indeed, the example page currently links to the uncompressed version of the
      code. Usually my examples link to the shortened version. For the calendar
      popup, the condensed version is 34k.
      [color=blue]
      > (oddly your dependency list for CalendarPopup doesn't
      > list - date - but uses its functions anyway).[/color]

      It's optional, for date formatting. If the user wishes to use that features.
      [color=blue]
      > - as independent low-level components that it is depended upon. As low
      > level components they stand a reasonable chance of also finding
      > themselves being used by other non-date picker code in any actual[/color]
      deployment. In[color=blue]
      > much the same way as you might argue that - PopupWindow -, -date -
      > and - AnchorPosition - could.[/color]

      And that's exactly why they are separate libraries - because they serve
      separate, independent functions. Inside of each of those libraries are other
      smaller functions which are reusable, too.
      [color=blue]
      > Although a more meaningful comparison would run both through a JS
      > minimiser of some sort[/color]

      As I do for all my code. I have "Original" which is fully commented,
      "Compact" which is stripped of whitespace, etc, "Combined" which combines
      all dependencies into one file, and "Combined & Compact" which does that and
      also minimizes. For debugging, the original is preferred, and for production
      the compact is preferred.
      [color=blue]
      > And the minimiser would have to be a version that re-wrote
      > identifiers so that the differences in identifier naming styles was
      > also removed from the comparison.[/color]

      That's leaning more towards an obfuscator ;)

      I could also trim code out of the combined code which isn't required by the
      calendar popup, and make it even smaller. But I'm not that worried about
      size. [heh]
      [color=blue]
      > While if your library wants to cover new requirements it
      > needs additional features and you have no choice but make it bigger.[/color]

      And that wouldn't bother me. :)

      At some point, if the script gets too big, I'll probably offer a "simple"
      version and a "fully-featured" version.

      I've even toyed with the idea of a page where you select which features you
      need, and it intelligently builds the script for you, based on smart
      comments and dependency listings within the code. That would be cool, IMO.
      All the benefits of a big full-featured library, but with the smaller
      footprint of code written for a specific situation. I don't even think the
      concept would be that difficult to implement. It just takes more time...

      --
      Matt Kruse
      Javascript Toolbox: http://www.JavascriptToolbox.com/


      Comment

      • Richard Cornford

        #33
        Re: two dropdown menus

        Matt Kruse wrote:[color=blue]
        > Richard Cornford wrote:[/color]
        <snip>[color=blue][color=green]
        >> Did you notice the post today form
        >> someone who wants to drag select a range of dates?[/color]
        >
        > Nope. That would be cool, though :)
        > But I'd still prefer a "start date" and "end date" interface.[/color]

        You might prefer it, you might even explain that it would be easier to
        understand, but if the client wants drag selection of date ranges and
        cannot be persuaded otherwise then someone is going to have to implement
        it. That makes it a good idea for anyone likely to be on the receiving
        end of the requirement to be able to create it themselves, or be
        prepared to find (and fund) someone who can.
        [color=blue][color=green]
        >> Your problem is that it is not practical to meet all possible
        >> requirements in one piece of javascript all at the same time.[/color]
        >
        > It is practical to meet most of the possible requirements,
        > and that's my goal.[/color]

        Until you are in a position to identify *all* possible requirements it
        is not possible to tell if any finite subset represents most of them. A
        goal of implementing all of the common requirements makes sense, but it
        makes exactly as much sense for any other date-picker library so
        anything outside the common requirements stands a good chance of needing
        a specific implementation.
        [color=blue][color=green][color=darkred]
        >>> If someone wishes to implement a date picker using your philosophy
        >>> of javascript development, they would need to download your code,[/color]
        >> Someone using my "philosophy of javascript" would have no need to be
        >> downloading my example. They would start by reading their
        >> specification, then design their script, then they would write it
        >> themselves.[/color]
        >
        > Of all the web developers out there, I would bet that only a small
        > fraction could implement a date picker resembling either one of our
        > solutions.[/color]

        Web developers cover a considerable range of skills. HTML/CSS
        specialists, server-side scripting specialists, etc, largely could not
        implement a javascript date-picker. It would make about as much sense
        asking them to as it would to ask an HTML/CSS specialist to write an
        EJB. But for people who know javascript and a bit of DHTML it isn't a
        massive problem. It is basically putting the days of a given month into
        appropriate positions in a grid, showing it to the users and doing
        something when the user clicks on a number. The specification should
        fill in any other interface requirements and that just leaves a number
        of issues to be handled that may or may not become significant depending
        on the context of use.

        OK, there are not that many who could do it the way I did (and not all
        of those would choose to), and there will be some who haven't got to
        grips with basic javascript objects sufficiently to do it your way. But
        a date picker could be implemented in a purely procedural way and do its
        job adequately. There may be objectively better of worse ways of
        designing a date picker scripts, and more or less skilled
        implementations possible, but I am inclined to think that someone who
        could not make one at all should not be working in a client-side
        scripting related capacity on a web site (working in the sense of; in a
        professional capacity).
        [color=blue]
        > If everyone wishing to have javascript functionality
        > needed to write their code from scratch (or pay someone
        > to do so) then there wouldn't be much js out there.[/color]

        When the vast bulk as the copy and paste javascript code that is out
        there is somewhere between poor and actively harmful that wouldn't
        necessarily be a bad thing.
        [color=blue]
        > Expecting code to be designed and written from scratch is incredibly
        > unrealistic, IMO.[/color]

        Nobody but a complete beginner would write anything from scratch. The
        process of acquiring any level of skill in javascript entails the
        creation of numerous scripts of various sorts, and it doesn't take long
        to start seeing recurring patterns and re-using existing functions
        instead of re-writing them. How far that gets taken would depend on the
        level of experience of the programmer and their grasp of applicable
        programming design practices and the like.
        [color=blue]
        > Even if you think that is the way things should be,
        > you will _always_ be in the minority.[/color]

        Maybe, there is always considerably more potential for things to be done
        badly than well.
        [color=blue]
        > If you wish to code for the
        > minority, then that's your approach.[/color]

        Being in a minority is not the same as coding *for* a minority. How does
        cross-browser coding aimed at achieving 100% reliability, combined with
        exploiting the maximum of available script functionality from any
        browser, qualify as coding for a minority? There are two groups that I
        should be coding for, the users (of the browser) and the client
        (individual or company). For the first group I am very patently coding
        for the majority (in trying to accommodate all of them) and coding for
        the second group is obviously coding for a minority as they are each an
        distinct entity.

        <snip>[color=blue]
        > Which is where we fundamentally differ. But while I say your approach
        > is fine - just not what I choose, you say that my approach is
        > fundamentally flawed. *shrugs*[/color]

        Yes, the fundamental flaw is that you want to place in the hands of
        someone with negligible browser scripting skills a lump of functionality
        wrapped up in a form that they will find easy to deploy, and then expect
        that individual to asses the suitability of it for the context of its
        use, comprehend the consequences of its design (the code bloat an so
        on), recognise and mitigate any dependencies by implementing suitable
        browser testing and clean degradation and basically sort out everything
        pertinent to any application of the library in a specific context.

        These are mutually exclusive anticipations, the people who the libraries
        are targeted at don't have the skills to even recognise the consequences
        of what they are doing let alone handle them. The consequences of
        needless javascript dependencies, pop-up window use, restricted browser
        support, etc. are going to carry right through deployment straight onto
        public web sites, where they will start detracting from the usability of
        those sites, and from there they will detract from the achievement of
        the aims of whoever commissioned the site (be they commercial or
        otherwise). The client may never notice this; they way be completely
        happy with the outcome (only ever viewing their site on javascript
        enabled IE 6 and anticipating that the rest of the world dose likewise),
        but that doesn't mean that it didn't happen or that its impact isn't
        negative.

        So in the end all you might be doing is saying to someone who doesn't
        know any better "here is something that you can use to give your client
        (who doesn't know any better either) the impression that you have done
        your job, without any knowledge or effort on your part". And yes, that
        is going to be very appealing to probably many thousands of "non-expert
        developers". But using the library alone doesn't mean they have done
        their job.

        There will inevitably also be circumstances where a completely competent
        developer decides that your library entirely fits the context of its use
        and deploys it in a way appropriate to that context. I suspect those
        developers will also be in a minority.
        [color=blue]
        > I've found that distributing my code to thousands of users has a lot
        > of benefits:
        >
        > 1) It makes me consider situations and environments I otherwise might
        > have not thought of, making my solution more robust for my own future
        > use[/color]

        Yet somehow you missed the possibility of browsers having javascript
        switched off or not supporting it, their ability (and the need for)
        scaling fonts, and the existence of entire categories of javascript
        capable browser.

        <snip>[color=blue]
        > 3) It benefits me personally by bringing traffic to my site
        > and even being quite nice financially, via donations.[/color]
        <snip>

        There is nothing like a financial incentive. Didn't someone mention
        cigarettes recently?

        Richard.


        Comment

        Working...