« first day (1558 days earlier)      last day (3366 days later) » 

7:00 PM
var MyObj = (function() {
    var myPrivate;
    function MyObj(variable) {
        myPrivate = variable;
    }

    MyObj.prototype.getPrivate = function() { return myPrivate; }

    return MyObj;
})();
var obj = new MyObj('foo');
You can't access myPrivate in any other way than calling obj.getPrivate
(Note, that's technically for private "static" variables, that are shared for all instances, the same concept is pretty easily applicable to instance variables)
 
They're talking about you in the webdesign chat @second
 
just to make this clear.... classes are functions?????
 
@Vogel612 There are no classes in JavaScript
Just objects (and primitives)
 
eek
 
That function MyObj() defines the constructor for the object created with new MyObj
In ES6 there are classes, but they're not real classes, it's just sugar
 
7:05 PM
look how you can access an object inside itself
 
@Vogel612 The MyObj outside and the one inside are different ones.
Different scope.
I named them the same for consistency, there's no real point in naming them differently (although you could)
 
oh.. wait you're returning the Constructor of your "class" as a first class function to a different var?
 
@Vogel612 Correct
Functions are first class objects
You can pass them around, put them into variables, play with their prototypes, anything you can do with any other object.
That is the one thing JS has that Java does not
 
while I actually like functions as first-class-objects (and Java now also has something similar), this is kimochi warui
 
And it's one of the most important things a language should have in 2015 IMHO
 
7:07 PM
you can pass around Functions in Java.
well in Java 8
 
@Vogel612 Not sanely.
 
meh.
define sanely
 
@Vogel612 Without having me go to therapy afterwards.
Java is sane, don't get me wrong
It's just so very explicit about everything
 
someList.stream().filter(Utilities::functionName).collect(Collectors.toList());
 
If I wanted to do everything myself, I'd go to C
@Vogel612 Utility?
Please don't tell me it's a POJO
 
7:09 PM
a class exposing a function
it's just a classname
usually you have static utility functions in separate final classes
so everybody can access them and nobody is responsible.
 
@Vogel612 Have you read the land of the nouns?
 
?? better?
 
@Vogel612 A function is a verb
An object (or class) is a noun
Java is the Kingdom of Nouns, where every verb must be accompanied by a noun at all times
That doesn't make sense XD
Alright, read it (it's a fun read)
I'm gonna get a shower and we'll hopefully continue afterwards :P
 
7:33 PM
Back
@Vogel612 did you read? :)
 
yes I did
I was entertained
I begin to understand what you mean by that.
 
It's a bit cynical and exaggerated, but I think it conveys the point nicely
It doesn't make sense for an application to only ever have nouns, objects, classes.
 
I kinda prefer to have my verbs organized though
and Nouns make good registers
 
@Vogel612 No problem, you can namespace things however you like
But sometimes namespacing doesn't make sense.
 
and that's where java is "problematic" because you can't namespace a method
 
7:35 PM
In JavaScript I can do someArray.filter(Boolean), and only get "truthy" (not null, not undefined, not false, etc) values.
Boolean is a constructor, but it's also a function
someArray.filter(function(el, index, originalArray) { return originalArray.indexOf(el) === index; });
This returns a new array with all duplicates removed.
Both of those extremely common tasks you can't do in Java, unless you know the type of collection you want well in advance
 
meh. not really correct anymore
arrays are a little unfriendly since java arrays are borked but..
 
@Vogel612 Sure, you need another whole class, and another whole method in it
@Vogel612 in JS an array is a generic collection
Although we are getting proper iterators, sets and maps with ES6
Dangit, I had to make an emergency commit because I was running extremely low on battery during critical bug fix and had to continue elsewhere, and now I have unfinished files in my repo T_T
 
@SecondRikudo no you can actually do that with a lambda now..
 
@Vogel612 Also, what I dislike about Java isn't necessarily the language itself
It's the whole ecosystem/culture around it
Why is every single plugin or library I have ever found never bothers with proper documentation? No, JavaDoc is not a replacement for actual documentation, with examples and everything
Moreover! Why is every single plugin or library I have ever found uses antique VCS like SVN?!
 
meh.
okay now that's a stretch
 
7:42 PM
Why is every single library makes me program in XML?!
 
that's also a stretch..
 
@Vogel612 It's not.
 
you're doing the "wrong" things then
 
@Vogel612 I am not doing anything
 
sure Spring wants it all in xml
loool
 
7:42 PM
I happen to work in an existing codebase, that uses Spring
 
Hello.
 
examples and everything is not proper documentation
 
First time here.
 
But from the way I see it, it's not just Spring
It's also Android
It's also some other frameworks and libraries I had poked
 
because examples tell you ZILCH about assumptions made for the programmer
android != java
 
7:43 PM
Sure, pure Java doesn't do that
 
Hello all. I am relative new to java. Please tell me what are web services in java?
 
additionally Android is AAGAAHAHAHAHAGHAHAGAHWEGAGSFF
 
But like I said, this is a cultural thing, rather than a language thing
 
@SecondRikudo C# does that too in a way
 
If you make a JS library that lets you declare all objects in JSON (even though it's perfectly possible with JS), you'd be called an idiot
 
7:44 PM
web.config .. *2
 
And for good reason.
 
well if you make a Java library that lets you actually create Objects in XML you'd probably be hailed as a prophet of the new age
 
@Vogel612 Case in point.
Configuration !== code
That should never happen
And the Java culture makes that normal
 
but then someone would come and tell you you're a retarded jerk...
@SecondRikudo no that's not the "Java"-Culture
 
@Vogel612 Yes, it is.
 
7:46 PM
it's the Spring and Java Enterprise culture
 
Just like the JS culture allowed jQuery to happen
@Vogel612 Which is the Java culture, sorry.
 
no it isn't
 
Few people actually do plain 'ol Java for real apps and businesses
 
it's like saying the js culture is jquery only.
"real apps"??
 
Just like few people don't use jQuery or Angular for their web apps rather than plain 'ol JavaScript
The JS culture isn't that much better mind you
> I had milk that lasted longer than some JavaScript frameworks
 
7:47 PM
lel...
reminds me of when I wanted to start a web-project.
 
fge
Hehe
 
95% of all websites my company work with have jQuery included in their page
 
fge
France 33 - 23 Slovenia
 
and the person I wanted to code with and I discussed tech
 
It's not a pretty sight
 
7:48 PM
and I was referring to plain vanilla Java (without the plain)
and then they googled
 
fge
And Germany has been beaten by ... Qatar!
 
and found: vanilla.js
@fge meh. Handball..
 
But hey, we don't have Megabytes upon megabytes of unreadable incantations in XML to generate our classes for us
 
fge
Yeah, handball, the best team sport there is :p
 
meh. I don't use such madness
 
7:49 PM
We do that in code :D
 
fge
And not only because France is so good at it
 
@Vogel612 vanilla.js is awesome
 
the site presentation looks rather dull, though.
 
The fact that I managed to fool more people than I can count on both hands with it shows something about the dev community around JS
 
define fool people
 
7:50 PM
@Vogel612 People thought it was an actual framework
And asked me how to include it on the page.
But there are noobs everywhere, on JS and Java both, so it's not really a weakness on any particular language or ecosystem.
 
hmm... interesting...
 
TBF, I (and you, and anyone else) can perfectly express myself in both Java or in JavaScript
The question is how many walls I have to climb here, and how many I have to climb there
Past the initial learning curve, I've never ever had a single bug with types.
Ever.
 
hmm... I can't say that..
 
So "type safety" is complete bollocks, if you know what you are doing.
Not to mention that there are tools like JSHint or JSLint that are able to warn you about type problems
 
My highest voted SO question had to do with types.
 
fge
7:53 PM
@SecondRikudo disagree
type safety is the best safety net of a programming language
 
~sits back and grabs the popcorn
 
fge
And there is no "you know what you are doing"
That's a simple fact
 
@Vogel612 I've been doing that for a while already ;P
 
@fge I'll say what I said to @Vogel612 above
I email myself all exceptions from my long running application
 
fge
And I'll outright disagree with you
 
7:54 PM
@Gemtastic soo... you learnt from it?
 
Do you know why? Because I can afford it.
 
fge
Yeah, and?
 
I got two emails in the past year
"You know what you are doing" is a very possible truth.
 
fge
No
 
If you know what you are doing :P
 
7:55 PM
@Vogel612 Learned to eat popcorn?
 
fge
It is luck and sane practices
Nothing else
 
@fge There's no such thing as luck.
 
@Gemtastic no... about Java and js
 
fge
Of course there is
 
Luck is a concept created by the incompetent to blame the world for their failures.
 
fge
7:55 PM
If you are lucky you don't hit any bugs!
 
"I was fired, what misfortune"
@fge No! I have 60% of the codebase as test code
 
fge
Yeah, great
 
That's how I "don't hit any bugs"
 
@Vogel612 I know about as much Java as JS now. Well, I know java a little better, but it's not that different really
 
fge
Do you have mutation testing?
 
7:56 PM
@fge Nope.
 
fge
If you talk about code coverage and analysis, uh, JavaScript lacks seriously behind
 
I have unit tests and integration tests, as well as dozen or so scenario tests
Unlike what most people tend to think, you can do all those kinds of testing on both the client and the server side
Whenever I develop a feature for client-side, I can test and run it on all browsers whenever I want
 
fge
Good for you; that's not my domain
I do core server stuff, so my concerns are completely different
 
@fge TDD and testing in general is just as possible in JS than it is Java
 
fge
And JavaScript is not, and will never, be the language for that
 
7:59 PM
@fge I test my server-side JS code just as well.
 
fge
No it isn't
 
What are you lacking?
 
fge
Do you have access to mock memory filesystems in JS?
Do you have access to mutation testing?
Do you have access to mocking libraries such as mockito?
Do you have access to VM fault injection frameworks?
 
@fge I can do that yes, never had the need to, I can simply mock the FileSystem access object.
 
fge
Haha
Excuse me but hrm
Filesystem work in JavaScript?
 
8:00 PM
@fge Yeah, and it does it pretty darn well too.
 
fge
Even with Java I wouldn't have touched it
 
Streams and everything.
 
fge
Yeah, and can you Files.copy() from an FTP server to a Dropbox account?
Hint: in Java you can
With a single API
 
@fge With a library
 
fge
Can you change a file's owner?
 
8:01 PM
@fge Of course
 
fge
Can you... Hmm let's see
Change the ACLs?
Change the POSIX permissions?
Change the user defined attributes?
 
@fge Change the ACLs? (Excuse my ignorance)
@fge Yeah
 
fge
Sorry but I'll believe it when I see it
And of course the code had better not execve() to invoke native utilities
 
ios dev anyone? :P
 
fge
Anyway, "serious work" and "JavaScript" are two words which don't mix in my view
Language security mattters, and Java has type safety, isolation and checked exceptions
All things which JavaScript lacks
I do care about those things
 
8:06 PM
sidequestion @SecondRikudo ... is crunchyroll broken for you, too?
 
sec phone
 
8:22 PM
Phew, had quite the call.
@fge The node's fs module handles all of the above.
I don't know how it operates internally, but I don't think it executes shell commands.
But I don't do that in my code.
@fge Are you kidding me? Java's Exceptions are the absolute worst
I have a gazillion types of exception in this messed bush, and I have to remember what's checked and what not, of course, otherwise it doesn't compile
And while I can catch (Exception e) and just finish with it all, 3 people will jump and tell you that it's bad practice
JS makes it simple, with few exception types, without losing the functionality of being able to handle multiple exceptions (at the cost of slightly more verbose incantation when handling exceptions of different types)
As for number processing and floating points, I'll admit that JS screwed up there
But Java is not much better
 
fge
@SecondRikudo we have completely differing opinions, for me they are the best in any language
 
With 13872149287 number types, and with the flying spaghetti monster roaming over your head ready to smite you if you choose the wrong one
 
fge
Precisely because there are checked exceptions
What?
There are 6 number types in the JDK
6
Not one more
 
@fge That's 5 too many.
 
fge
Bwaaahahaa
OK, let's drop it
 
8:29 PM
I really like the fact that JS has just one Number type
 
fge
You evidently don't do any serious calculus
 
Problem is, it's the wrong type :D
@fge Don't get me wrong, JS is probably not the language for serious algorithms and computations
 
fge
Go tell that to the Fortran guys and you'll be looked at like a real idiot (I don't lie)
 
JS is a language for applications
And it does that much better than Java in my opinion.
 
fge
Can't tell, I write stuff for servers; I only have one GUI app, and a web site with a 101 GUI (but which works)
 
8:31 PM
@fge Even at the server level
 
fge
I am not at all good at ergonomics
Sorry, but I wouldn't trust JS on the server side with my life
In fact, nobody does, literally
 
If all I need is to route requests based on URI, do database interactions, make async stuff happens, which is, whether you like it or not, 90% of all servers on the web
JavaScript is superior to Java.
 
fge
90% of stuff you have encountered
That makes a big difference
 
@fge 90% of all websites of the web
We (my company) made that statistic.
 
fge
Asynchronous computation in particular is a complete fad
 
8:33 PM
Developer cycles are more expensive than CPU cycles, RAM cycles and run time cycles
 
fge
In the short term only
 
@fge I don't think that it is.
 
fge
Big misconception
 
@fge How so?
 
fge
Well, it looks like you haven't hit that barrier yet
I know people who have
 
8:34 PM
I'd much rather my developers still be able to sanely develop features and fix bugs in short periods of time, over having the app run super fast and have features come out within many months
 
fge
Well, it looks like you don't really know much about the Java ecosystem of today
What you say was true, maybe, what, 7 years ago?
Do you know spark, for instance?
 
@fge Perhaps, what I speak of is of my own, probably relatively narrow observation.
 
fge
Or dropwizard?
 
@fge I've heard the name
 
fge
Anyway, any very serious, big project will never rely on one and only one language
I simply am of the belief that JS on the server side for me is a nono
Leave that to Java or C if you want really low level stuff
 
8:36 PM
@fge For what reason?
@fge That's just the point
What if you don't want low level stuff?
Of course JS is not for low level, it was never intended to be
 
fge
OK, let me put the comma where I meant to put it
"Leave that to Java, or C if you want really low level stuff"
 
Let's do this from a different direction
Why should I take Java as the next language I learn?
Type safety is a non-issue for me. As I said, I've never had type related bugs in my code past the initial learning curve of JS
And assuming I don't have to do serious number crunching or intense algorithms, for now.
How does Java make my life easier as a developer?
 
@SecondRikudo Because your server backend are in Java. That's the simplest reason if you want something constructive
 
@Gemtastic Define constructive.
 
If you're not looking for a real life functional reason in your current life, you should pic a language that you feel is more enjoyable.
 
8:40 PM
I've been running an app in node for over a year now, and aside for change updates I've only had to restart it twice, and only had a small handful of exceptions throughout the entire runtime.
 
That wasn't the question
The question was "Why should I take Java as the next language I learn?"
 
I can express myself well in any language, assuming I know the proper incantations, but how does Java make my life better?
 
What you're implying is the question of "why should I learn Java when I think JS works just fine"
 
@Gemtastic no
Why would I learn Java when I can do anything (within reason) that Java can do, but with simpler, more readable code, that doesn't force me to write things in a certain way?
How does Java ease my life, in comparison to the language I already know?
 
Java might not make your life better. Java is imo a language made for humans. Humans error, and a lot of people more than others, that's why the JVM will compensate, rewrite and compile a better version of the code. It will also ensure that the programmer don't derp. It does offer more heavy-end options so if you learn java, you can keep developing into more complex things that normal code monkeys can't even begin to phantom.
Boy would I have loved (when i was javascripting) the syntax highlight for that the method called upon at success didn't exist because i spelled it wrong... Any Java IDE would have alerted me of my derp.
 
fge
8:46 PM
@SecondRikudo as I said, you're lucky
 
@fge Lucky how???
That I spent years studying test methodologies and making sure that my own errors are discovered as soon as possible?
 
@fge I wouldn't say he's luck as much as he's not stupid and can keep track of his good sufficiently enough that type safety isn't an issue
 
Again, I don't believe in luck.
@Gemtastic One: There are JavaScript IDEs
A fair share of them
 
fge
Well, if you don't believe in type safety that's your problem
 
Now, you could argue that since JS applications tend to be lighter, it's easier to keep track of things to ensure that you don't eff up the types.
 
fge
8:48 PM
For me it is a fundamental feature
 
Two: If you don't develop JavaScript with a linter (JSHint, or if you're really hardcore, JSLint) I automatically assume that you don't have sufficient discipline to develop in JavaScript.
 
@SecondRikudo I only started learning JavaScript one week ago ;)
 
@Gemtastic Awesome
Always use a JSHint
There, you already know more than 80% of all JavaScript developers out there :D
 
I didn't really know you could use it outside of the JS fiddle
Until a little bit earlier today
 
@Gemtastic JSHint is a command line tool
 
8:49 PM
Well, now I know what it is
It's just that the version I had in my IDE wasn't very good
 
Also, just because you can run JavaScript as is, doesn't mean you really should
You can, and should, have a build step
 
fge
Can I recall that this is a room about Java? :p
 
@fge In short,
What JavaScript lacks in language features, I complete with good methodologies
I carry my good methodologies to any language I pick up next
 
fge
Well, that's not far from me, except that my first language is C
 
But if a safety net is removed that you relied on (because as of tomorrow Java is deprecated because the US government deemed it too unhackable) and you have to move to something with those efeatures missing, you're in a pinch.
 
fge
8:52 PM
So, I'm rather used about low level stuff
 
@SecondRikudo I say, when you are gonna write proper JS that does what you do with it, there are a lot of things to keep in mind and routines to do before running your code or even begin typing it, as it all boils down on you as the developer if your code is gonna work or bork. Java Has that built in.
 
var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    stylish = require('jshint-stylish'),
    mocha = require('gulp-mocha');

gulp.task('lint', function() {
    return gulp.src(['**/*.js', '!node_modules/**/*'])
        .pipe(jshint({
            esnext: true,
            strict: false,
            node: true,
            globals: {
                describe: false,
                it: false,
                before: false,
                after: false
            }
        }))
        .pipe(jshint.reporter(stylish))
@Gemtastic this is the entire build file I'm using.
It lints and tests all of my code every time I run it
This is comparable to compiling and running tests in Java
 
fge
Hmmno
JS is totally interpreted for one
Not Java
 
@fge In terms of making sure the code is valid
Not actually compiling to bytecode...
 
Even if it is as you claim, Java still has all that built in. You do not have to mind and make as many things as you are in JS
 
8:54 PM
And JS (very similarly to Java) is in fact JITted, not interpreted in the classical sense.
 
fge
Not only that but tools as SonarQube, FindBugs etc can do much more
 
@fge Not familiar with those.
 
fge
@SecondRikudo that is only fairly recent, and only due to the explosion of its usage in web browsers
But as a result there is node.js
 
@fge Just like proper streams and lambdas are recent in Java, where they have existed for years and years in JavaScript
Your point?
 
fge
And it gave birth to yet another flurry of well-intended gents who claim that "yeah, async can solve it all!", whereas... Hmmno it doesn't
My point? There is NO NEW OPCODE in the JVM to support streams and lambdas
 
8:56 PM
@fge async can't solve everything, far from it.
 
fge
The only new opcode which enabled all of this appeared in 1.7 in fact, and that's invokedynamic
 
But it's still an insanely useful thing to have.
 
fge
Since you are an expert on JS you probably have heard about nashorn, right?
 
It's so insanely useful that in C# is embedded as a core thing in the language!
 
fge
It is not that useful
For one, lambdas and error handling don't match well
 
8:57 PM
async void whatever() {
    var whahtevers = await makeSomeOtherCall();
}
That is pretty fucking useful ^
It of course depends on what you are doing.
 
fge
Well, Java has Future for that
 
If you're CPU bound async doesn't really mean anythingk.
 
fge
It's just the same thing, with more control
 
@fge So does C# and so does JavaScript.
JavaScript has callbacks, promises, and coming up in the future, async and await
 
fge
Not that they will be that much of a revolution
 
8:59 PM
Nope, it's just a cleaner way of performing a relatively common task
 
fge
The revolution for me will be a type safe scripting language with JIT
 

« first day (1558 days earlier)      last day (3366 days later) »