A következő címkéjű bejegyzések mutatása: Java. Összes bejegyzés megjelenítése
A következő címkéjű bejegyzések mutatása: Java. Összes bejegyzés megjelenítése

2014. augusztus 7., csütörtök

Spring Data Jpa - Filters


I am working on an application with a lot of content nodes and fields. I want to provide the user with an interface to filter down the result set by various properties like tags, date, so on.


The backend uses spring data jpa and controllers to expose the resources as json. The play framework frontend consumes the endpoints. I've decided that querydsl will help me greatly at the service layer.


I'm concerned with maintaining the state of the query from frontend to service and minimizing the amount of boilerplate. I'm asking for guidance and examples on implementing a flexible and extensible filtering system or ideally links to samples and examples.






Get rid of the frickin' toolbar!


<rant> How can anyone expect Java to be taken as a serious environment if you KEEP BUNDLING THAT STUPID TOOLBAR with the client installer?! Even when Java is widely criticized for being unsecure and people are adviced to uninstall it on their machines, you give them even more reasons to do so by bundling something that shouldn't even exist. The early 2000's called and wanted their thing back. GAH. </rant>






Should I use direct references to classes as delegates?


So a lot of the time when I'm programming something (usually in Java or Objective-C) I use a delegate that implements an interface (or a protocol depending on which language I'm in), asserting that whatever class is passed to an object implements methods with predefined signatures.


I usually do this so that a thread can pass a message back to a controller when it is done executing, or a menu shown to the user can initiate some action when the user selects an option. I can see the use of generalising whatever is passed to my class to be any class that implements particular methods, as it allows me to reuse the code I've written.


However, the other day I was reading an article about "anti-patterns" and unnecessary abstraction. The writer was saying that programmers sometimes have a habit have making abstractions prematurely, such that they have no practical use and only serve to obfuscate the code.


I realised that sometimes, when I use delegates, only one class will ever implement the interface (or protocol) and create objects of the class that requires this delegate to be passed.


This made me think- should I instead be passing a reference to the single class that uses the code that requires a delegate, only generalising the code with an interface when it becomes necessary such that two classes can use the same code?


Thanks!






2014. augusztus 3., vasárnap

Is it possible to make Spring Roo apps behave like Django apps?


Hello,


I am looking at Java-based RAD/MVC frameworks, and came across Spring Roo. I am much more familiar with Django, which is a Python-based RAD/MVC framework.


Under Django, if you give it a database schema (or write code to generate the schema), you get two things in return:


http://site/admin/ <- This is an interface where you can add/delete/update records to the tables in your schema


http://site/ <- This is a blank slate. You write templates that are called from your Python code to actually generate webpages.


With Roo, I see I get one thing. If I hit http://site/ on a Roo-based site, I get an interface to add/delete/update records to the tables in the schema. But I don't see a way offhand to write up a clean template that Java code can interface to.


How can I make Roo behave like Django?


Thanks in advance!






Fix my code


I wanted to create a java program which decides what pizza I will order every Tuesday, I want to know why my code doesn't work and if IF statements require an ELSE to function


import java.util.Random;


public class apples { public static void main(String[] Args){



Random dice = new Random(); int number; number = 1+dice.nextInt(3); if(number == 1){ system.print.ln("Hawaiian"); } if(number == 2){ system.print.ln("Pepperoni"); } if(number == 3){ system.print.ln("Meat lovers"); } } }

}






2014. augusztus 1., péntek

Struts prerequisites


I would like to know from you guys what background knowledge do I require to be able to develop applications on the Struts 2 framework. I have just started out as an intern at this firm and my first task is to learn Struts 2, I have an okayish understanding of Java SE but have not worked on Java EE up till now...






Skill Sets for large organization


I have worked in start-ups for my entire career till now (7 years). I have primarily on core java (java 6), and not on EE or frameworks like Spring/struts etc. Most of the stuff I worked on was built in-house, and external library usage was limited to Guava, Apache Commons, mybatis etc. There wasn't even proper version control setup.


I am shifting to a large organization in couple of weeks. Please suggest what all do I need to know, and could need to know to ensure smooth entry in the new role.


Have listed down a few myself:




  1. Java 8




  2. Software design patterns




  3. Webservices




  4. Frameworks like Netty and Akka




  5. Version control concepts.




  6. A web-framework like Play etc.