Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

"Leap" and class sizes

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have just submitted my *attempt* at "Leap" (you know, the assignment with the "divisible by 4, but if divisible by 100, only if divisible by 400 as well"-thingy).

Well, I had a few solutions up my sleeve, but I wanted the code human readable and I didn't want to use too many Strings or if()-expression. So I decided on blowing up the class size with automatic variables.

Could "blowing up the size of the class" be a nitpick criteria?
Or are we concentrating on human readability and maintainability?

(It's quiet on the Cattle Drive nowadays, isn't it?)
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose it depends on whether you are "blowing up the class size" with things that make the code more readable or less readable. I think line count is not important. Readability is important.
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Stuart,

Or are we concentrating on human readability and maintainability?



Readability is very, very, very important on the Cattle Drive. I'd say that's it's probably safe to treat that as your number 1 criterion.

Yeah, it's not quite as busy 'round here as it was during the roaring bubble years. There's those end-of-the-year fun happenings too - they tend to tear folks away from the masochistic pain and punishment eh, I mean, real fun of writing Cattle Drive assignments.
 
Stuart Goss
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pauline,

seems like most city slickers are too handsome for Cattle Drive chit-chat, they could get those gucci boots dirty on the dusty trail

I can remember the days when we used to eat baked beans with Johannes at the camp fire ... What is he up to nowadays?
 
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stuart,

It sure has been awhile since we sat around the campfire. Great to see you are back.

I'm still around though not very active over here in the Cattle Drive and the JR as a whole.

I'm back with my "roots" on the mainframe, and boy considering the amount of times I had to fix problems over the Christmas - New Year period do I regret it

My employer is busy with a large our-sourcing project and it looks virtually impossible that I will get an opportunity to get back into Java. I played around a bit with the idea to write a JSP/J2EE based system but I found all the Struts/Hibernate.etc. stuff just way to complex to do as a hobby.

I'm also involved in a virtual "company", note the quotes, with a few trusted people/friends to review books for publishers. We are still in the starting blocks and we need to still do a lot of work but it is our hope to create a community of dedicated book reviewers that will make the books as error free and perfect a humanly possible.

Because of this "hobby" of mine I had to cut down considerably with my experimenting/programming at home. So you re alone on this one I'm afraid, I won�t be joining you on the active log to get my JR diploma

Johannes
 
Stuart Goss
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Johannes,

it is great to hear from you! I saw your pic in my new copy of HeadFirstJava2ndEd!

Isn't it annoying to check a book and then have the publisher or layout designer place some pics over parts of the writing that you've checked? I've already noticed that twice in the book (and I'm only in chapter 6).

Stuart
 
Johannes de Jong
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. I do not have printed copy of the book and I removed the draft copies so I cant check if it was a newly introduced "error". It sure is frustrating if the review team checks & comments on the dragft version and new "errors" are introducted when the final version is printed.

By the way I did not proof read the HF 2nd edition. I only got the team together and summarized their comments.

Are you starting your Java again as a hobby or for work?
 
Stuart Goss
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Johannes de Jong:

Are you starting your Java again as a hobby or for work?



Both

If I can't use it at work, it will become a hobby.

(At work we have a small team developing mobile applications with J2ME and of course we have opportunities for J2EE and EJB implementations.)
[ January 04, 2006: Message edited by: Stuart Goss ]
 
Johannes de Jong
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good luck
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Stuart Goss:


So I decided on blowing up the class size with automatic variables.


What does that mean?
 
Stuart Goss
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, now I can remember!

I wanted it "human readable" so I created automatic variables (those are just variables that are "automatically" removed from the stack when the block is left), so I pre-calculated the checks that need to be used and gave them readable names like "isYearDivisibleBy400" and saved them in the appropriate types (you can guess which). Then the if() statements look easier to read.

Did that help?
 
Marilyn de Queiroz
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Stuart Goss:
blowing up the class size with automatic variables



Making the class larger by declaring more local variables.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic