« first day (440 days earlier)      last day (453 days later) » 

user1804599
6:01 PM
Hello. :L
 
@rightfold I assume it is not possible that only AND questions are posted here?
 
user1804599
It is.
 
cool
Then we wouldn't get flooded as much.
 
user1804599
room topic changed to Java Sucks: Floating on singletons. [boilerplate] [checked-exceptions] [design-patterns] [erased-generics] [inheritance-hierarchies] [java] [singleton]
 
6:02 PM
tagnames=singleton+java
What was is before?
Just singleton?
 
user1804599
Yes.
 
Why did I think it was Singleton OR Java? lol
The room would have been flooded to death.
 
user1804599
validateBulletin :: Text -> Text -> Set BulletinValidationError
validateBulletin title body = execWriter $ do
  when (Text.null title) (tell $ Set.singleton EmptyBulletinTitle)
  when (Text.null body) (tell $ Set.singleton EmptyBulletinBody)
 
user1804599
Singletons are great!
 
user1804599
@FredOverflow XD
 
6:03 PM
I suppose it's not possible to have EVERY question posted here? :)
 
user1804599
I have no idea.
 
I hope it's impossible.
 
user1804599
class (Functor m, Applicative m, Monad m) => SaveBulletin m where
  saveBulletin :: Bulletin -> m BulletinID

postBulletin :: SaveBulletin m
             => Text
             -> Text
             -> m (Either (Set BulletinValidationError) BulletinID)
postBulletin title body = do
  let validationErrors = validateBulletin title body
  if not (Set.null validationErrors)
    then return (Left validationErrors)
    else Right `fmap` saveBulletin (Bulletin title body)
 
user1804599
This is nice, by the way.
 
user1804599
It’s dependency injection!
 
user1804599
6:05 PM
And handling of storage errors are up to the instance of SaveBulletin. :)
 
Talking about Java, we conducted a short written Java test where I say "Declare a variable of type X and initialize it with a new instance of type X. Then add that instance to the list foo."
 
user1804599
Gotta love monads.
 
It was about one page of hand-written text. We allowed 2 hard mistakes and some silly mistakes. Guess what percentage of students failed.
 
user1804599
@FredOverflow X x = new X(); list.add(x);
 
user1804599
@FredOverflow 94%
 
6:06 PM
FAILED?
 
user1804599
Yes.
 
Come on, they have 1 semester of experience.
 
user1804599
Oh, in that case
 
user1804599
100%.
 
user1804599
6:06 PM
60%?
 
Still way off.
 
user1804599
After one semester of JavaScript, people could still not write a for loop in my school. vOv
 
But I guess I shouldn't have asked you.
 
user1804599
@FredOverflow 30%
 
You know how bad Java students are :)
@rightfold Somewhere around that, yes.
 
user1804599
6:07 PM
lol
 
user1804599
Are you allowed to do something silly like this?
 
// Declare a local variable of type int named xyz!
local new int = xyz;
 
user1804599
X x = new X();
X y = new X();
try {
    if (x != y) { throw new Exception("fuck"); }
} catch (Exception) {
    foo.add(x);
}
 
user1804599
I’d write this. :D
 
user1804599
> int
 
user1804599
6:09 PM
No, wait.
 
user1804599
I’d write something like this:
 
@rightfold Lots of students failed at the foreach loop.
 
user1804599
// Add an X to a List® Enterprise Edition™

public abstract class AbstractXFactory {
    abstract X createX();
}

public class XFactory extends AbstractXFactory {
    @Override
    public X createX() { return new X(); }
}

public abstract class AbstractXToListAdder {
    abstract void addXToList(List<X> list, X x);
}

public class XToListAdder extends AbstractXToListAdder {
    @Override
    void addXToList(List<X> list, X x) {
        list.add(x);
    }
}

public static class Program {
    public static void main(String[] args) {
 
user1804599
And I’d probably still be done before the other students.
 
user1804599
Or is it not allowed to use more code than necessary? :(
 
6:15 PM
You are only allowed one line per instruction, most of the time.
 
user1804599
@FredOverflow I recall a guy writing this:
 
Also, you only have one piece of paper, and you use a pencil.
 
user1804599
if (…)
{ …;
…;
}
break;
if else (…)
{ …;
…; }
 
What is he breaking from?
 
user1804599
Instead of if (…) { …; …; } else if (…) { …; …; }. :D
 
6:16 PM
:)
 
user1804599
He probably confused it with a switch statement.
 
user1804599
Which still require explicit breaks in inferior languages.
 
I would like an extra grumpy cat doing reviews at our place.
 
 
2 hours later…
8:46 PM
@rightfold I forgot one thing: The students were supposed to write some meaningful error message of their own choice to the console in case some value was negative.
Most students wrote System.out.println("negative values not allowed"); or something.
One wrote System.out.println("ERROR: Fehler");
("Fehler" is German for "error".)
 
Wonderful chat name
 
user1804599
@FredOverflow xD
 
user1804599
@FredOverflow I would do it correctly and write to stderr. :)
 

« first day (440 days earlier)      last day (453 days later) »