Open question - leverage all features liberally, or be selective?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David W. Fenton

    #31
    Re: Open question - leverage all features liberally, or be selective?

    nospam@nospam.n ospam (Steve Jorgensen) wrote in
    <esbcmvo1edtu16 7bol6o48o0p2vl0 esdif@4ax.com>:
    [color=blue]
    >On Mon, 15 Sep 2003 20:33:00 GMT, dXXXfenton@bway .net (David W.
    >Fenton) wrote:
    >
    >...[color=green]
    >>
    >>These are my principles, which I think are in agreement with
    >>yours, but you have different emphasis:
    >>
    >>1. code for the task at hand.
    >>
    >>2. code in a fashion that will require minimal change if the code
    >>needs to be enhanced.
    >>
    >>We agree on that, but where we disagree is on how much work goes
    >>into determining #2. I think you need to think carefully about
    >>structure before you implement and make sure that you do as much
    >>as you can to structure your code to make it independent of
    >>future changes.
    >>
    >>And example from last week:
    >>
    >>I had hired somebody to do a little work for me and when I got
    >>the results, he had followed my instructions, insofar as I'd been
    >>clear, but he'd done it in a fashion that was not as flexible as
    >>what I wanted. It involved creating a dialog form to collect the
    >>required fields for adding a new record to a person table. My
    >>approach to dialogs is that the dialog knows *nothing* about the
    >>environment outside itself. Secondary to that is that the dialog
    >>itself should be called from one piece of code only, so that the
    >>only code that knows anything about the dialog is the code that
    >>opens it and closes it (though a multi-purpose dialog may have
    >>more than one calling code context).[/color]
    >
    >Well, I would argue that it's OK to do something simple that works
    >for a single case, then extend it when (and if) the second case
    >arises. . . .[/color]

    What if you are pretty damned sure the second case will arise?

    What if it doesn't take any more work to code for the second case
    than it does to code for the first?
    [color=blue]
    > . . . When the second case comes along, I would approach it
    >with the strategy of "Rape and paste, then refactor".
    >Here, you simply cut and paste the code, form, etc., change what's
    >different for the second case, then gradually refactor out
    >duplication between the cases starting with the lowest hanging
    >fruit (biggest chunks that are easiest to grab). When you're
    >done, you have basically the goal you were describing above.[/color]

    I think it's easier to choose an architecture that has no
    unnecessary dependencies on the specifics of its initial
    implementation.

    In schema design, say you had an application where in the original
    design, everyone was absolutely certain that there'd never be a
    need for more than one address per person. So, you put the address
    in the Person table, and then they decide they need a second
    address, so then you move to a 1:N address table and restructure
    the existing data accordingly.

    If you'd put the address in a 1:1 table, though, you would have had
    very little work to change the relationship to 1:N. You might think
    that implementing the 1:1 address would require a more complex UI,
    but it actually doesn't at all -- you just join the address table
    in the recordsource of your person form and plop the fields on your
    form. When you convert to 1:N, then you have to change the
    recordsource to take out the join to the address table and create a
    subform for the addresses and remove the existing address fields
    from your Person form.

    Do you do all the work preparing for the change on the front end?

    ABSOLUTELY NOT.

    But you choose a STRUCTURE that gives you maximum flexibility along
    lines that are foreseeable at design time.

    In terms of implementation, the 1:1 address table takes no more
    time than putting the fields in the Person table. In terms of UI,
    it is indistinguishab le to the users. But in terms of flexibility,
    you save all that time restructuring existing data. Also, if you
    got any lookup routines that use addresses, you don't have to
    revise those in any significant way when you change to 1:N for the
    addresses.

    To me, it's a no-brainer -- you do the 1:1 table on the front just
    in case you need 1:N later, and the *cost* of doing so is basically
    nothing.

    That's the kind of situation I'm talking about, where you have a
    choice between two methods that take the same amount of time to
    implement (more or less), but one of which allows more future
    flexibility, *even if you end up never needing it*.
    [color=blue]
    >While refactoring, look for any functionality similar to something
    >that exists elsewhere in the code, and use it if it's pluggable.
    >If it's not pluggable, add a comment there, finish the current
    >refactoring cycle, then go back to the comment and refactor again
    >to remove duplication with the other code. Repeat until beauty
    >arises.[/color]

    If the basic structure is there already, you don't have to do
    nearly as much reworking, as in the schema example above.
    [color=blue][color=green]
    >>Now, the problem with the code I got from this programmer was
    >>that he had rightly separated out the opening of the form to
    >>collect the information for the add in one subroutine and then
    >>placed the actual record addition in a different subroutine
    >>called from the first. That's good practice, because you may end
    >>up needing to do the record addition from different contexts
    >>(and, as it turns out, that's precisely the case). But the
    >>problem was that the subroutine for adding the record was
    >>hardwired to the fields on the dialog form. So, roughing it out,
    >>you had something like this:
    >>
    >> Public Sub AddPersonDialog ()
    >> DoCmd.OpenForm "dlgAddPerson", ,,,acDialog
    >> [check if you're supposed to add]
    >> Call AddPerson
    >> End Sub
    >>
    >> Public Sub AddPerson()
    >> Dim strSQL as String
    >> Dim strValues as String
    >>
    >> strValues = VALUES (" &
    >> strValues = "'" & Forms!dlgAddPer son!txtFirstNam e & "', "
    >> strValues = strValues & "'" & Forms!dlgAddPer son!txtLastName
    >> _
    >> & "'"
    >> strSQL = "INSERT (FirstName, LastName) INTO tblPerson"
    >> strSQL = strSQL & " VALUES(" & strValues & ");"
    >> dbCurrent.Execu te strSQL, dbFailOnError
    >> End Sub
    >>
    >>Now, the problem from my point of view is that the AddPerson code
    >>is only valid if called from AddPersonDialog . I changed AddPerson
    >>to use parameters passed to it, some of which are optional.[/color]
    >
    >Again, that's great, but why not wait until the first time that
    >abstraction is needed, then refactor. . . .[/color]

    Because at that time the code will not necessarily be fresh in my
    head. Also, references to controls outside a subroutine violates
    one of my basic coding rules, which I learned for good reason.
    [color=blue]
    > . . . If it's never needed,
    >you've saved time. As you showed by your clean-up, the code was
    >not hard to generalize after the fact, and by adding optional
    >parameters, you did not break the code that was using the function
    >previously by doing it. When I did generalize the code, I think I
    >might actually make a class for this, so you can do...[/color]

    Actually, I *did* break it because I did more than just add
    optional arguments.

    And I needed the change TODAY, less than a week after I implemented
    it, and I *knew* that is was likely that I would need it.
    [color=blue]
    >With New clsPerson
    > .FirstName = ...: .LastName = ...
    > .SaveNew
    > ... = .PersonID
    >End With[/color]

    Yes, I considered a class for this, but that was terrible overkill
    for this application -- a definite case where that would be work
    that was not necessary to get the thing working well.

    I use classes a lot for this kind of thing, but only when the
    process being encapsulated is substantially more complex than this
    one, and only when it is also needed from two or more contexts. I
    don't see any value in creating a Person class for this particular
    application, though, if I did it once, I could use it in a lot of
    apps, as I use basically the same structure for every tblPerson in
    every one of my applications.

    Of course, the one in question actually has a schema I didn't
    design, so it doesn't exactly match my usually schema.
    [color=blue][color=green]
    >>I did lots of other things, such as converting both to functions
    >>so I could return the PersonID of the newly inserted record so I
    >>could navigate to it, but the main issue is that the structure
    >>has to be appropriate and that certain principles are important
    >>so that the code you write performs well in the scope for which
    >>it is conceived.[/color]
    >
    >An what is that scope? How far ahead, and around how many
    >possible turns do you look? . . .[/color]

    I'm not recommending spending 8 hours thinking about all the
    possibilities. I'm suggesting using your experience, as in the
    Address schema example above, to make an educated guess about what
    kinds of extensions are likely and then designing an architectures
    for extensibility, *as long as it doesn't increase the amount of
    work* to get the job at hand done.
    [color=blue]
    > . . . Any give feature could creep to use
    >up the available time for a project, and only 10% of the projected
    >needs would ever be actualized. . . .[/color]

    But you can plan an architecture that is not going to get in the
    way of those future needs. It's like building a house. The heating
    contractor could simply run the heating ducts wherever he wanted,
    and later it might get in the way of something else. So, an
    architect will consider the likely future needs and design the
    location of important heating ducts in order that they don't
    interfere with other design components. Does it take the architect
    longer to do that? Well, if the alternative is *no* design, I guess
    so. But if there's a plan, it doesn't take longer to plan one way
    than it takes to plan another. And will it take the heating guy
    longer to put the ducts here as opposed to over there--> ? Perhaps
    not, though that depends, of course.

    And my point here is that you consider the costs of *how* you
    implement what your implementing now. To be clear, my issue here is
    not with *what* you implement, but how you do it. It's on the
    question of HOW that I'm recommending more consideration of
    possible future needs, and when the time is equivalent between two
    alternatives (more or less) choose the more flexible alternative.
    [color=blue]
    > . . . I know you're aware of this, and
    >not going to extremes, or you'd never finish a project, but it's
    >easy to go overboard. Additionally, features sometimes get
    >removed from the spec later, so then how valuable was the time
    >making sure the code was general enough for possilbe future needs?[/color]

    Well, I used one of the features the day I did the revision
    (navigating to the PK returned by the functions) and I'm in the
    middle of using the code today in a different context (to add a
    different kind of person that has a different set of required
    fields).

    Given that navigating to the newly added record is a standard
    practice of mine and given that I already knew there were at least
    two different kinds of Persons needed in this application, the
    architectural changes to allow for those were quite easily
    foreseeable as necessary and as something that would, in fact, get
    used in the product delivered to the client.

    Now, there are a number of ways I could have accomplished that, the
    easiest being just to write code specific to the two contexts. I'm
    sure we're both allergic to that, since it means code duplication.
    Been there, done that. In the present case I revised the code to
    meet certain code standards that I use in all my apps for this kind
    of component (I did not import from a pre-existing model because
    each instance has way too many specifics that are different; a
    couple of weeks ago I *did* import to a different app, and found
    that it was a pain adapting the code to that context; of course, I
    may have simply chosen the wrong import source, as it was from an
    app that had non-standard field and table names compared to my
    usual apps), because it's a task that I know something about,
    having implemented it in many different apps in a particular
    fashion.

    In other words, this was not unknown territory for me. It's a task
    that I've implemented in many different ways over the years and
    I've developed some preferences about how it should be done and how
    it is done most efficiently. So, I was using my experience to guide
    me in the design, based on my knowledge of what's likely to be
    needed later on.
    [color=blue]
    >...
    >[color=green]
    >>My point is that I believe it's important to consider the
    >>architectur e on the front end, regardless of whether you ever end
    >>up implementing the more complex functionality. I don't see that
    >>writing the above as two subroutines is any more complicated than
    >>doing it in one sub, from the standpoint of the amount of time it
    >>takes to get it done. In other words, the flexibility you gain
    >>from abstracting the parts of the process into independent subs
    >>does not really cost you anything in terms of time on the front
    >>end.[/color]
    >
    >If the cost truly is negligible, then go ahead. Frequently, it's
    >not. In fact, playing with design improvements of small features
    >can add up to a huge time eater by the end of a project since a
    >project is, ultimately, a huge number of small features conencted
    >together. Also, frequently, the type of abstraction that's
    >required later is not the one you planned ahead for.[/color]

    Separating the opening of the form from the code that adds the
    record is not going to be hard, and it's also something that is
    much easier on the front end than it is months later if you find
    you need that abstraction. Also, making code independent of
    particular controls on forms on the front end does not really take
    more time than hardwiring the control names.

    But you have to make those decisions *before* you write the code in
    order to get the benefit of doing it right. If you don't think
    through it, you're definitely going to end up wasting time *if* you
    have to extend the code.

    For the particular examples I've included here, I don't think that
    doing it the "right" way takes longer than doing it "wrong." And my
    point is that you really do have to take the time *before you write
    a line of code* to decide which way to go. And I would argue that
    you can design your code in a fashion that is extensible without it
    taking any longer than writing the same code in a non-extensible
    fashion.
    [color=blue][color=green]
    >>And that's where I'm concerned about your approach, that you're
    >>not considering the big picture sufficiently. I have too much
    >>code where I didn't consider expandability in designing the
    >>architectur e and it eventually had to be significantly
    >>re-architected. I think that considering that possibility on the
    >>front end can lead to some important decisions on the front end
    >>that are not time sinks at the time you think about them and can
    >>pay off big time later on. And if you never do the expansion
    >>later on, you haven't wasted any major time, either.[/color]
    >
    >I'm choosing to look at the big picture less up front. . . .[/color]

    Yes, I know that, and I'm taking issue with your approach.
    [color=blue]
    > . . . What you
    >may not be getting about this approach is that 80% of the time, I
    >end up implementing the abstraction I would have implemented up
    >front within hours or days of the initial code because it -does-
    >turn out to be needed. I just think I do a better job of doing
    >the abstraction when I have the real-world requirement in front of
    >me at the time rather than when i'm making educated guesses about
    >what it's going to be. I've also had time to meditate on how I
    >would best implement the abstraction when the need does come
    >along. And finally, often a different refactoring has occurred
    >along a different dimesion affecting that code -before- the
    >abstraction in question has become required, so this way I've got
    >my horse before my cart.[/color]

    Would you ever write an AddPerson routine with hardwired control
    references? If not, then you're in my camp already, because you
    recognize that this is a situation where it takes no longer to do
    it the extensible way than it does to do it the hard-wired way.
    [color=blue][color=green]
    >>The issue is where to draw the line, when you actually say "well,
    >>designing for that eventuality will take 45 minutes and if I
    >>don't implement it later, that will be wasted" vs. "designing for
    >>that will take 10 more minutes, so it doesn't matter if it's
    >>never specifically used." I probably wouldn't do the 45 minutes,
    >>but I'd surely do the 10 minutes. I have the feeling that you
    >>wouldn't do the 10 minutes nowadays, and I think that's
    >>problematic .[/color]
    >
    >I guess part of it is that I don't trust my 10 minutes, and lots
    >of 10 minute increments over a day can add up big time, and some
    >of the the extra work went into will actually turn out to be
    >disposable scaffolding.
    >[color=green]
    >>In other words, I think it's more important to spend more time
    >>THINKING and less time CODING.[/color]
    >
    >What about using coding as a tool for thinking. . . .[/color]

    For the same reason that I think about things before I start
    writing, because we have a tendency to keep anything we've put down
    -- we never want to toss it once it's been committed to paper. In
    learning how to write I've found that editing is the hardest part.
    My dissertation is about 1/3 finished. I have about 150 pages in
    finished draft. I also have files of about 75 pages more that were
    ruthlessly cut from the original drafts at various times because I
    determined that they weren't necessary. I'm keeping them because I
    may use some of them in different parts of the dissertation. But
    that was some of the hardest editing I ever did.
    [color=blue]
    > . . . Try it out in
    >code - see it in black and white. It's easy to spend a long time
    >imagining possible designs before coding when it might be more
    >fruitful to implement somthing haphazardly in code, then refactor
    >until it's clean. If you hit a blind alley, throw it away. That
    >was part of the thinking.[/color]

    I could simply not work that way. I need to have a roadmap of what
    I'm doing, a plan for the flow, a plan for the components and how
    they work together, before I can really code. When I don't do that,
    I end up with spaghetti.

    --
    David W. Fenton http://www.bway.net/~dfenton
    dfenton at bway dot net http://www.bway.net/~dfassoc

    Comment

    • rkc

      #32
      Re: Open question - leverage all features liberally, or be selective?


      "David W. Fenton" <dXXXfenton@bwa y.net> wrote in message
      news:93F8ABA10d fentonbwaynet@2 4.168.128.90...[color=blue]
      > rkc@yabba.dabba .do.rochester.r r.com (rkc) wrote in
      > <1tI9b.100811$7 G2.94364@twiste r.nyroc.rr.com> :[/color]
      [color=blue][color=green]
      > >
      > >Seems to me the only parameter you would need to pass is the form
      > >object that was used to gather the information. Re-use doesn't
      > >get any easier than that.[/color]
      >
      > If the forms are identical and use the same controls, why, then,
      > would I worry about hardwiring the control references? The point is
      > that the source forms may not have the exact same fields and the
      > particular person being added may not require the exact same data
      > to create the record.[/color]

      If the data collected by the forms is different and the entities being
      dealt with are different, why, then, would you want to build one
      convoluted method to deal with all of them?
      [color=blue]
      >If you pass a form reference, the logic for determining which
      >controls to process has to be in your AddPerson subroutine.[/color]

      Why is that bad? If you write a function to do a task for you,
      why burden the calling code with having to go on and on about
      what it wants the function to do?





      Comment

      • Trevor Best

        #33
        Re: Open question - leverage all features liberally, or be selective?

        On Tue, 16 Sep 2003 20:03:26 GMT in comp.databases. ms-access,
        dXXXfenton@bway .net (David W. Fenton) wrote:
        [color=blue][color=green]
        >>But yes, in VBA or VB if called 10000 times I would skip that
        >>line.[/color]
        >
        >How do you know that? Especially, if called from a query?
        >
        >Either it would ignore the line regardless of how many times it is
        >called, or it would not. The number of calls can't make a
        >difference about whether or not the line is skipped.[/color]

        What I mean is if I knew the function would be called from a query or
        a loop, I'd comment it out or not put it in there in the first place.

        --
        A)bort, R)etry, I)nfluence with large hammer.

        (replace sithlord with trevor for email)

        Comment

        • Trevor Best

          #34
          Re: Open question - leverage all features liberally, or be selective?

          On Tue, 16 Sep 2003 20:03:26 GMT in comp.databases. ms-access,
          dXXXfenton@bway .net (David W. Fenton) wrote:
          [color=blue]
          >And any language without explicit variable typing is trash, in my
          >opinion.[/color]

          I used to think ASP was crap because just about every asp page I
          visited asked me to debug it, since writing my own I have found it
          wasn't the language that was crap, the ones I release don't ask the
          user to debug them for me, I've done that before releasing it.

          VBScript is crap compared to VB and VBA, not nearly as functional, I
          can't roll a cigarette as well as a tailor made but as it says on my
          pouch of Drum "It's in your hands".

          --
          A)bort, R)etry, I)nfluence with large hammer.

          (replace sithlord with trevor for email)

          Comment

          • David W. Fenton

            #35
            Re: Open question - leverage all features liberally, or be selective?

            rkc@yabba.dabba .do.rochester.r r.com (rkc) wrote in
            <F8M9b.102718$7 G2.64038@twiste r.nyroc.rr.com> :
            [color=blue]
            >"David W. Fenton" <dXXXfenton@bwa y.net> wrote in message
            >news:93F8ABA10 dfentonbwaynet@ 24.168.128.90.. .[color=green]
            >> rkc@yabba.dabba .do.rochester.r r.com (rkc) wrote in
            >> <1tI9b.100811$7 G2.94364@twiste r.nyroc.rr.com> :[/color]
            >[color=green][color=darkred]
            >> >Seems to me the only parameter you would need to pass is the
            >> >form object that was used to gather the information. Re-use
            >> >doesn't get any easier than that.[/color]
            >>
            >> If the forms are identical and use the same controls, why, then,
            >> would I worry about hardwiring the control references? The point
            >> is that the source forms may not have the exact same fields and
            >> the particular person being added may not require the exact same
            >> data to create the record.[/color]
            >
            >If the data collected by the forms is different and the entities
            >being dealt with are different, why, then, would you want to build
            >one convoluted method to deal with all of them?[/color]

            I'm adding records to the Person table. Some of the records are
            students, some are parents. Students require a SchoolID to be
            inserted, parents don't. Otherwise, they function exactly the same.
            Why have two different forms that would differ so little?
            [color=blue][color=green]
            >>If you pass a form reference, the logic for determining which
            >>controls to process has to be in your AddPerson subroutine.[/color]
            >
            >Why is that bad? If you write a function to do a task for you,
            >why burden the calling code with having to go on and on about
            >what it wants the function to do?[/color]

            I like to push rather than pull. That is, I think that the place
            where the smarts should be is closer to the context in which the
            act is initiated. So, in the code behind the command button it
            seems to me to be the proper place for setting things up so the
            code you're calling can get things done, without needing to be told
            what to do.

            --
            David W. Fenton http://www.bway.net/~dfenton
            dfenton at bway dot net http://www.bway.net/~dfassoc

            Comment

            • David W. Fenton

              #36
              Re: Open question - leverage all features liberally, or be selective?

              pmiller@pksolut ions.com (Peter Miller) wrote in
              <c5remvs1bm39r1 1qc9q94aep0ufde ffo81@4ax.com>:
              [color=blue]
              >
              >On Tue, 16 Sep 2003 20:03:26 GMT, dXXXfenton@bway .net (David W.
              >Fenton) wrote in comp.databases. ms-access:
              >[color=green]
              >>And any language without explicit variable typing is trash, in my
              >>opinion.[/color]
              >
              >Well, I don't disagree, but the issue here isn't explicit variable
              >typing but rather initialization of explicitly typed variables.
              >And automatic initialization within languages that *do* enforce
              >explicit typing is not (to me) a good indicator of whether such
              >languages are trash or not.[/color]

              Yes, that is a difference, and I guess I made an erroneous
              statement.
              [color=blue]
              >And to clarify, are you saying that any language that doesn't
              >*support* explicit variable typing is trash or that any language
              >that doesn't *require* explicit variable typing is trash? VBA, of
              >course, fails by the second standard.[/color]

              Anyone who uses VBA without utilizing the narrowest possible data
              types is an idiot.

              --
              David W. Fenton http://www.bway.net/~dfenton
              dfenton at bway dot net http://www.bway.net/~dfassoc

              Comment

              • David W. Fenton

                #37
                Re: Open question - leverage all features liberally, or be selective?

                sithlord@besty. org.uk (Trevor Best) wrote in
                <mo3fmv41dj06e9 4k6g3nmgq70taof 9mqkq@4ax.com>:
                [color=blue]
                >On Tue, 16 Sep 2003 20:03:26 GMT in comp.databases. ms-access,
                >dXXXfenton@bwa y.net (David W. Fenton) wrote:
                >[color=green]
                >>And any language without explicit variable typing is trash, in my
                >>opinion.[/color]
                >
                >I used to think ASP was crap because just about every asp page I
                >visited asked me to debug it, since writing my own I have found it
                >wasn't the language that was crap, the ones I release don't ask
                >the user to debug them for me, I've done that before releasing it.
                >
                >VBScript is crap compared to VB and VBA, not nearly as functional,
                >I can't roll a cigarette as well as a tailor made but as it says
                >on my pouch of Drum "It's in your hands".[/color]

                I just don't see any use for VBScript, myself, since it's not
                cross-platform compatible.

                --
                David W. Fenton http://www.bway.net/~dfenton
                dfenton at bway dot net http://www.bway.net/~dfassoc

                Comment

                • Peter Miller

                  #38
                  Re: Open question - leverage all features liberally, or be selective?


                  On Wed, 17 Sep 2003 03:28:29 GMT, dXXXfenton@bway .net (David W.
                  Fenton) wrote in comp.databases. ms-access:
                  [color=blue]
                  >Anyone who uses VBA without utilizing the narrowest possible data
                  >types is an idiot.[/color]

                  <chuckle>

                  You mean there's actually people who don't start every code module
                  with 'Option Explicit'? Say it ain't so!

                  Peter Miller
                  _______________ _______________ _______________ _______________
                  PK Solutions -- Data Recovery for Microsoft Access/Jet/SQL
                  Free quotes, Guaranteed lowest prices and best results
                  www.pksolutions.com 1.800.987.7716 1.619.839.3900

                  Comment

                  • Steve Jorgensen

                    #39
                    Re: Open question - leverage all features liberally, or be selective?

                    On Wed, 17 Sep 2003 03:28:29 GMT, dXXXfenton@bway .net (David W. Fenton)
                    wrote:
                    [color=blue]
                    >pmiller@pksolu tions.com (Peter Miller) wrote in
                    ><c5remvs1bm39r 11qc9q94aep0ufd effo81@4ax.com> :
                    >[color=green]
                    >>
                    >>On Tue, 16 Sep 2003 20:03:26 GMT, dXXXfenton@bway .net (David W.
                    >>Fenton) wrote in comp.databases. ms-access:
                    >>[color=darkred]
                    >>>And any language without explicit variable typing is trash, in my
                    >>>opinion.[/color]
                    >>
                    >>Well, I don't disagree, but the issue here isn't explicit variable
                    >>typing but rather initialization of explicitly typed variables.
                    >>And automatic initialization within languages that *do* enforce
                    >>explicit typing is not (to me) a good indicator of whether such
                    >>languages are trash or not.[/color]
                    >
                    >Yes, that is a difference, and I guess I made an erroneous
                    >statement.
                    >[color=green]
                    >>And to clarify, are you saying that any language that doesn't
                    >>*support* explicit variable typing is trash or that any language
                    >>that doesn't *require* explicit variable typing is trash? VBA, of
                    >>course, fails by the second standard.[/color]
                    >
                    >Anyone who uses VBA without utilizing the narrowest possible data
                    >types is an idiot.[/color]

                    I mostly agree. When It comes to choosing a refactoring that removes alot
                    of duplication vs preserving type safety, though, it's a hard choice, and
                    I'll often favore the refactoring. Here, automated tests of the code (when
                    easy to implement - it often is) can make up for the lack of compile-time
                    checking.

                    Also, I know you know about the problems of early binding to OLE and
                    ActiveX libraries, so no need to rehash that exception. I found a new
                    trick, though, for doing early binding during development and switching to
                    late binding for deployment that's really cool. Wrap the reference in a
                    user-defined type, and change the type declaration from <whatever> to
                    Object at deployment time. Also write a function to create a new object
                    with one line commented out depending on development/deployment. Either
                    returns New <object-type> or CreateObject(.. .). Only 2 lines of code to
                    change for each type in the whole project.

                    Comment

                    • Trevor Best

                      #40
                      Re: Open question - leverage all features liberally, or be selective?

                      On Wed, 17 Sep 2003 03:48:34 GMT in comp.databases. ms-access, Peter
                      Miller <pmiller@pksolu tions.com> wrote:
                      [color=blue]
                      ><chuckle>
                      >
                      >You mean there's actually people who don't start every code module
                      >with 'Option Explicit'? Say it ain't so![/color]

                      Ohhhhhhh yes. Didn't NASA once lose a (IIRC unmanned) rocket because a
                      Fortran program had an undeclared variable and it defaulted to the
                      wrong type?

                      --
                      A)bort, R)etry, I)nfluence with large hammer.

                      (replace sithlord with trevor for email)

                      Comment

                      • David W. Fenton

                        #41
                        Re: Open question - leverage all features liberally, or be selective?

                        nospam@nospam.n ospam (Steve Jorgensen) wrote in
                        <v8nfmvk7idq936 hucgsegi9c8jrs8 rtdbb@4ax.com>:
                        [color=blue]
                        >On Tue, 16 Sep 2003 19:52:54 GMT, dXXXfenton@bway .net (David W.
                        >Fenton) wrote:
                        >
                        >...[color=green][color=darkred]
                        >>>Well, I would argue that it's OK to do something simple that
                        >>>works for a single case, then extend it when (and if) the second
                        >>>case arises. . . .[/color]
                        >>
                        >>What if you are pretty damned sure the second case will arise?[/color]
                        >
                        >If that's so, one could force the issue by choosing the next
                        >function to implement to be one that's likely to need the second
                        >case.
                        >[color=green]
                        >>What if it doesn't take any more work to code for the second case
                        >>than it does to code for the first?[/color]
                        >
                        >I think that's a limited subset.
                        >
                        >Another point is that, while I'm suggesting to wait on writing
                        >code to handle cases that do not yet exist. . .[/color]

                        Here's a fundamental problem of this discussion: I'm not talking
                        about writing *code* that isn't yet needed. I'm talking about
                        designing of the architecture of the code you *do* need right now
                        so that it is flexible enough to handle what you *may* need later.

                        That's a really big difference.
                        [color=blue]
                        > . . . and actually avoiding
                        >thinking about doing so while making the code initially run, I do
                        >advocate eliminating code smells before delivering the code so
                        >long as this assessment is derived prior to worrying much about
                        >outside requirements. Much of this clean-up will, incidentally
                        >help in terms of code reusability. Some smells are - duplication
                        >within the code, duplication with other code, code that's not
                        >stratightforwa rd to read, functions that are excessively large,
                        >functions that are excessively small (sometimes), passing too many
                        >parameters between functions, etc.
                        >
                        >Code outside of the code directly written to accomplish the task
                        >also gets cleaned and generalized at this point (possibly
                        >somtheing that was -not- generalized an hour ago because the
                        >requirement wasn't there). This often happens when you see soo
                        >much data being passed between functions and realize that
                        >something in the new code should actually be moved into a
                        >previously existing function where the items it most relates to
                        >are normally handled.
                        >
                        >Once the code is clean, it should be clear that it will be easy to
                        >change and extend without having to explicitly account for
                        >specific cases now, though some of those will have been
                        >incidentally handled by simply making the code clean.
                        >
                        >In a way, I think we're saying nearly the same thing, but with
                        >different emphasis and in different order. I say make the code
                        >work even if it's the damndest hack, then immediately clean it,
                        >but dealing only with the requirements needed so far. Get the
                        >code clean enough that there is no fear of being able to make it
                        >more general, but don't worry about whether it actually -is- more
                        >general as it stands.[/color]

                        I would go the additional step, that you should choose a design
                        that allows for the later expansion, when there's a clear choice
                        and when the time to implement the more flexible architecture is
                        not excessive.
                        [color=blue][color=green][color=darkred]
                        >>> . . . When the second case comes along, I would approach it
                        >>>with the strategy of "Rape and paste, then refactor".
                        >>>Here, you simply cut and paste the code, form, etc., change
                        >>>what's different for the second case, then gradually refactor
                        >>>out duplication between the cases starting with the lowest
                        >>>hanging fruit (biggest chunks that are easiest to grab). When
                        >>>you're done, you have basically the goal you were describing
                        >>>above.[/color]
                        >>
                        >>I think it's easier to choose an architecture that has no
                        >>unnecessary dependencies on the specifics of its initial
                        >>implementatio n.[/color]
                        >
                        >Have you tried the refactoring route? I can't guarantee you'll
                        >appreciate it as I do, but it's worth a try. Basically, in
                        >refactoring stages, only code changes that should have -zero-
                        >effect on the actual functioning of the code (outside of some
                        >execution speed effect) are done, and mostly with an eye on
                        >reducing the amount and complexity of code. The stages of adding
                        >functionalit y and refactoring should -not- be mixed. I find that
                        >the process of separating coding from refactoring reduces the
                        >anxiety involved in programming and allows for greater speed.[/color]

                        Yes, I do understand that. And I've done it extensively with older
                        projects that took on new life. And last night late I was doing
                        some quick coding to fix up some things I forgot needed to be done
                        for a client meeting today, and several times thought "well, here
                        I'm going to pull a Steve." :)
                        [color=blue][color=green]
                        >>In schema design, say you had an application where in the
                        >>original design, everyone was absolutely certain that there'd
                        >>never be a need for more than one address per person. So, you put
                        >>the address in the Person table, and then they decide they need a
                        >>second address, so then you move to a 1:N address table and
                        >>restructure the existing data accordingly.[/color]
                        >
                        >Here's a case where I'd have to agree with your point of view, and
                        >I agree basically because it's hard to refactor forms and reports.[/color]

                        Most of my coding involves very close interaction with forms and
                        reports, so I don't see how you can separate coding from the
                        process of UI design. Indeed, 90% of the work I do in Access is UI
                        design, and that involves forms/reports embedded in code, and code
                        embedded in the forms/reports.

                        It doesn't seem like something separate to me at all.
                        [color=blue]
                        > I consider this to be one of the biggest down sides of Access
                        >because I would like to apply the same process I apply to code to
                        >everything else in the app - but I don't because it doesn't work.[/color]

                        I don't see that the code is that separate. I don't write
                        algorithms that are self-contained, I write code that encapsulates
                        processes that require interaction with human beings, which of
                        necessity is UI design.
                        [color=blue]
                        >Even here, though, I try not to go overboard, and addresses are a
                        >good example of where this can happen (not your example here, but
                        >addresses for sure). I've seen dozens of apps over the years (3
                        >of them were mine) in which the contact management portion of the
                        >application was overdesigned because the true nature of its
                        >eventual use was not understood up front, so every imagined
                        >possibility was accounted for. In every case, the code to handle
                        >it was way out of hand (up to 1/3 of the project - not primarily a
                        >contact management app). After all of that, there usually turned
                        >out to be somthing important that was -not- accounted for, and was
                        >scary to add because the structures were complex ansd difficult to
                        >modify without breaking something. I see, farther down, you do
                        >agree on this point, so I guess I'm preaching to the choir (still,
                        >for any onlookers).[/color]

                        I agree with you that you can go overboard. And the only way to
                        know the difference between "perfect schema" and "gone overboard"
                        is experience. I've developed a feel for when it makes sense to
                        have an elaborate schema and when it's better to do something in a
                        simpler way.

                        I think designing your code has the same benefits from experience.
                        Certain kinds of activities you do on a regular basis and know how
                        to accomplish them, so you don't really have to think about it.
                        It's mostly when things inter-relate that you have to worry about
                        architecture, and when you have multiple points of entry into
                        subroutines.

                        Say you have a subroutine with a flag parameter that you are using
                        to skip whole huge swaths of the subroutine. That's a case where
                        there's a major architectural problem -- the optional code ought to
                        be in its own subroutine.

                        And that's precisely what I'm talking about in terms of
                        architecture.

                        This kind of thing often happens when you encounter a special case.
                        But the question is: handle the special case inline or hand off the
                        special case to a subroutine? I'd immediately choose the latter, as
                        long as the subroutine didn't need a gazillion local variable
                        values and would therefore require 2 dozen parameters to be passed
                        to it.

                        Of course, once the code is written and works, then it's a
                        candidate for refactoring, but it would be well down my priority
                        list.
                        [color=blue][color=green]
                        >>If you'd put the address in a 1:1 table, though, you would have
                        >>had very little work to change the relationship to 1:N. You might
                        >>think that implementing the 1:1 address would require a more
                        >>complex UI, but it actually doesn't at all -- you just join the
                        >>address table in the recordsource of your person form and plop
                        >>the fields on your form. When you convert to 1:N, then you have
                        >>to change the recordsource to take out the join to the address
                        >>table and create a subform for the addresses and remove the
                        >>existing address fields from your Person form.[/color]
                        >
                        >Agreed on this point. Again, I might would not agree if this
                        >were, say, a Java front-end. And granted, we are not talking
                        >about Java front-ends.[/color]

                        I don't see why that would matter. Java is not doing the data
                        retrieval, so why would it matter how the stuff is stored?
                        [color=blue][color=green]
                        >>Do you do all the work preparing for the change on the front end?
                        >>
                        >>ABSOLUTELY NOT.
                        >>
                        >>But you choose a STRUCTURE that gives you maximum flexibility
                        >>along lines that are foreseeable at design time.[/color]
                        >
                        >On the schema, I cautiously of agree, . . .[/color]

                        For me, though, I keep encountering variations on the same basic
                        schemas, since all of my apps tend to be built around the same
                        kinds of entities. I then have certain principles that I use for
                        designing UI components around those entities. So, my choices are
                        usually between a number of alternatives that I'm already familiar
                        with and I make the decision of incorporation of flexible design
                        principles based on my estimation of the benefit to be gained for
                        the particular application at hand.
                        [color=blue]
                        > . . . though it's very easy to
                        >overestimate what's forseeable, and almost anything will
                        >eventually have to be changed in a big app. It often makes sense
                        >to make a prototype schema, get the users to enter as much sample
                        >data as you can coerce them into entering for you (with clear
                        >communicatio n that this is for prototyping only!), then start
                        >designing the new schema by looking at the relationships that
                        >actually appear in the sample data, not the ones evident in the
                        >specs. Of course, this is made vastly easier if there is a
                        >previous application being replaced, and the old data already
                        >exists in digital form.[/color]

                        I have one app that I really regret the schema I created. It seemed
                        an obvious thing to do, using a supertype table and multiple
                        subtype tables, but it's turned out to be a nightmare in the end.
                        Possibly I didn't think through the design so that I properly
                        designed my class modules for it, but somewhere along the line,
                        things are just not working, and I have one helluva time keeping
                        the code working reliably.

                        And I've refactored that code twice already!

                        Given that, I think the flaw must be in the underlying schema -- I
                        tried to do too many things in a multi-purpose way and failed to do
                        any of the individual things particularly well.
                        [color=blue]
                        >...[color=green]
                        >>To me, it's a no-brainer -- you do the 1:1 table on the front
                        >>just in case you need 1:N later, and the *cost* of doing so is
                        >>basically nothing.
                        >>
                        >>That's the kind of situation I'm talking about, where you have a
                        >>choice between two methods that take the same amount of time to
                        >>implement (more or less), but one of which allows more future
                        >>flexibility , *even if you end up never needing it*.[/color]
                        >
                        >But you are also talking about the parts of the app that impact
                        >the structures hardest to change later. I guess I agree with you
                        >in these cases, and these cases are a large portion of an Access
                        >database app. On the parts of the app that are more code-bound,
                        >though, I aim for implementing only single requirements at a time.[/color]

                        As I said before, my code is intimately tied up with the schema and
                        the forms/reports, so I don't see any bright line distinction
                        between code and the rest.
                        [color=blue]
                        > There's a grey area, but I try to push it as far forward as I can
                        >before the effort required to refactor is requiring excessive
                        >cleverness and starts making the code less clear instead of more
                        >so.[/color]

                        I'm not saying you should waste an hour thinking about it. I'm
                        saying that you should spend couple of minutes considering the
                        architecture of the code you're about to write.
                        [color=blue]
                        >...[color=green][color=darkred]
                        >>>>Now, the problem from my point of view is that the AddPerson
                        >>>>code is only valid if called from AddPersonDialog . I changed
                        >>>>AddPerson to use parameters passed to it, some of which are
                        >>>>optional.
                        >>>
                        >>>Again, that's great, but why not wait until the first time that
                        >>>abstractio n is needed, then refactor. . . .[/color]
                        >>
                        >>Because at that time the code will not necessarily be fresh in my
                        >>head. Also, references to controls outside a subroutine violates
                        >>one of my basic coding rules, which I learned for good reason.[/color]
                        >
                        >Yes, it's encapsulation. One thing highly dependent upon
                        >something else. I guess my pooint of view (reiterating from above)
                        >is that, if there's any fear that the code will be hard to
                        >refactor, then indeed it is not done. So, yes, immediatley make
                        >the code more clear in the quicked, easiest way possible (even if
                        >it is not what obviously fixes the encapsulation) until there is
                        >no fear of needing to take time to get your head back into it.
                        >Some of that may, in fact, either improve the encapsulation, or
                        >merely make it more obvious how one would remove the encapsulation
                        >when needed.[/color]

                        I'm not sure I'd call that "encapsulation. " I'd call it
                        "generalization ." Well, I guess you're right, it's something of
                        both.
                        [color=blue][color=green][color=darkred]
                        >>> . . . If it's never needed,
                        >>>you've saved time. As you showed by your clean-up, the code was
                        >>>not hard to generalize after the fact, and by adding optional
                        >>>parameters , you did not break the code that was using the
                        >>>function previously by doing it. When I did generalize the
                        >>>code, I think I might actually make a class for this, so you can
                        >>>do...[/color]
                        >>
                        >>Actually, I *did* break it because I did more than just add
                        >>optional arguments.
                        >>
                        >>And I needed the change TODAY, less than a week after I
                        >>implemented it, and I *knew* that is was likely that I would need
                        >>it.[/color]
                        >
                        >So, would it not be fresh in your head? You thought you would
                        >need it right away, and you did. If it had turned out not to be
                        >needed for a longer time, enough things might have changed around
                        >it that your previous freshness with the code might be of no use.[/color]

                        In this case, as I was revising someone else's code, it might have
                        saved time had I not needed it and left it as it came to me. But I
                        was 80% sure I was going to need the generalization when I did it,
                        even though it was some hours after I generalized the code before I
                        came on the definitive answer as to whether I was going to need it
                        or not.

                        This was one of those experience situations -- my gut knew I was
                        going to need it. I've learned to trust my gut on these things,
                        because it's when I've ignored it that I got in trouble!
                        [color=blue][color=green][color=darkred]
                        >>>With New clsPerson
                        >>> .FirstName = ...: .LastName = ...
                        >>> .SaveNew
                        >>> ... = .PersonID
                        >>>End With[/color]
                        >>
                        >>Yes, I considered a class for this, but that was terrible
                        >>overkill for this application -- a definite case where that would
                        >>be work that was not necessary to get the thing working well.[/color]
                        >
                        >I agree that classes are heayweight solutions in Access, but I'm
                        >using them more and more because they turn out to be one of the
                        >best ways to remove code duplication. . . .[/color]

                        I use them a lot, too, though quite often as nothing more than a
                        self-healing data structure that is used to avoid globals.
                        [color=blue]
                        > . . . They becaume much more
                        >useful to me when I stopped thinking of them as only being useful
                        >in cases where the state needed to be maintained for a long period
                        >(see, I have an object expiring at the end of its With block!). I
                        >think an entity type that warrants a table or more warrants a
                        >class. Then common code can even be refactored into another
                        >"parent" class that each entity class holds an instance of.[/color]

                        Well, I don't go that far with classes in Access because you really
                        can't do inheritance, so that level of abstraction just doesn't
                        seem to work.
                        [color=blue][color=green]
                        >>I use classes a lot for this kind of thing, but only when the
                        >>process being encapsulated is substantially more complex than
                        >>this one, and only when it is also needed from two or more
                        >>contexts. I don't see any value in creating a Person class for
                        >>this particular application, though, if I did it once, I could
                        >>use it in a lot of apps, as I use basically the same structure
                        >>for every tblPerson in every one of my applications.[/color]
                        >
                        >Well, me either until there are enough use cases to justify it
                        >(clearly <g>).[/color]

                        But, Steve, you'd never create your Person class, because you'd
                        never be able to justify all that work for no purpose, no? ;)
                        [color=blue]
                        >...[color=green][color=darkred]
                        >>>>so that the code you write performs well in the scope for which
                        >>>>it is conceived.
                        >>>
                        >>>And what is that scope? How far ahead, and around how many
                        >>>possible turns do you look? . . .[/color]
                        >>
                        >>I'm not recommending spending 8 hours thinking about all the
                        >>possibilities . I'm suggesting using your experience, as in the[/color]
                        >
                        >Yes, I do see that.[/color]

                        This is all about leveraging experience, I think, more than it's
                        about coding practices.
                        [color=blue][color=green]
                        >>Address schema example above, to make an educated guess about
                        >>what kinds of extensions are likely and then designing an
                        >>architectur es for extensibility, *as long as it doesn't increase
                        >>the amount of work* to get the job at hand done.[/color]
                        >
                        >Well, in the case of schema for an Access app, I might even
                        >concede the point where it does increase the amount of work to get
                        >the job done, but to a limited degree (preferably with at least
                        >one milesone, and a deadline). . . .[/color]

                        Does it really take longer to create a separate table and create
                        the 1:1 relationship? Maybe 2 minutes? In terms of designing the
                        UI, adding the Address table and changing the join type. What, 30
                        seconds?

                        Gee, we've used up and entire 150 seconds!!!!!!
                        [color=blue]
                        > . . . And again, I concede this point
                        >only because our tool is limited in its ability to allow easy
                        >refactoring of form designs (though I'm getting better at it).[/color]

                        Even if form designs were more easily changed, I'd think it would
                        still be a superior design, not because it saves so much time, but
                        because it is just a more flexible design in the first place.
                        [color=blue]
                        >Speaking of deadlines, I have other stuff I have to get to, but
                        >I'll try to respond to the remaining points within the following
                        >days.[/color]

                        Well, aside from me dwelling on experience, I'm not really adding
                        much new at this point!

                        --
                        David W. Fenton http://www.bway.net/~dfenton
                        dfenton at bway dot net http://www.bway.net/~dfassoc

                        Comment

                        • rkc

                          #42
                          Re: Open question - leverage all features liberally, or be selective?


                          "David W. Fenton" <dXXXfenton@bwa y.net> wrote in message
                          news:93F8A33C5d fentonbwaynet@2 4.168.128.90...
                          [color=blue]
                          > In schema design, say you had an application where in the original
                          > design, everyone was absolutely certain that there'd never be a
                          > need for more than one address per person. So, you put the address
                          > in the Person table, and then they decide they need a second
                          > address, so then you move to a 1:N address table and restructure
                          > the existing data accordingly.[/color]
                          [color=blue]
                          >If you'd put the address in a 1:1 table, though, you would have had
                          >very little work to change the relationship to 1:N. You might think
                          >that implementing the 1:1 address would require a more complex UI,
                          >but it actually doesn't at all -- you just join the address table
                          >in the recordsource of your person form and plop the fields on your
                          >form. When you convert to 1:N, then you have to change the
                          >recordsource to take out the join to the address table and create a
                          >subform for the addresses and remove the existing address fields
                          >from your Person form.[/color]
                          [color=blue]
                          >Do you do all the work preparing for the change on the front end?[/color]
                          [color=blue]
                          >ABSOLUTELY NOT.[/color]

                          When the client decides that they do after all want to be able to
                          associate more than one address per person, having previously
                          rejected your advice that they most likely would, how do you
                          charge them? Do you charge them as though you hadn't made
                          the decision to think ahead? Do you charge them for the time it
                          would have taken you to change the schema and re-work the
                          forms you already had built? Do you reward yourself for your
                          past experience or do you reward your client for hiring you?










                          Comment

                          • rkc

                            #43
                            Re: Open question - leverage all features liberally, or be selective?


                            "Steve Jorgensen" <nospam@nospam. nospam> wrote in message
                            news:v8nfmvk7id q936hucgsegi9c8 jrs8rtdbb@4ax.c om...[color=blue]
                            > On Tue, 16 Sep 2003 19:52:54 GMT, dXXXfenton@bway .net (David W. Fenton)
                            > wrote:[/color]

                            <major snip>
                            [color=blue][color=green]
                            > >Because at that time the code will not necessarily be fresh in my
                            > >head. Also, references to controls outside a subroutine violates
                            > >one of my basic coding rules, which I learned for good reason.[/color]
                            >
                            > Yes, it's encapsulation. One thing highly dependent upon something else.[/color]
                            [color=blue][color=green]
                            > >for this application -- a definite case where that would be work
                            > >that was not necessary to get the thing working well.[/color][/color]

                            Forgive me, I am going to yap at you because D.W.'s mind is set in
                            concrete.

                            Everything has to depend on something. A form is a GUI object that
                            facilitates the collection of data from an outside source. If it's purpose
                            is to collect data about a person then the value's entered into the form's
                            controls are in fact the properties that make up that person entity. Why
                            then should a sub-routine (or better yet a class) that is built to deal with
                            that person entity, say a SavePerson class, not know about the properties
                            of the object that collects the information? The form is nothing more than
                            a CollectPersonIn formation object. Why even consider a Person object
                            when what is needed is a SavePerson object that knows everything it
                            needs to know about the CollectPersonIn formation object.
                            [color=blue]
                            > I agree that classes are heayweight solutions in Access, but I'm using[/color]
                            them[color=blue]
                            > more and more because they turn out to be one of the best ways to remove
                            > code duplication.[/color]

                            I don't understand the sprinkled use of class objects because they are
                            'heavyweight solutions'.

                            Since VBA does not support inheritance, the best way to remove code
                            duplication is to create objects that serve a specific purpose and use them
                            in other objects that need that functionality via containment.






                            Comment

                            • Larry  Linson

                              #44
                              Re: Open question - leverage all features liberally, or be selective?

                              I'll add a caveat -- if you don't get the tables/schema design right, no
                              amount of excellence in the structure of the application is going to save
                              your tail. Hey, we are talking about _database_ applications.

                              And, you know, most of the applications I've worked on in all my
                              incarnations (mainframer, minicomputer guy, and micro manipulator) turned
                              out to be data-based, even if they didn't use a "database". Structure your
                              data wrong and the application was going to be a mess.

                              Larry Linson

                              "David W. Fenton" <dXXXfenton@bwa y.net> wrote in message
                              news:93F8A0A96d fentonbwaynet@2 4.168.128.90...[color=blue]
                              > MSherrill@compu serve.com (Mike Sherrill) wrote in
                              > <tg6emvgn4jo32o kfsrtafbv2k19qp mm9ae@4ax.com>:
                              >[color=green]
                              > >On Mon, 15 Sep 2003 20:33:00 GMT, dXXXfenton@bway .net (David W.
                              > >Fenton) wrote:
                              > >[color=darkred]
                              > >>In other words, I think it's more important to spend more time
                              > >>THINKING and less time CODING.[/color]
                              > >
                              > >I think it's important to spend more time thinking about tables
                              > >and less time thinking about coding. (I'm expanding on what you
                              > >said, not disagreeing with it.)[/color]
                              >
                              > Actually, you're contradicting me, as I think it's important to
                              > think about the architecture of the code just as much as you think
                              > about the architecture of the schema.
                              >
                              > 1. should this be in the current form's module or in a public
                              > module? That is, will this code be used from anywhere other than
                              > this particular form?
                              >
                              > 2. if it doesn't belong in the form module, which module should it
                              > go in? It's own, or can it go in with some general public module
                              > that's already there?
                              >
                              > 3. should I get data from the form itself, or use public variables
                              > or pass parameters to the code?
                              >
                              > 4. is the task complex enough that it would benefit from being
                              > wrapped in a class?
                              >
                              > Obviously, if you have a command button to open the detail record
                              > for a datasheet subform list, you don't need to consider all of
                              > this. But if you're writing something reasonably complex, you need
                              > to consider these things on the front end. And that doesn't even
                              > get into the issue of what the architecture of the component itself
                              > should be (i.e., how it's broken down into subroutines/functions,
                              > etc.).
                              >
                              > --
                              > David W. Fenton http://www.bway.net/~dfenton
                              > dfenton at bway dot net http://www.bway.net/~dfassoc[/color]


                              Comment

                              • Larry  Linson

                                #45
                                Re: Open question - leverage all features liberally, or be selective?

                                Why, I heard there was a large contingent demanding an "Option Implicit".
                                Hadn't you heard about that movement? <G>

                                "Peter Miller" <pmiller@pksolu tions.com> wrote in message
                                news:0slfmvorlq egqnjaqp4aiorl6 qlfd0o0dv@4ax.c om...[color=blue]
                                >
                                > On Wed, 17 Sep 2003 03:28:29 GMT, dXXXfenton@bway .net (David W.
                                > Fenton) wrote in comp.databases. ms-access:
                                >[color=green]
                                > >Anyone who uses VBA without utilizing the narrowest possible data
                                > >types is an idiot.[/color]
                                >
                                > <chuckle>
                                >
                                > You mean there's actually people who don't start every code module
                                > with 'Option Explicit'? Say it ain't so!
                                >
                                > Peter Miller
                                > _______________ _______________ _______________ _______________
                                > PK Solutions -- Data Recovery for Microsoft Access/Jet/SQL
                                > Free quotes, Guaranteed lowest prices and best results
                                > www.pksolutions.com 1.800.987.7716 1.619.839.3900[/color]


                                Comment

                                Working...