Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2011
    Posts
    24

    Unanswered: Do Programmers Really Use The Leszynski Method?

    Again, I'm pretty new to Access programming, but I want to make sure I establish good habits from the start. I was reading in one of my books about the Leszynski Naming Convention, and wondered if it is a common practice? I haven't observed anyone using it in my office, so I wanted to get a sense from others if it was a worthwhile habit to adopt.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    its up to you
    it is useful to know what the datatype is of a variable, or what type of control you are using. however I suspect the main (claimed) advantages are superseeded as intellisense has improved in the IDE.
    it can be useful if you have a series of similar sounding variables /names
    I wouldn't prefix tables (tbl), queries(Q), forms(frm)or reports (rpt)
    I think that's a step to far.

    don't be tempted to use such a naming convention with a table. if you must use LNC in your code, then develop your own table/column definition standards. most would suggest a table should be the plural of the objects it contains
    eg Orders, OrderDetails, Addresses, products
    don't then prefix the columns within those tabels with the table name
    eg Orders, might have ID, Description, Value but not OrderID, OrderDescription, OrderValue.
    why? its superfluous information. if you need to know whether its an Order wahtrever, just look at the table. if you fully qualify for column names in a query its starts to look very odd
    eg
    SELECT orders.orderid, orders.orderdescription from orders
    as opposed to
    SELECT orders.id, orders.description from orders

    if the column is a foreign key to another table then by all means refer to the table there
    eg use CustomerID in Orders to identify that the column is a customer id derived from the customer table

    however the fundametnal on any naming convention is thsat its the generally accepted naming convetion in your organisation. there is no point you rabidly staying with LNC / Reverse Polish if your colleague uses something else. develop an in house style. I forget if Access / JET is limited in variable length, I've a sneaking suspicion that it is and is limited 32 characters (any character beyond that limit are ignored). so develop a list of 'approved' abbreviations. eg Desc for Description, but don't use desc by itself as its a reserved word,

    the key is that you should always give your variable, table, column names and so on meanigfull names and stick to the style. people will argue that you 'must' use this, or 'that' appraoch, but in reality it doesn't matter thast much unless all use 'this' appraoch.

    couple of things to bear in mind
    look up the reserved words, words that you shouldn't use within Access.
    decide whether you want to use CamelCase or underscore in namemes, but do not use a spce to separate words
    ie use
    OrderNo or order_no but not order no. you can use order no, but when referring to it in queries, VBA and so on it has to be expressed as [order no]

    develop your own in house 'standards'
    eg use No or Num as the suffix for phone, fax, Order. doesn't matter which but be consistent

    don't be over verbose, use abbreviations (where the meaning is obvious, and obvious not just to you). eg Cust for Customer, Prod for Product, Addr for Address. but they must mean somethign to you, there is no point adopting someone else's convention if you don't understand it and don't embrace it.

    most of all any naming convention should help you in the job, not an additional hurdle to frustrate you
    Last edited by healdem; 11-21-11 at 12:33.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by nim6us View Post
    ... and wondered if it is a common practice?
    portions of it are, i am afraid, in widespread use

    the silliest of which is to name your tables with the tbl_ prefix -- that's the dumbest naming convention evar

    every time i run across someone with tables called tbl_order and tbl_invoice and so on, i ask them if their column names are col_customerid and col_address and so on, and they don't even seem to understand the question
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Nov 2011
    Posts
    24
    Quote Originally Posted by healdem View Post
    decide whether you want to use CamelCase or underscore in namemes, but do not use a spce to separate words
    ie use
    OrderNo or order_no but not order no. you can use order no, but when referring to it in queries, VBA and so on it has to be expressed as [order no]
    Is there ever a place for spaces? I'm noticing specifically in some examples it seems that tables have spaces in their name, no where else but tables. Is that okay, or is going to cause problems down the road?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    its up to you, but I'd stick with the
    decide whether you want to use CamelCase or underscore in names, but do not use a space to separate words
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by nim6us View Post
    Is that okay, or is going to cause problems down the road?
    it's okay, provided that you ~always~ hardcode the escape characters around the name
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Hungarian notation of any flavor has a tendency to make seasoned developers violent. I don't find myself using it anymore unless I have a collection of UI controls around a common field. For instance, I may expose a [FirstName] field using lblFirstName and txtFirstName.

    Aside from that, normally scope and context with naming conventions to match tends to be enough.

    For database stuff, I like and have seen:

    DATABASE_NAME
    EntityName
    column_name

    More often then not everything is CamelCase.

    On the app side of things, these seem to be pretty standard most places I go:

    _privateField
    localVariable
    PassedArgument
    MethodAndPropertyNames

    This convention along with intellisense, controlling scope (such that you're not doing too many tasks in a single method), and functional comments is sufficient. If you have so much going on in a single method that you can't remember what kind of object YourVariable is, you could probably refactor it into more manageable chunks.
    Last edited by Teddy; 11-21-11 at 17:42.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  8. #8
    Join Date
    Nov 2011
    Posts
    24
    Thanks Teddy, that's what I was looking for. I appreciate the input.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •