« first day (1479 days earlier)      last day (3448 days later) » 
00:00 - 17:0017:00 - 22:00

5:01 PM
Contracts are general OOP that defines what an object does.
For example, I'll write a method:
public boolean test(Person p);
Let's face it, the method isn't going to convey anything useful of value with no documentation. So that's what we mean by a contract - we define the method with what it does in its documentation, and we follow the contract (obey what we document).
/**
 * This method takes a Person and decides whether
 * (s)he's old enough to wear pyjamas.
 * @param p
 *   Any person object, or <tt>null</tt>. The method
 *   will not throw an exception even if the input
 *   parameter is <tt>null</tt>.
 * @returns
 *   Whether p.getAge > 15 is true.
 */
public boolean test(Person p);
There you have it, a simple contract, which defines:
- Expected input
- Expected output
- Presence of side effects, what they are, etc.
 
when you say follow the contract, does that mean, i need to implement the interface obeying the document?
simple example which i have in our code is interface{} on threadpool creation/maintenance that is already implemented in jdk 1.2 times
now if i want to use jdk 1.5 thread pool facility, do i need to follow the same interface and implement it using jdk 1.5?
 
Well when you build interfaces one thing to keep in mind is that they should have a purpose.
It's called Liskov principal or something. single-class-single-purpose stuff. So by documenting the methods of an interface and stating clearly what's supposed to happen, you'll have a well-defined contract.
 
Liskov substitution principle,to be exact
 
Thanks!
@Vog is also very knowledgeable, an experienced Java dev I think
does more practical stuff than I do :P
 
... experienced? maybe... knowledgeable?? less so
 
5:12 PM
person who build interfaces, also provides the implementation that follows the documentation mentioned for that interface, right? so to whom is this contract implied on? as a user i will use the interface ref variable and instantiate their implementations. To just instantiate and use their implementations, where is the necessity of following contract(obeying doc)?
 
@overexchange You're right. There's none. It's a design purpose thing. Actually, I'll elaborate on contracts:
If you have a method with a well defined contract, other methods will rely on your contract instead of the implementation detail. So you can change whatever code's inside public boolean test(Person p);, it really doesn't matter.
However the thing about contracts are that for all correct inputs, the expected values are expected to be returned (duh), and when it doesn't, the contract's broken.
For example, say I have this method:
 
that is called abstraction - rely on your contract instead of the implementation detail
 
/** @param index INDEX MUST BE POSITIVE INTEGER */
int fibonacci(int index);
And you break the contract by passing in a negative integer.
Then I'm not bound to returning proper expected output anymore. I can crash, throw exceptions, return 1337, whatever.
So, quick recap: 1. Contracts are imaginary stuff that helps define a framework so that everyone can use it properly. 2. Contracts can be broken.
(However, velociraptors may still leap at you from under your bed, I'm not responsible for that.)
 
i think we can do this using abstract class as well.
and write good doc
 
Good documentation is good. :)
 
5:19 PM
tautologies are tautological and the redundancy department of redundancy approves this message
 
so except multiple inheritance, i dont see any reason for keyword called interface.
 
@overexchange Well, that's what I thought AS WELL. But guess what?
 
i used abstract class in my code to use ploymorphism
 
Yep, great work. I meant more than that though.
 
wow.. laptop is being slow.
 
5:21 PM
First there was Java, where everything was plain and boring and you pass around values.
 
i could have done the same with interface keyword, if i dont have common implementations, somehow i still feel i dont know why interface keyword is used
 
@Unihedron quick sidequestion: did you push the newest state to development?
 
Then there's JAVA which was a massive leap and JIT started overhauling lots of the code style. And now, JAVA 8
@Vogel612 nope
 
Hi everybody
 
would you mind doing so?
then I can apply my JSONChatConnection kill properly
 
5:22 PM
I'll do it
 
Hi @Goldbones
 
Hey @Gold
 
;)
 
I haven't finished my < Raising Your Own Help Vampire Vol. 1 > book. I need to finish it so I can throw it at people. :(
 
fge
@Unihedron saw JChatExchange -- if you need help I'll gladly provide (especially testing)
 
5:24 PM
@fge It will be great! :)
I'll add you in a bit, I actually did this in a bad timing, I got off school, went to buy more biscuits and went on a marathonic code session, only remembered to add Vog earlier :|
 
