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


Groups > comp.lang.java.programmer > #23841

Re: cannot find symbol?

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.programmer
Subject Re: cannot find symbol?
References <km553l$oii$1@speranza.aioe.org>
Message-ID <4bvht.12822$hl7.8246@newsfe14.iad> (permalink)
Date 2013-05-05 08:48 -0700

Show all headers | View raw


On 5/5/13 1:26 AM, qwertmonkey@syberianoutpost.ru wrote:
>> You no longer have to deal with Class tokens, instantiation, exceptions,
> or generics! ...
> ~
>> getCtxtDTO will return an Object of the static type T_Ctxt, but T_Ctxt
>> has no information about it, other than it extends Object.  In order to
>> know more about it, you need an interface or base-class.
>
>> class Foo<T_Ctxt> in Java is *not* the same as in C++. Templates are not
>> even closely possible in Java.
> ~
>> What are you even *trying* to do?
> ~
>   Daniel et al, the reason why I chose to use Class tokens, instantiation and
> generics instead of interfaces is because:
> ~
>   1) this code takes command line arguments (which are all text/of type String)
> and returns an (I was hoping for, typed) object with marshalled and addressable
> data
> ~
>   2) I don't want for users to have to write an interface for each set of
> command line arguments

Then how does the code know how to parse the command line? You have in 
there hard-coded int, String, and long processing.  If the parsing is 
different, how do you intend on specifying that?

Anyway, it sounds like you want to dynamically call a method. You don't 
really need generics for that, you need reflection. See 
Class.getMethods(...) and Method.invoke(...).

Do be aware that you can be too smart for your own good when dealing 
with Reflection.  It is a jet-powered swiss-army chain-saw.  It can 
solve a lot of problems, but it is no small feat of engineering to do 
so. If a bug is uncovered in reflective code, it will likely take longer 
to fix it than it would have taken to simplify the code not to use 
reflection in the first case.

I should know, because I've done it both ways.  I will say however, I 
didn't have to ask usenet why my code wasn't working, because I actually 
read the specs.  I suggest you read up on both Reflection and Generics 
(and why they don't always play nice with each other).

>> The syntax of a program can interfere with understanding the semantics of it.
> ~
>   "semantics" you say? it amazes me how we tech monkeys freely mess with concepts
> such as "semantics", "information", "abstract" and how we apparently think of
> coding (essentially some textual carpentry) as if it were high-end philosophy
> of some sort
That's the difference between an engineer and a programmer.  An engineer 
can see the meaning and intention of a design. A programmer merely sees 
a set of instructions for the processor to carry out.  Programmers do 
fine on small bits of software, but an engineer is required to make a 
lasting system.  Data is just data until its interpreted. That 
interpretation is what gives it semantics.  Code is also just data. The 
compiler doesn't care whether your semantics are correct, it just 
faithfully translates what it can into machine code, and the CPU just 
faithfully executes what it can of that code.

A human on the other hand, knows *why* the code is the way that it is, 
and what the goal of the code is. A human understands the meaning of the 
input data, and the meaning of the output data.

> ~
>> There is a difference between politics and social acceptability.
>> I would do whatever I could to get you fired.
>> I would do this regardless of the type of job you were hired to do.
> ~
>   yes, there is, but that difference is voided when "socially acceptable" people
> start seeing themselves as "the ones" and those who aren't as evildoers
> ~
>   My mind might be somehow so exceptionally good at visually parsing out what
> should matter from what doesn't that I even find annoying that people waste
> time talking about such cr@p and/or it may relate to me being downright
> lenient when it comes to people's ways
> ~
>> Research, enterprise, embedded, teaching. Especially teaching.
> ~
>   I may see your point somewhat with the former cases, but when it comes to
> teaching I can tell you that the job of a teacher is not "norming" people
> and/or putting their minds in straight jackets "for 'the greater good'"
No, but at the same time, a teacher should at least understand the norm, 
and the argument for and against it.  I am personally someone who has 
gone against the norm for much of my career.  With much success, I might 
add.  The difference is that I could justify why the norm wasn't working 
for the case.

Can you justify your naming convention over the Java communities coding 
convention?  If you had a decent justification, I might just switch to 
yours.
> ~
>> On an unrelated note, it would be more polite of you to follow standard
>> usenet protocol for replying to messages.  Keeping the thread in one
>> place
> ~
>   I use some java code based on apache commons NetComponents and I haven't figure
> out how to troubleshoot that (nor have they let me know) it sometimes works
>
>   http://mail-archives.apache.org/mod_mbox/commons-user/201209.mbox/date
>
>   Albretch Mueller 	SimpleNNTPHdr HeaderFields ...
> ~
>> So a better analogy is that (of everybody driving on the same side of the road) ...
> ~
>   your analogy is quite a bit forceful. I myself find the left-handed people one
> more appropriate
> ~
>> Ease of maintenance is a primary goal in creating software.
> ~
>   I find often arguments about those (to me silly) issues. To me it is a totally
> technical problem people should not even have to talk about. I wonder why people
> maintaining software themselves haven't design software as part of the software
> dev cycles to
> ~
>   1) convert/parse code from java classes (and/or source) into XML
Why XML? You've simply traded one syntax for another.  It's symbol 
names, comment, and examples that help humans comprehend the meaning, 
not (just) structure and syntax.

> ~
>   2) turn the XML using XSLT into "company/socially acceptable/SSCCE/maintenance
> friendly" code
Would that XSLT translate "DTO_T_Ctxt" into an understandable token?

> ~
>   3) there may be certain things a bit hard to code for out. GUI would be a nice
> aid
I'm not sure what you mean by this.

> ~
>   4) keep users/finger profiles
Most VCS's do this, or at least part of this.
> ~
>   5) keep the whole thing as a company-wide corpus
See my reply to 4.
> ~
>> You want people to spend time ...
> ~
>   Again, I wonder what makes you think that I want for "people" to waste their
> time trying to help me. If -YOU- don't want to because of whatever reason, you,
> very naturally and effortlessly indeed, can ignore it and that will be that
> ~
>   Yes, I have coded quite a bit of FORTRAN, ANSI C, ANSI C++ and lately java and
> I even have a hard time keeping apart the three languages that I speak. I will
> however be a little more conscious of how harmful/upsetting to the coding style
> inquisition my coding is once I make it public
> ~
>   Also, IMO, we tech monkeys should once if a while take our heads out of our own
> read ends for some fresh breathing. I (almost compulsively in an "unconscious"
> way) try to help people, even offering money to (whom I believe to be) single
> mothers struggling to pay for groceries, who sometimes even freak out when they
> notice a stranger handing cash to them. I don't tell them they should or
> shouldn't have done this or that, I just feel like I am helping my own single
> mother

On the other hand, if a single mother came to you, told you she was 
hungry and needed money for drugs, you'd probably feel somewhat 
compelled to explain that drugs won't fix her hunger.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

cannot find symbol? qwertmonkey@syberianoutpost.ru - 2013-05-05 08:26 +0000
  Re: cannot find symbol? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-05 11:34 +0100
  Re: cannot find symbol? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-05 08:48 -0700

csiph-web