• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)


  • Subject: Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
  • From: Owen McKerrow <email@hidden>
  • Date: Mon, 29 Mar 2004 14:08:08 +1000

Hi Arturo,

Let me see if I understand, Im one of those naive WO programers :) Speaking of which, how does one become un-naive ? Besides asking questions. Not trying to be smart aleck here, just wondering how you figure this out ?All the Apple examples and most of the books I have read have you making the Java Classes. Is it just a matter of experience ? Some secret documentation or walkthrough found in some far corner of the net ? Or is this the benefit of looking over a "pro's shoulder" as Jonathan put tit.
I've been programming WO a good 4 years now and I still call myself a novice cause there is just some much stuff I still don't understand and indeed as I have learnt today the stuff I thought I knew, I don't.


Anyways......


On 29/03/2004, at 1:10 PM, Arturo Pirez wrote:

IME, naive users of WO make the Java classes for all entities, including those that are usually referred to as enumeration entities (these are used to label control values; e.g. a table with two columns: code & label). A lot of entities are just data and no logic. In those cases, there's no need to generate the java classes.

So as an over simplified example, you have TITLES table in the DB (Mr, Miss, Ms etc). You don't create a Java class for it as its only data that will probably never been changed.


The next level (mine I'm no expert) is to only create those classes that have truly undeniable business logic. In this situation, I use a lot of the EOUtilities routines for dealing with entities with no specific class and I use takeValueForKey for everything. In fact, I even rip out the casting that WOBuilding puts in for WOComponents and I just use takeValueForKey for those, too. It makes the code more uniform at the added (slight) risk of runtime errors. The trick of takeValueForkey works because it will call setKey if you have one.

So you don't use setObject(Object new Object) but takeValueForKey(object, "object"). Is there an advantage to doing it this way besides making it all more uniform ? And by uniform do you mean uniform in how the code looks ?



But the reason I leave the entities as EOGenericRecords is because it is easier to refactor. Once I have a good feel the the business logic associated with a class then I generate the class and add the logic. I think some people use the Gap design pattern (and EOGenerator) to address this need but I haven't gotten there myself yet.

Sorry could you pleas explain this further. Do you mean that you don't create the Java until you feel you understand its class logic ? What is the Gap design pattern ?


I think the wizards do wild and wooly things like create the Entities at runtime using Java/Objective-c reflection and EOModelGroup (the class) capabilities that scare me :-)


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
People who prefer typing to pointing then seem to prefer acronyms to save typing :-)
-Denis Stanton, On people using Command Line Interfaces
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



  • Follow-Ups:
    • Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
      • From: Arturo Pérez <email@hidden>
References: 
 >New WebObjects 15 Minute Tutorial in Quicktime (From: Kieran Kelleher <email@hidden>)
 >OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime) (From: Owen McKerrow <email@hidden>)
 >Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime) (From: Arturo Pérez <email@hidden>)

  • Prev by Date: Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
  • Next by Date: Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
  • Previous by thread: Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
  • Next by thread: Re: OT : Coding Standards (was New WebObjects 15 Minute Tutorial in Quicktime)
  • Index(es):
    • Date
    • Thread