@Unihedron people align this word called contract with usage of keyword interface, which confuses me. i don't see any use of interface keyword until a case of multiple inheritance between a single subtype and multiple super types.
 
@overexchange sometimes you want to not implement things yourself..
 
@overexchange Well think of it this way, interfaces are kind of useless, isn't it? It defines methods which the class doesn't have to do anything functional.
Actually, most classes are so lazy they just use:
method {
  throw new OperationNotSupportedException();
}
 
but get some class following an interface from somewhere else, doing the Job for you
 
Hence, contracts exists so that classes implementing such interfaces has a baseline to follow. Not that they have to follow the contract, but that for all callers of classes of the interface, they depend on the contract, not just the method.
 
5:27 PM
@Vogel612 what was that? sometimes you want to not implement things yourself.. this is something new
@Vogel612 can u elaborate?
 
Oooh abstract class lesson by Uni :D
 
@overexchange There's something called collaborative coding.

Design training session

48 mins ago, 37 minutes total – 81 messages, 3 users, 0 stars

Bookmarked 9 mins ago by Unihedron

Also, if you want another training session, just ask.
2
I'm actually not all that busy.
 
@Unihedron I know, I read it all :D
 
@overexchange you define a common interface. Sometimes that's in between different programs, sometimes between program sections, sometimes even just between two people to make clear what they want
 
@Vogel612 i want to understand more on this but get some class following an interface from somewhere else, doing the Job for you
 
5:29 PM
the easiest way to do so is using a contract, which is best (and easiest) represented by an interface
 
@Unihedron Hmm dunno if there's anything I want a training lesson in right now... I just woke up so I won't really be able to take the information in atm. But I kninda already knew about interfaces and abstract classes so it was a good read confirming what I knew. ^^
 
sometimes you have multiple "applications" interacting with each other
 
@overexchange I'll give you a practical example, you seem confused whether this is useful:
 
ya sure
 
@Unihedron first you push!
~whistles for the dogs
 
5:30 PM
Ok, but first, lemme push the commit, AND make a backup. Can't forget...
 
Giving birth to commits: PUSH! PUSH PUSH!
 
Collaborative coding
new keyword for me
 
well Uni and me are working on the JavaBot right now..
we're working together --> we're collaborating
 
@overexchange When you're coding alone, it's probably called a private coding project, where good style doesn't matter, as long as it works.
 
5:32 PM
which is sad, but alas
 
Duplicate code, linear code, incorrectly threaded code, whatever. Noone's going to yell at you 'cuz no one else has to review it.
 
fge
@overexchange how is "collaboration" anything new? I mean, it's a basic English word
@Unihedron "good style doesn't matter" <-- disagree, it depends on the individual
 
@fge not as basic as you might think
@fge actually it really doesn't..
 
But in real life cases where you go to work / build a moderate+ sized project / deal with bosses where a PM reviews your code / whatever, the code is no longer private, where it actually matters. Generally, it's divided into collaborative coding (project) or commercial- whatever, forgot the word.
 
5:34 PM
since you only have to obey your own "rules" however lax they may be
 
@fge Yeah, I actually really liked good style. Except I've kind of fallen short on good style after long private coding project sessions.
 
whether you do differently doesn't change the fact that it's irrelevant
 
fge
@Vogel612 sorry, but the definition of "collaboration" is basic; what is hard is actually implementing it
 
@fge umm... collaboration is not a simple word as a word in itself..
 
@fge It's not basic. I even wrote a markdown document explaining how to collaborate. :(
 
5:35 PM
i think i need to follow Uni updates from here as per current. right?
 
the concept is simple, sure. but what does it help when you don't know what the word means?
 
collaborations work so much better when everyone comments their code ;P
 
@overexchange I'm here quite frequently, as you can see, so never worry. :P
 
~whistles the dogs and points at Uni
 
@Gemtastic yes, and good documentation :)
 
fge
5:36 PM
@Unihedron hence "what is hard is implementing it"
 
@Vogel612 I'm on it, eclipse isn't happy about lots of chat windows
@fge it is
 
@Gemtastic I think that's depending on how people comment
 
PS @fge I still have yet to dig through your github profile, lots of treasure :D
 
@Unihedron makes it helluva lot easer in case someone throws in the towel and you can't ask him/her anymore :P
 
@Gemtastic there's a way around that..
 
5:37 PM
@Unihedron i think your explanation of collborative coding using interface is paused r u done with the explanation?
 
Maybe we could try Codelet with JChatExchange javadocs.
 
Well.. "this is where the magic happens" is probably not very useful as comments :P
 
you rewrap the implementation into unit-tests to understand it and either fix it up or rewrite from scratch
 
@overexchange I mostly mentioned collaborative coding to show that designing your framework with interfaces properly are important, so yes I'm done.
 
@Vogel612 I just sait it made it easier if people commented and Documented it right, not that it was impossible to work with the code without it ;P
 
5:37 PM
@Gemtastic ;(
 
@Gemtastic sometimes even that helps ;)
 
@Vogel612 it's more than nothing I suppose :P
 
@Unihedron are we shooting mechanize down now,btw?
then we can maybe have a real master branch again ;)
 
@Unihedron can u mentione a simple interface and tell me how it helps in collaborative coding?
 
wow it's getting full in here..
 
5:40 PM
@Vogel612 I'm not sure whether Mechanize is actually good though. I do have negative experience with it in the past, but if it's worth switching into for jSEchat, I might take a try.
You can shoot it down for me if you like. :)
btw pushed with garbage message
 
fge
@Unihedron I sure did a lot, the only problem is that I bite more than I can chew :p
 
yaaay git push blessed :master
@Unihedron DAMMIT UNI ! ;)
 
@overexchange Sure, please take a look:
Say, we're going to have to deal with STORAGE UNITS. Of course, SQL comes to mind, but say we want to support BOTH SQL and Flatfile AND SLAPI (java.io.Serializeable) AND lots of other nifty storage units (yes even XML externalization).
What you would think is to make an abstract class. This is a bad idea. Here's why:
 
abstract class AbstractDatabaseManager {
  // Default fields

  // Default methods

  // Abstract methods, expected to use default methods as "plugs" to work altogether
}
From there you will lack a proper contract: Methods are very hacky and it's very hard to get anything done properly.
With an interface, you can define behaviour over implementation, so like this:
 
5:44 PM
methods are hacky? lack a proper contract?
 
interface IDatabase {
  /*
  // Method contract, expected behaviour
  // Method
   ...
    */

  // Some more blocks
}
 
@Unihedron take a look mechanize should be dead
 
@Vogel612 \o/
 
I left my vogel branch up..
next commit will be closes#7
 
:)
@overexchange Yes, when you work with abstract classes, default behaviour is supplied, but the work around requiring the methods that work outside the class to supply useful information queryAllUsers(), adminsFromUserIdRanges() will require the "hooks" (default behaviour in predefined methods), which hinders reliable development.
Because this relies on implementation details, which changes constantly.
 
fge
5:47 PM
Hmm, not sure that will get the point across ;)
 
It's... Hard.
teaching is hard. Stack Overflow is hard.
 
fge
Yes, it is the hardest problem in software design
 
@Unihedron whatever is mentioned in interface IDatabase{} can be repliably mentioned in abstract class AbstractDatabaseManager {}, correct?
 
@overexchange Yes, but not the other way around. Interfaces are generally preferred over abstract classes because they are contract-specific over implementation-specific.
To explain that, we will have to dig through a lot of practical uses and potentially write over two pages of transcripts.
I know you are eager to learn, but it's like 2 AM over here right now.
 
can u provide the link of these two pages, i will take a print out and read it
 
5:49 PM
Actually, I might have some saved somewhere in my bookmarks, but they're not java.
 
fge
All the better
Timeless software practices don't care about the programming language
 
learning any new feature is very risky for me without knowing its usage
my next lecture to learn is on interface
 
fge
Even though it is true that the programming language's features may influence how you end up architecturing the end result
 
so i had in need of some ground work
 
interface as responsibility over abstract clases by oodesign.com: oodesign.com/single-responsibility-principle.html
 
5:51 PM
hello, I have MD5 encrypter :D can someone help me with write DECRYPTER - pastebin.com/ZgCEH2hK
 
fge
@KrisGroove you cannot decrypt MD5 since, for starters, MD5 is a hash
 
^^^^^^
 
@Unihedron i could have done this SRS example using abstact
 
@fge so how I can crypt end decrypt some strig?
string*
 
@overexchange that is if it's all abstract methods, which makes it an interface by itself.
 
5:53 PM
hmmm
 
fge
@KrisGroove alert, fundamental misconception -- you never encrypt strings, you encrypt byte streams; and what bytes a String ends up being depends on the encoding you use
 
when one says "abstract classes" it revolves actually using the abstract class as an abstract class - partial fields present, expected methods (usually very few), and predefined constants, like a part from a pie graph.
 
fge
Anyway, this looks like an XY problem, so why don't you step back and tell what you want to do?
 
@Unihedron error in pom assembly:single call
[INFO] Failed to resolve artifact.

Unable to get dependency information: Unable to read the metadata file for artifact 'com.google.code.gson:gson:jar': Invalid JDK version in profile 'doclint-java8-disable': Unbounded range: [1.8, for project com.google.code.gson:gson
com.google.code.gson:gson:jar:2.3

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

Path to dependency:
1) com.gmail.inverseconduit:javabot:jar:0.0.1
 
@Vogel612 ??
 
5:55 PM
@Unihedron as of now, am safe that i only know two key words abstarct and class
 
@overexchange ohh
 
@fge so first I must convert string to bytestream encrypt next decrypt and convert to string from bytestream?
 
@Unihedron i would trying using interface only after getting the reason to use it
 
fge
@KrisGroove precisely; and of course, this means both parties need to use the same charset
 
@fge so I must found some example in web :D
 
fge
5:56 PM
@overexchange hold on; one thing you need to know is that methods in a Java interface are by default public abstract; as such they are not different from such declarations in abstract classes, except that the visibility modifier is fixed
 
@fge: overexchange has an abstract class with all methods defined abstract.
 
@fge is that the reason we use interface?
 
fge
@overexchange another technical difference when it comes to Java is that you can only extends one class (be it abstract or otherwise), but you can implements more than one interface
 
@fge is that the only reason we use interface
 
fge
@Unihedron indeed, that can be made into an interface, but now a step back needs to be made and question the reason why the abstract class exists in the first place
@overexchange far from it
 
5:58 PM
multiple inheritance
 
fge
@overexchange that is precisely what Java wants to avoid
 
@fge Thanks, you might be able to share better insights, what I mentioned are all here for reference chat.stackoverflow.com/rooms/139/conversation/…
 
fge
With interfaces you don't do multiple inheritance -- you inherit behaviour only
 
inherit behaviour from multple super types, ok
so is that the only reason?
 
fge
Well, that is a pretty sound reason to begin with
 
6:00 PM
ok
 
fge
This means you can export whatever behaviour you need when you need it
Look at Java 7's Path for instance
All its methods work equaly well whether the underlying "file system" is Windows, Unix, a ZIP file, an FTP server or whatever
(OK, well, this API has oddities I discovered when I experimented with it)
 
which is to be expected given the quirks of the respective file-systems
 
fge
@overexchange mind you, implementing multiple interfaces is not very common, but in Java there are very common usage scenarios when using it simplifies your life greatly
 
@fge so if a sub type needs to inherit behaviour from multiple super types, then we think of interface correct?
 
fge
@Vogel612 I wasn't referring to this point in particular
 
6:03 PM
@Vog Maybe it's the ArrayList::new I added near multimap? except it works on my machine..
 
eehh..
maybe I borked something when cherrypicking..
gimme a sec
 
uh oh
 
nope..
 
fge
@Unihedron no reason why this shouldn't work, this is a valid "method reference"
 
same error on development branch..
 
fge
6:04 PM
Well, to be technically correct, this is a valid implementation of a SAM
 
The stack trace is xonfusing actually.. Maybe can you use -X flag @vog?
 
sure ;)
 
fge
@overexchange yes; however, in practice you should not encounter and/or need that behaviour very often; one notable exception in Java is AutoCloseable
 
mvn -X clean compile assembly.single
thanks :)
 
6:08 PM
@fge i would need, for example, currently i have a code where there is an interface of thread pool creation/maintenance/deletion behaviour that is actually implemented during jdk 1.2 times. now we want to implement same behaviour using jdk 1.5 thread pool library.
do u think that jdk 1.2 time interface would help us guide what methods to implement and how that methods should behave, is that correct?
 
may I advise doing it really right and moving on to 1.8 (or at least 1.7) ?
 
I'm led to think it's gson's fault. I checked that 2.3 is latest though.
 
known issue on google-code.
workaround: switch to version 2.2.4
 
f#…
ok, then do that ;D
Good night!
 
ima do that now, and create an issue for going back when it's fixed..
 
6:12 PM
ok!
I'll setup feeds to email when the issue gets updates.
done
Enjoy your day!
 
