Synchronizing web, mobile and desktop apps using SQL database - java

I am currently researching and developing an application in Java for the desktop along with a Java applet to embed inside a webpage and I am using C# to develop an Android and IOS compatible app. (I am open to using other languages, these are just what I have started with and feel the most comfortable with at the moment).
I have it so that the user can use any of the 3 environments to enter a post which is then stored in a database.
How would I make the various apps sitting on each of the platforms pull the new post down from the database so that the users can see it on all three platforms straight after it has been added to the database.
I assume that the applications would need to be looking in a specific table which is owned by the admin who is logged in and doing the posting and then as soon as it sees a new post it could send a query to retrieve it. These came concept would need to be implemented to updating and deleting posts also.
I am new to this type of cross-environment development and wanted to ask for advice. Thank you for any help. I have tried to make this question as specific as I can considering I do not have a particularly specific question in the first place.
Any advice about how to go about this task will be greatly helpful.
Thanks.

One road you could take is writing a simple web service, maybe using a high-level interpreted language, such as Python or Ruby, to provide a RESTful HTTPS backend. That way, all applications could query this web service, data would always be in sync, and you could have multiple front-end interfaces.
This seems like a trend nowadays, lots of multi-platform applications are structured as smaller micro-services on the back-end. And it really makes sense sometimes, because you get a lot of less coupling between parts.

Related

Store MySQLite Database Online

I'm making a voting app in Java using Eclipse where the user votes for their favorite team. Right now I have a local MySQLite database that I am managing with the MySQLite Firefox extension. The votes are stored in the MySQLite database, then I have another java application that reads from the database and outputs the name of the team that got more votes. However, I would like to store this database online, so multiple people can vote at once, then the results are displayed. How can I go about doing this? I am guessing that I will need PHP, but I am having a hard time finding a tutorial on how to integrate a MySQLite database with PHP. I pretty much just need to store my database online. Everything is functional locally.
Maybe I'll need more details but I'm assuming you have wrote a Standalone Java app, which is connected to you local SQLite Database.
Also, I think you don't want to distribute that app for everyone who wants to vote (would be better if they could vote via a website, right?).
In this case, you have to write a web application to provide both front-end and back-end of your app. You can pick one among many existing languages and frameworks (PHP is one of them), such as Java itself with some web framework, Ruby on Rails or Python/Django (just to depict some of them). Plus, I'd recommend you to use some other database such as MySQL or PostgreSQL.
Here are basic tutorials to you follow for some of the previously mentioned languages/framework:
Java (JSP)
PHP
Ruby on Rails
To deploy you app (i.e. put it online, you'll need a server). Honestly I'd recommend you to use Heroku because the deploy process is really simple (just push your code using git) and you can run your app for free (if your app got really successful you may have to scale up the server and then you'll have to pay, but maybe that's not the case, right?).
So, pick up a language and framework, write your web app and deploy it to the server. Then you can have multiple access voting into the same database.

Java Backend/Server design setup

This is a very beginner question. I have tried to search for advice but am overwhelmed by the amount of information and would like some help with ideas on approaches to server design or what to search for!
What I would like to set up is a backend server that provides search capabilities and business logic and validation across some fairly basic data. It wont get too large.
I would then like to be able to plug in a website as a front end or a mobile app or a facebook app or even a desktop app..
My question is what is the best way for front ends to hook into the backend? I would like to have various user accounts with permission levels so authorisation would be important.
I generally only code as a hobby so whilst technically I have built a spring based website before the exact semantics of the client server relationship weren't clear to me. Now I want to separate the backend so that is is agnostic of how the data is displayed or entered completely and can run on a separate machine.
Thanks,
Rob
There is a ton on options. I had good expirience with apache CXF rest services (logic encapsulated in java beans, spring configuration) and pico web remoting ( more exotic,
but also rest service and plain java objects providing business logic)
if you ar already using spring, I would recommend to stick with CXF - it integtrates seamlesly ( and is spring configured itself )

What's the best modern way of developing open web apps with a rich JavaScript API for data access?

The company I work for has a powerful Java based server component framework for interacting with special control systems.
We have a UI framework but this is also Java based. A customer can use a Java Applet to access control information etc.
I've recently started working on a rich JavaScript API to access this control system information remotely. It's currently a prototype. It's nice because anyone who's familiar with JavaScript can access our Components remotely. So far it works really well. I've written some prototype applications that use this API. This gave me an introduction to jQuery - great! I've also added the ability for the JavaScript API to make RPC calls to Java as well as a session based Component architecture for when you really need something held on the server.
So far so good. I have to admit though that I'm not really a 'web developer'. I've never used Structs, Spring or any of the MVC based architectures for serious Enterprise based web development (I AM very familiar with design patterns though). My background is application development.
I'd like to know from the pros whether this is the right approach or whether I'm missing anything. Someone I work with has created a really neat Server Side Include architecture. However, I'm wondering now whether this is really necessary? After, I think I can create just about anything using my JS API and jQuery. Should I consider any other 'server' based architectures in this new age of open web apps?
As far as browser support goes, I'm not concerned about the older generation of browsers (please no lectures here, the old technologies we've got will do for IE6 and alike).
By using this open client side technologies, I'll be able to write sophisticated open web apps. Very little server side code will be needed in reality because of my API. I'll be able to take advantage of HTML 5 features etc. But am I missing anything? Should I be considering other server side based Java technologies like Server Side Includes? Am I too client focused?
Well there are four ways to create modern RIAs: HTML5/Javascript, Java Applets, Flash/Flex and Silverlight. Only the first two are open.
Applets are a nuisance and not really liked by people. Personally I'd go with HTML/Javascript.
Since you are a Java shop I'd recommend going with GWT for the following reasons:
It's open source with business-friendly license.
It creates minimum-size browser-optimized javascript.
It's actively developed and used by Google. This is a guarantee that it'll be supported for some time.
There are a lot of developers with knowledge of it.
It has good documentation and very active user group.
I'm sure there are many opinions on this, but my take is that with HTML5, faster Javascript interpreters, client side persistent storage, etc. it makes it pretty compelling to put all the UI application login in the client (browser), and just use some form of RPC (with JSON serialization) to the server. Therefore templating engines, SSI, or any server side generated markup is no longer required for interactive applications. It's still fine for semi-static documents. For that I use sphinx document generator.
Fast-forward two years, and you now have TodoMVC at your disposal to help answer this question. GWT is still mentioned, though as far as server-side technologies go, The Holy Grail is probably what you're looking for to maximize code reuse on client and server.

