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


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

Re: Please recommend a book

Newsgroups comp.lang.java.help
Date 2012-11-03 16:22 -0700
References <k6n017$pct$1@dont-email.me> <nuvlmbcvcb.xvyaeh@mixnym.net>
Message-ID <967d0bc8-7330-4673-b2d0-6f3f3c7eb075@googlegroups.com> (permalink)
Subject Re: Please recommend a book
From Lew <lewbloch@gmail.com>

Show all headers | View raw


bobw...@mixnym.net wrote:
> markspace said:
>> Some of this is just "time," like I mentioned before.  Java has a BIG 
>> API and you won't learn it well by just reading one thing.  Getting a 
>> few basic books and looking at how they do it will give you some ideas. 
>> In other words, there's "patterns" here that work, and some that don't.
> 
> Ok.
> 
>> Also, the API is spread out.  It's been improved incrementally for 17 
>> odd years, and similar things are not all together.  In general to read 
>> user input you want the System, not Console.  Console is recent and just 
>> contains some extensions to the basic I/O that people were asking for. 
>> System.in is the workhorse.  Wrap that in a BufferedReader and read from 
>> that.
> 
> Whaa?!?

  BufferReader reader = new BufferedReader(new InputStreamReader(System.in));

"To wrap" is one of the fundamental operations of computer programming.

>> Time and just plowing through will get you there after a while.  The 
>> important bit is to do it.

Well, to a point. You have got to gain a conversational fluency with the 
terminology of computer programming. Otherwise "plowing through" risks seeing 
the farm from the horse's viewpoint rather than the farmer's.
 
> I'm realizing this isn't going to be like learning another procedural or
> scripting language. I usually can write something meaningful in a new one of
> those the same day.

Java is a disciplined language, but actually is a procedural language. 

Are you familiar with other compiled languages? 

Java gives you building blocks, mostly through its API as the language itself 
is reasonably spare.

You might want to wiki around for object-oriented thinking, but it can be 
simply summarized for Java purposes as type thinking.

You construct types that interact, at best via the interface declarations with 
no client knowledge of how a service implementation fulfills its promises.

You send and receive sensible types through those interfaces.

In this Java is pretty much like a lot of remote-programming protocols.

So get used to thinking of types that foment instances, and all with attributes 
and behaviors.

Attributes are the 'T getX()' and 'setX(T x)' methods.

Behaviors are all the other methods.

Expressing attributes as getters and setters makes them annoying enough to 
keep you from programming giant data-transfer types. That would be an 
antipattern.

Generics are just base types and assertions about their relationships.

'Set<T>' means that you have a set each item of which is of type 'T'.

You can  use generics for your own type, let's say an invoker of 'Invocable' 
things.

 public interface Invocable
 {
   /** Invoke this thing. */
   void invoke();
 }

 /**
  * Invoker of an {@code Invocable}.
  * @param <T> base type to invoke.
  */
 public class Invoker<T extends Invocable>
 {
  /** 
   * Invoke a base-type thing.
   * @param invocable T proxied {@code Invocable}.
   */
  public void invoke(T invocable)
  {
    invocable.invoke();
  }
 }

'<T extends Invocable>' asserts that 'T' defines an 'invoke()' method.

-- 
Lew

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


Thread

Please recommend a book bobwhite@mixnym.net - 2012-10-25 14:50 +0000
  Re: Please recommend a book Nigel Wade <nmw@ion.le.ac.uk> - 2012-10-25 17:44 +0100
  Re: Please recommend a book markspace <-@.> - 2012-10-25 09:50 -0700
    Re: Please recommend a book bobwhite@mixnym.net - 2012-10-26 14:54 +0000
      Re: Please recommend a book "Charles Hottel" <chottel@earthlink.net> - 2012-10-26 11:14 -0400
      Re: Please recommend a book Roedy Green <see_website@mindprod.com.invalid> - 2012-10-26 09:32 -0700
        Re: Please recommend a book David Lamb <dalamb@cs.queensu.ca> - 2012-10-26 17:17 -0400
          Re: Please recommend a book Lew <lewbloch@gmail.com> - 2012-10-26 15:04 -0700
          Re: Please recommend a book bobwhite@mixnym.net - 2012-10-28 22:05 +0000
          Re: Please recommend a book bobwhite@mixnym.net - 2012-10-29 11:07 +0000
            Re: Please recommend a book David Lamb <dalamb@cs.queensu.ca> - 2012-10-29 10:30 -0400
              Re: Please recommend a book bobwhite@mixnym.net - 2012-10-29 19:09 +0000
                Re: Please recommend a book Patricia Shanahan <pats@acm.org> - 2012-10-29 12:38 -0700
                Re: Please recommend a book Lew <lewbloch@gmail.com> - 2012-10-29 13:42 -0700
                Re: Please recommend a book markspace <-@.> - 2012-10-29 15:29 -0700
                Re: Please recommend a book Roedy Green <see_website@mindprod.com.invalid> - 2012-10-31 07:28 -0700
                Re: Please recommend a book bobwhite@mixnym.net - 2012-11-03 20:37 +0000
                Re: Please recommend a book Lew <lewbloch@gmail.com> - 2012-11-03 16:22 -0700
                Re: Please recommend a book markspace <-@.> - 2012-11-03 20:42 -0700
                Re: Please recommend a book bobwhite@mixnym.net - 2012-11-04 14:40 +0000
                Re: Please recommend a book Lew <lewbloch@gmail.com> - 2012-11-04 20:27 -0800
  Re: Please recommend a book Roedy Green <see_website@mindprod.com.invalid> - 2012-10-26 09:24 -0700
  Re: Please recommend a book Roedy Green <see_website@mindprod.com.invalid> - 2012-10-26 09:31 -0700
  Re: Please recommend a book Patricia Shanahan <pats@acm.org> - 2012-10-27 06:19 -0700
    Re: Please recommend a book bobwhite@mixnym.net - 2012-10-28 21:05 +0000
    Re: Please recommend a book bobwhite@mixnym.net - 2012-10-29 12:08 +0000
  Re: Please recommend a book Jeff Higgins <jeff@invalid.invalid> - 2012-10-28 19:09 -0400
    Re: Please recommend a book bobwhite@mixnym.net - 2012-11-01 14:25 +0000
      Re: Please recommend a book Jeff Higgins <jeff@invalid.invalid> - 2012-11-01 13:47 -0400

csiph-web