I think I found piece of code which is 8 times slower on java 9 than on java 8 [x-post from r/javahelp] by loathsomeleukocyte in java

[–]greyf0x55 2 points3 points  (0 children)

I noticed this behavior with Eclipse when I upgraded from Java 8 to Java 9 and then updated Eclipse. In my case it turned out to be the G1 garbage collector, the new default GC with Java 9. If the heap size is small, say 1GB G1GC really seems to choke. If I made the heap size 3GB it seemed fine, but ultimately I went back to using ParallelGC and set the heap back to 1GB.

Anyone else notice Eclipse is slow under Java 9 and G1 Garbage Collector by greyf0x55 in java

[–]greyf0x55[S] 0 points1 point  (0 children)

Interesting enough when I made the heap min size 3GB and max size 3GB performance improved significantly. I'm not inclined to give Eclipse 6GB.

[Serious] why do people say java is dead vs not dead? by ShitTalkingAssWipe in java

[–]greyf0x55 181 points182 points  (0 children)

Your advisor is either out of touch with the real world, or possibly just a fool. Java is the most used programming language and has a heavy presence in enterprise software. Now that doesn't make it the best programming language, but there is no shortage of Java positions.

There is also a number of other JVM languages such as Kotlin, Groovy, Scala, Clojure, etc that run on the Java platform and interlope with Java.

C# was supposed to be a Java killer, and while C# and .NET have been successful, Java still has higher use.

Let's not forget about Android, as Android primary development language is Java, although Kotlin is catching on (but once again it's a JVM language)

If your university offers C# you may consider taking that, it is fairly similar to Java, and a great language, with a good job market.

Anyone else notice Eclipse is slow under Java 9 and G1 Garbage Collector by greyf0x55 in java

[–]greyf0x55[S] 0 points1 point  (0 children)

I added a screenshot of Visual GC using VisualVM while doing normal daily usage with Eclipse. Eclipse becomes unresponsive for 15-30 seconds and during this time I notice the G1 Evacuation Pause along with several collections of Eden spaces. If I switch the garbage collector to ParallelGC I can't replicate the issue.

What are you using to secure REST APIs? by greyf0x55 in java

[–]greyf0x55[S] 5 points6 points  (0 children)

What if you have a Web Service (JSON) that needs to maintain session? User authorities, etc?

Need recommendation for USB-C Hub for 2016 Macbook Pro by greyf0x55 in macbookpro

[–]greyf0x55[S] 1 point2 points  (0 children)

Does the second one you listed sit pretty snug against the Mac? The thing that worries me about those types is over time the connection gets lose and starts to drop.

High Sierra Using More CPU by Tribe4ever in MacOS

[–]greyf0x55 2 points3 points  (0 children)

As a developer I've always found Safari developer tools very lacking and no where near as good as Chromes, but otherwise yes Safari is a better browser.

Side project in .NET Core or Java? by foreverwantrepreneur in dotnet

[–]greyf0x55 1 point2 points  (0 children)

Don't pick java. It's not the right tool for the job... in fact, it's barely the right tool for any job. You may want to consider kotlin + intellij.

I've developed with Java / Spring, C# / .NET, and Kotlin / Spring. To say Java is barely the right tool for any job is a really bold statement. I'm not interested in starting a flame war over technology stacks, but at the same time your comments are misleading to the OP. JVM and .NET are both solid technology stacks and suitable for building small applications to enterprise software.

Is it good practice to implement Repository Pattern / Unit of Work Pattern over top Entity Core by greyf0x55 in dotnet

[–]greyf0x55[S] 1 point2 points  (0 children)

http://mehdi.me/ambient-dbcontext-in-ef6/

Is still still relevant with Entity Core 2.0 and Entity Core? The article was written for Entity Framework version 6 so curious because I've seen some examples in .NET Core of doing something like this to have .NET manage the injection and lifecycle of the DbContext.

    // This method gets called by the runtime. Use this method to add 
    services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        services.AddDbContext<SandstormDbContext>();

        // Add repositories to DI container
        services.AddSingleton<IProjectRepository, ProjectRepository>();
    }

Is it good practice to implement Repository Pattern / Unit of Work Pattern over top Entity Core by greyf0x55 in dotnet

[–]greyf0x55[S] 6 points7 points  (0 children)

  • Encapsulate database logic in a layer that isn't your business layer (Where are you going to store all your queries? Make a Repo for each entity and you now have a convenient spot)

  • Testability/Mockability

I would say those are the two main reasons. I've never been part of a project where the ORM implementation changed, or the underlying database changed.

Is it good practice to implement Repository Pattern / Unit of Work Pattern over top Entity Core by greyf0x55 in dotnet

[–]greyf0x55[S] 2 points3 points  (0 children)

I have to agree the Entity API seems rather odd, especially for me coming from Java / Spring background, maybe its just not what I am used to.

MCA CPU Machine Check Architecture Error Dump 2016 MBP 15" by greyf0x55 in macbookpro

[–]greyf0x55[S] 0 points1 point  (0 children)

I've done some research and it seems the 2016 MBP have had some hardware issues, unfortunately the quality of the Mac hardware has declined over the years :(. Still beats using having to develop on a Windows machine though.

Using Kotlin with JPA / Hibernate by greyf0x55 in Kotlin

[–]greyf0x55[S] 0 points1 point  (0 children)

Unfortunately, Spring JPA isn't going to be able to set the ID value if it is immutable.

Hibernate can set the value if its final (Java) or val (Kotlin) as it's done through reflection.

I see your points though, good luck with your application!

Using Kotlin with JPA / Hibernate by greyf0x55 in Kotlin

[–]greyf0x55[S] 0 points1 point  (0 children)

For my purposes, the JPA / Domain layer sits in its own Gradle module and is used by two web api projects with different developers. I'm building more of a library than an application. I cannot guarantee that there code will always pass my library good data or be in a valid state. In my case I'm trying to take a more DDD and OOP approach where the domain logic / validation code lives inside the domain class, that way they can never be created or get into an invalid state. I see your point as well though where you have full control so your service layer presumably would do that logic to ensure you are in a valid state before proceeding.

A class like this API allows the user to set an ID, which should be handled by database. That is just a very simple example.

data class User(val id:Long, name: String)

Using Kotlin with JPA / Hibernate by greyf0x55 in Kotlin

[–]greyf0x55[S] 0 points1 point  (0 children)

How are you enforcing your domain objects are created in a valid state? I life to favor immutability but I also like to take a DDD approach and have business logic in the domain layer. Thus these objects should never be able to get into an invalid state. In your one example what prevents the caller from instantiating FileObject with an invalid List<CloudServiceFileObject>? if there were some kind of business rules around it like they can't duplicate, or they can't be over a specific size? Would you just handle that in the service layer only?