Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1658

Re: Validating form inputs?

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.help
Subject Re: Validating form inputs?
References <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com> <cdthm7h8ouvn55aoeah597mjjse0j7mrkh@4ax.com> <eodim79a4ms63j0nsbhk4bf7472hr96oqg@4ax.com> <32128919.1956.1332366998647.JavaMail.geo-discussion-forums@pbij6> <072lm75r2kqf7sfj8ivoggnmfr03o7gr69@4ax.com>
Message-ID <gGHar.17146$fj7.4883@newsfe20.iad> (permalink)
Date 2012-03-22 08:36 -0700

Show all headers | View raw


On 3/21/12 7:09 PM, Gene Wirchenko wrote:
> On Wed, 21 Mar 2012 14:56:38 -0700 (PDT), Lew<lewbloch@gmail.com>
> wrote:
>
>> Gene Wirchenko wrote:
>>>       Classes can be very useful.  They can also be a waste of time. If
>>> the only reason that you use classes is because you get to use
>>> classes, that is not a good idea.
>>>
>>>       I recall one assignment during my degree where this got
>>> demonstrated rather well.  We were to write code comparing various CPU
>>> time allocation algorithms.  I figured out how to code it and wrote
>>> it.  I wrote procedural code.  There was no need for classes except
>>> for the one class Java requires.  One of my classmates went the OOPS
>>> route.  It did not work out, and he had to restart just before the
>>> assignment was due.  He did not get through the whole assignment.  My
>>> classmate was a sharp person.
>>
>> Given that we only hear this through the filter of your interpretation,
>   it's not very evidentiary. Without seeing the exact problem and where
>
>       Oh, no!  I forgot to attach the affadavits.
>
>> your friend (however sharp he may have been) went wrong, there's simply
>   not enough here to blame "classes" for his failure. On the face of
> it, his problem seems much more likely to have been his and not
> classes'. Sometimes a person gets off on the wrong algorithmic foot,
> or maybe he just didn't understand object-oriented programming yet
> well enough to get it right. Whatever the actual facts, I remain
> extremely skeptical that it was classes' fault.
>
>       Well, he was into Java's features on that assignment.  At one
> point, he said that he was using comparators.  I can not see what he
> was using them for.  I am assuming he was into classes since
> presumably, using comparators made sense to him.  I suspect that the
> shiny got him.
Using "Comparators" makes sense if you need to order Object's of a class 
that isn't "Comparable", or if you need a different order than the 
"Comparable" provides.  Given this was an assignment, I doubt he had 
full experience in what the best approach was. He may not have needed 
Comparators or Comparables. I can't be certain unless I was given the 
actual assignment my self.  There are often multiple ways to solve a 
particular problem, and there are often problems you don't see until you 
have years of experience (along with being a "sharp" person).

>
>       I looked for how to use classes, but just did not see any way
> that they would be helpful on the assignment so I did not use them.
> Some people would anyway.
That tells me two things. One, you didn't see how classes would be 
useful. Two, you found an alternative.

There are always alternatives, but they usually have trade-offs.  The 
benefits of classes really come when you have long-lived and/or 
large/complex projects.  When you need to (say) parse through a log file 
once to verify something, building a fully OOP solution seems like 
overkill.  I might go as far to say Java is overkill for that task 
(though it depends on what the analysis is).  On the other hand, if 
you're developing a web application that takes different inputs (user 
form submissions, databases, etc...), OOP provides a huge benefit over a 
pure procedural program.

Really, it doesn't matter if you go for "classes" or "methods", the real 
benefit comes from modularity, encapsulation, and isolation.  One very 
important characteristic of a modular program is the ability to change 
the behavior of your "system" with as few side-effects as possible.  It 
is possible to fail this with OOP, but its harder to succeed with 
Procedural programming.

Hope this helps,
Daniel.

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-20 11:16 -0700
  Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-20 12:08 -0700
    Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-20 12:50 -0700
      Re: Validating form inputs? markspace <-@.> - 2012-03-21 09:24 -0700
      Re: Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-21 12:02 -0700
        Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-21 12:59 -0700
        Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-21 13:37 -0700
    Re: Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-20 12:56 -0700
      Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-20 13:58 -0700
      Re: Validating form inputs? markspace <-@.> - 2012-03-21 09:30 -0700
  Re: Validating form inputs? Roedy Green <see_website@mindprod.com.invalid> - 2012-03-20 14:28 -0700
    Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-20 19:16 -0700
      Re: Validating form inputs? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-21 17:41 -0300
        Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-21 14:46 -0700
          Re: Validating form inputs? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-21 19:54 -0300
        Re: Validating form inputs? Roedy Green <see_website@mindprod.com.invalid> - 2012-03-22 10:34 -0700
      Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-21 14:56 -0700
        Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-21 19:09 -0700
          Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-22 08:36 -0700
            Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-22 09:40 -0700

csiph-web