Migrating a 2-tier Java application to...?

We currently have a 2-tier Java Swing application sitting on top of MS SQL Server 2005. All the business logic is in the database. The client is quite old (and not very friendly), and for reasons of performance and scalability, we've already started porting some services to a middle tier in Java.
However, we still have a number of short and long term goals:
Pick a technology stack for a new front-end
This isn't easy - I can see everything from a web app at one end of the continuum to a traditional desktop app at the other being viable choices. The current front-end isn't really complex (mostly form-based), so I can see web/AJAX fitting, but it's an area where we don't know what we don't know.
Stacks on my list are:
Eclipse RCP, Netbeans RCP
Flex/Flash, Silverlight, JavaFX
Pure Javascript frontends (Sprout Core, Javascript MVC, ...)
Java-based Web frameworks (Wicket, JSF, ...)
Find a way of making the current application perform acceptably in a remote situation
We have some clients who resale our app to smaller clients and need to be able to remotely deploy it. Due to the 2-tier nature of the current architecture this leads to terrible performance (for example, calling a stored procedure that returns 18 result sets). We've used a Citrix solution in the past, but no-one likes that approach. Tunneling JDBC through port 80 also sounds like a bad idea. I was starting to wonder if there's anything that could use a X-Windows like approach to remote just the GUI part.
To simplify development and leverage your experience in Swing consider using Vaadin for your frontend. It is a Java framework for building modern web applications that look great, and perform well. All the code is written in Java and looks very similar to Swing.
As far as overall application architecture I would advise multi-tier, service oriented architecture. The best way to do it is by using Spring framework with Hibernate for database access.
If you want to easily redeploy your application, for an update, security reasons, etc. and if you want your application to be it to be accessed remotely, you should really consider a web based front end.
Plus, this way, only one app, your web app, will handle connection to the database, so no JDBC tunneling or whatever.
Concerning the best framework, it depends on your team knowledge, the way your application will be used (more or less javascript), etc.
We've just gone through a very similar evaluation process as we're migrating a legacy application.
For us the biggest deciding factor in what front-end framework to use was the prior knowledge of the development team. We wanted something that everybody would be comfortable with immediately. We had a couple of the senior developers that have worked with X or Y, but the framework that everybody knew was Swing.
In the end we decided on the NetBeans platform using RESTful webservice to communicate with an EE server.
As a bonus you can get your NetBeans platform application to deploy as a Java WebStart application, which means you get the benefit of not having to worry about individual installations.
If the frontend is mostly form-based, I would stay away from Flex. Flex is great for some applications (I'm using it for a canvas based application), but the form components of Flex has some usability issues. They just don't work like you expect from todays web. (like missing support for mousewheel, typing in dropdownlist only take first character into account etc.)
Assuming that you are going to force all your clients to install a new middle tier, I can't think of an argument against making it a Java web app. As already mentioned you have the benefit of controlling all access into your platform over HTTP, which allows easy resale, just with firewall configuration. There's no reason you can't make use of Javascript within a web front end, you may be interested in DWR, which allows you to interact directly with Java objects via Javascript. I've used this before to add some simple Ajax interaction to a Spring MVC webapp.
The reasons I like this approach, you're already migrating code into Java middle tier, so
Already imposing Java server hardware cost on clients, hosting app server / web server is comparable
Already have Java expertise, can be leveraged with DWR
Can use as much/little Javascript as appropriate (I've used DWR with IE6, Firefox 3, Chrome)
I think you're right to be wary of pushing too much functionality to the client, I'd go for as thin a client as possible. The only reason I'd look at the first two stack choices would be if you have some developer expertise in a particular area, and not Java webapp/Javascript.
I'd suggest to create a short list of candidate frameworks and create a small test application with all of them. This way you will get a sense of good and bad aspects from all of them and also get a picture what the community activity and documentation is like for each project (there is a lot of variance on those).If you end up doing this I hope you'll include Vaadin in your short list, I think it would fit you very well. If you have any questions just come over to our forums and we'll help you to get started.

Framework/Platform Selection?

So...I am creating software for a university. The purpose of the software doesn't matter. What I do need to know is, the best way to make it, and what technology to use.
The software needs to be able to accept multiple data sources, from Excel to SQL. However, the students will be using it primarily, and they won't always be on the schools network. I don't know if this should be created as a Web Application, or an app using Java (or something similar). Also, the students are going to need to be validated to use the software according to their current student status.
If I do this as a Web Application, and have it run off of the schools server, is this a better idea? Only thing is, this would require a lot of testing on their end as well right?
If I did this as say a Java program, can this even be done?
-Scott
If you want to use this application by students outside of schools network than a web application is the only viable option. If you will develop this as a Java program (I assume by Java program you mean a desktop application), you have to install this on every student's computer in school as well as home.
Edited in reply of your comment :
Regarding framework/platform selection, I would advise to develop this in what you know most. A good programmer can develop a good software in a language/framework/platform of which he/she has good knowledge and experience.
I'm assuming that a web technology will be best, because you can access it from any machine that connect to the Internet.
Java EE can manage this. So can .NET.
I'd recommend either one with Spring (Java or .NET flavor) as the framework.
The software needs to be able to
accept multiple data sources, from
Excel to SQL.
Spring will accomodate relational databases or Excel.
However, the students will be using
it primarily, and they won't always be
on the schools network.
A web app will only require Internet access. This could pose some security issues that you'll have to sort out. It's easier if they're on your network, because they're already authenticated as students and authorized to use your app.
I don't know if this should be created
as a Web Application,
I would recommend it.
or an app using Java (or something
similar).
Both Java and .NET can be written as either desktop or web.
Also, the students are going to need
to be validated to use the software
according to their current student
status.
Don't know what your security architecture looks like, but Spring Security can work as a cross cutting concern with databases, LDAP, etc.
If I do this as a Web Application, and
have it run off of the schools server,
is this a better idea? Only thing is,
this would require a lot of testing on
their end as well right?
Can be done. Testing is required no matter what.
If I did this as say a Java program,
can this even be done?
Hard to tell. No requirements, no idea of your capabilities, etc.

Categories

Resources