Re: Feedback?
Re: Feedback?
- Subject: Re: Feedback?
- From: Colin Clark <email@hidden>
- Date: Mon, 18 Oct 2004 11:34:50 -0400
Hi Jeremy,
Congratulations on putting together your first WebObjects applications.
I'm not exactly sure what kind of feedback you were looking for from
the list, but I took at look at your code and noticed a few issues that
you might want to address for your next release. I intend these as
constructive criticisms; the important thing is that your code works,
and you can then refactor based on making your application more
maintainable and readable.
1. Search Page:
Your search action methods are a bit messy. It looks like you've cut
and pasted separate, identical action methods for searching each letter
of the alphabet. This will be a nightmare to maintain. On top of that,
you've also got separate fetch specifications hard-coded for each
letter of the alphabet. I'd suggest trying something a little cleaner
like this:
- Maintain an array containing each letter in the alphabet as a
String. eg:
public static final String[] letters = {"A", "B", "C", "D", ... };
public NSArray alphabet = new NSArray(letters);
- bind that alphabet array up to a repetition. In that case, you'll
also need to bind a String variable for the current letter in the
repetition. eg:
public String letterItem;
- use only a single action method and fetch specification. Although
they're great, I haven't used model-based specs in awhile, so here's an
in-code example to get you started:
public WOComponent searchByLetter() {
EOQualifier lastNameQual = new EOKeyValueQualifier("lastName",
EOQualifier.QualifierOperatorCaseInsensitiveLike, letterItem);
EOFetchSpecification spec = new EOFetchSpecification("LGREntry",
spec, null);
return
session().defaultEditingContext().objectsWithFetchSpecification(spec);
}
2. Navigation:
Again, it looks like you've cut and pasted your navigation-bar action
methods and links into each component. Try creating a partial
subcomponent in WOBuilder for your navigation bar. That way you've got
all your navigation elements encapsulated in one place, and won't need
to copy/paste.
When you find yourself copying and pasting while programming in Java,
mental alarm bells should be going off. Generally, this is a sign that
you should be encapsulating your code in a class where it can be
reused, or refactoring your code to suit a more general case. All of
the features of an OO language are there to make your life easier so
that you don't have to manually maintain multiple version of the same
code in many different places.
3. Edit:
You've got a bunch of arrays of locations in your EntryEdit page.
You'll probably want to consider placing these in separate tables in
your database and creating relationships to your LRGEntry class. This
will ensure better database normalization (you won't be storing the
same string over and over again in your LRGEntry table) and make your
components much more maintainable.
4. General:
- For component actions that return the current page, return
context().page() instead of null. Although they both accomplish the
same thing, context().page() is apparently a bit more efficient.
- Your indenting looks a little snarly.
I hope this helps to give you some ideas for the next revision of your
application. The key for you seems to be to think a bit about how to
structure your code so that you don't have to constant duplicate your
efforts across multiple components and methods.
Good job on your first application,
Colin
On Monday, October 18, 2004, at 09:20 AM, Jeremy Matthews wrote:
With the help of some great WO developers, I've managed to throw
together (literally) a solution to meet deadlines here at the office.
We really don't have much else to work with, besides excel, so we
needed to create a web-based solution on the quick. Keep in mind that
I'm still new to WO, so the project interface leaves something to be
desired, and much of the higher-grade items are lacking (validation,
exception, etc). I'd appreciate any feedback on the software, and I'm
depositing the Xcode project files to:
http://homepage.mac.com/jeremymatthews
Under the title "LRG.zip"
Some key considerations:
1) Done with MySQL and XCode (newest versions), under 10.3.5
2) Done quickly, without time to code for validation and exceptions
3) Three people will be working on this from 9-5, M-F for 3 weeks
4) They will each be given a set of records to work with; meaning none
SHOULD be attempting to modify the same record.
5) Deployment has only been tested on the Build & Run from XCode
directly (leaving one week to construct deployment)
6) There will be a maximum of 500 records
7) It will most likely be deployed on a 733 G4 (512 RAM), running OS X
Server 10.3.5 with WO Dep 5.2.3
If anyone out there could check it out, I'd definitely appreciate it.
Thanks,
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
---
Colin Clark
Dynamic Web and Database Development Lead,
Resource Centre for Academic Technology,
University of Toronto
(416) 946-7592 / email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Feedback? (From: Jeremy Matthews <email@hidden>) |