"Starting from scratch" is seductive but disease ridden
 
Eh all
Upright, but not mentally here.
 
@fge @Unihedron @Vogel612 thank you all for your time.
need to take rest now, bye
 
fge
@overexchange np -- and, as always, nothing replaces experience. Trials and errors!
I went through there a lot
(in fact, i learned everything I know about programming through trials and errors)
 
Junior incoming
 
6:19 PM
~JavaBot, at your service
 
##test
test
 
6:38 PM
so he's listening to ## and not !! now?
 
just when I start him..
but even though listening works... he's unfriendly ..
 
~JavaBot, at your service
 
not doing something when he's getting messages
test
heeyyy something happened..
 
:O
 
SCHWERWIEGEND: Exception in processing thread: null
 
6:42 PM
Hmmm
 
thanks a bunch
okay next approach after uncommenting that one declaration!
 
~JavaBot, at your service
 
test
 
~response
 
boo yah
now I just need to make that thread drain the message queue
 
6:52 PM
~JavaBot, at your service
 
##eval:"test"
this may take a while now..
 
~response
 
he processes one message every 5 seconds
including his own..
 
test
 
and this ladies and gentlemen means he's working
~bows and feels stupid for his monologue
 
6:59 PM
Yaay
Now we taught him to listen and respond, now we have to teach him to speak ;D
well... you
 
the interesting thing is, you can't even use it {evil laugh}
I think the explicit whitelisting approach is somewhat borked..
##eval:"mu"+"haha"*20+"!"
 
muhahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha‌​ha!
 
okay this feels dirty..
##eval:"test"
 
test
 
~mental note to self: If you want him to parse his own messages, add him to the whitelist
 
fge
7:05 PM
What do you think? javachannel.org/posts/catching-and-implementing-exceptions <-- originally mine, but with modifications
 
@fge looks nice... The "don't extend exception" disclaimer may be overrated, but all in all, very nice article..
 
fge
@Vogel612 well, I do say "try"
 
7:42 PM
Do, or do not. There is no try.
 
fge
@Kylar when it comes to development, or testing one's skills, there are trials -- therefore "try"
 
sigh
It's a Star Wars reference.
 
fge
That's just how it is
Ah, I see ;)
 
never mind. These aren't the droids you're looking for
 
yea he left already..
~purposely ignoring the ref
 
fge
7:47 PM
Then just surround such puns with <yoda></yoda> or something ;)
 
Yeah... no.
 
fge
8:02 PM
Ohwell, then, sorry to have disappointed you for not having picked up the reference :/
 
8:16 PM
It's Ok - I get disappointed a lot. Don't blame yourself.
 
8:27 PM
@Kylar The only thing you technically should do, is to put it within quotation marks if you are quoting. People tend to be a bit anal with the words when you mention quotes that refer to existing expressions within whatever they're doing ;P
 
sigh
 
hi all
 
/me waves, but without feeling
 
fge
@Kylar no need to sigh, what @Gemtastic says is actually true ;)
 
deeper sigh
 
8:37 PM
I'm more of a Trekkie but I still got the reference
 
fge
And sighing deeper won't help matters either, heh
 
Not for you, but I'm almost out of whiskey
so Sighing is all I have right now
 
8:52 PM
It ain't easy bein' Kylar :/
 
9:02 PM
What are you talking about? I'm awesome. I work at the greatest company in the world. Everyone uses my software. I have awesome kids. And I'm well managing my alcoholism.
 
There has got to be a better way to do bean conversions from a hibernate entity to a model used for the front end... any ideas?
 
9:16 PM
uhmm what is 1e?
 
fge
@BenBeri that defines the exponent
1e-15 is 1 * 10^-15
 
ah i see
 
fge
E is also valid in this case (1E-15)
From the code you pasted however I see a fundamental logic error
 
fge
9:39 PM
Hmm, Guava's Equivalence
A sadly underused tool
 
9:56 PM
0
Q: How can I get a value from database that has the soonest time to current time?

Euridice01I keep getting a NullPointerException when I try this query: Cursor cursor = sqLiteDatabase.query("collection", new String[] { "SELECT interval WHERE MIN(time) FROM collection" }, null, null, null, null, null); // This is where the NPE is. cursor.moveToFirst(); /...

 
00:00 - 17:0017:00 - 22:00

« first day (1479 days earlier)      last day (3448 days later) »