• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Chapter One - Few doubts

 
Ranch Hand
Posts: 50
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a) Starting from the first chapter, and found throughout the book in multiple places is the word "idiom" used in the programming context. I don't get a clear idea , what all can be called as an idiom and what cannot in the java programming world ?

b) I never get to use member classes/interfaces and wonder if I am missing something regarding their usage. When should we go about using a member class or interface , what should be deciding factors whether to make a class/interface an independent one or a member?
 
Marshal
Posts: 75617
354
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Idiom means a usage word or phrase which is particular to one language. For example we can say, “It is raining cats and dogs,” which sounds like nonsense when translated into another language. By “Java idiom,” Bloch means something which you write on way in Java but you would write differently in other languages.
 
Campbell Ritchie
Marshal
Posts: 75617
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going to make a new thread for the second question, and also copy it to one of the “Java” fora, so you will get more exposure. Look here.
 
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though it may not be a strictly proper use of the word, I hear it used a lot as a "mini-pattern"; a series of statements that you see over and over again throughout code.
 
Ranch Hand
Posts: 567
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just searched my google books copy and the first 5 hits were not good! In one example, he writes "design patterns and idioms" and I think in that sense 'idiom' means something along the lines of the dictionary definition which relates to idioms in the English language - you can translate that for the Java language as something like "a typical way of doing something".

In the other 4 of the first 5 hits, he used the word 'idiom' when really he just means 'example'.

So, not great English.

In fact, a bit of an anti-pattern! ;)

They fall into that trap at Spring Frameworks, where every document contains a reference to the phrase "idiomatic Java" when really they would just do better to say 'correct Java' but I guess they felt that was a little arrogant - and to say "typical Java" made it sound a bit cheap.

My 2 cents!
 
author & internet detective
Posts: 41071
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use the word idiom a lot in regard to programming. In fact, my last book review had that word in it. I may not be using the correct word, but I read it somewhere and it stuck.

When I say idiom, I mean a common way people write code. For example, this is an idiom:


This will work, but is not an idiom:


Learning idioms in code is learning common approaches. But on a smaller level than a pattern.>
 
Pallavi Sadit
Ranch Hand
Posts: 50
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone for taking the time to explain !! The different ways in which everyone has put the definition helped a lot to clarify and hope soon it becomes a part of my vocab also
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic