|
I'm relatively new to web applications development, specially when it comes to frontend, but as I understood, a typical frontend would have a php/jsp layer that calls the backend to generate dynamic pages.
Now we're designing a new site, and a colleague of mine insists on not having that layer. He wants the pages to have html and JS, that will then directly invoke the backend. This, of course, means having the backend services publicly available, which I'm not particularly comfortable with.
Is this architecture somehow common? Can it be considered to follow MVC?
|
|
|
|
|
I never even touched PHP nor Java, the 'typical' website at our company is written in MVC. Still, any public service that is available from the internet will be used by someone you don't know. May be a good way to test its robustness, but I wouldn't recommend having a public webservice without any authentication that can be used to delete data
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am creating a Java web service that is receiving input requests in XML format. The web service's function is to parse the XML initial request and send it's own post request to a third party organization which does a look-up for the request and if available they send a response back in XML format to the web service for processing. If the response does find the data in the look-up the information it sends back as XML and is parsed by the web service then saved as a .pdf file. Once the .pdf file is created the web service packages a response XML message and along with the identifying information a link to the .pdf is part of the message sent back to the calling client. Now, if the search for the information is not found a XML message is sent back to the client indication the third party did not have the information ready with a status as pending. For all of the requests for the third party information the web service will create a folder on the server with a XML status file and if the .pdf file is created it will be in this folder too.
Now comes the tricky part of the design. There is another application located on the same server that needs to be running in a loop that and every 30 second it needs to call the web service on it's own and if the server folder created by each new request does not contain the .pdf that program will make the web service call to retry the initial call and see if third party does now responds with the XML message that contains the valid information so it can create the .pdf and send a message back to the original client.
Now, if I am using a tomcat server what type of application should I create that does the 30 second looping? The server does have a MySQL database. How should I have the 30 second looping application communicate with the web service? Finally, if the looping application does make a successful call to the web service what is the best way to cause a trigger from the looping application to make the web service send the successful response to the original calling client?
Finally, if the looping application does make a successful call to the web service what is the best way to cause a trigger from the looping application to make the web service send the successful response to the original calling client? One note is that the 30 second loop must scan the new request folder tree and retry for any of the requests that have not succeeded.
|
|
|
|
|
I have given this problem a lot of thought and I think I might have a solution. The site does have an IIS server as part of the application. I think I could create another asp .net web service that runs on that site and have it handle the 30 timing process. What I think might work is that I use a 30 second sleep then cycle through the process again. Does anyone see any problems with doing this? Any problems with resources or having a separate web service running like a different thread in the same application?
|
|
|
|
|
Just make your "looper" another "client" application that sends asynchronous requests to whatever server for status and retry requests. Use a timer, service, sleep loop, thread with UI, whatever. Looper can run from anywhere, including the server.
|
|
|
|
|
So what your saying is don't use a web service for this but create another web application for the looping code. Is this correct? If this is the case
how would I get the original main web service that handles the main client I/O to communicate with the new web application? I know I would have no problem sending service requests to the main web service but don't know how requests would go the other way. I guess I could always use the database to go from the main web service to the web application. Does this sound like the best way to go?
|
|
|
|
|
I suggested a "client" (NOT web) application: console; Windows forms; WPF; service; Java whatever. Something more manageable and flexible than a "web app".
If you want to know more about how "servers talk to clients", refer to "asynchronous callbacks".
You've already established a work-flow; all you're trying to do is introduce a retry mechanism. Step back and think about this "client" as a "monitor" / observer that submits retry requests; that's all.
|
|
|
|
|
I think I understand. The application does have a main entry point and there I can start a separate thread to handle the observation of the primary web services output.
|
|
|
|
|
Yes; start small. Just query the server every 30 seconds at first (send a web request; the server responds) as a proof-of-concept. Once that mechanism is working, introduce a new request to "retry", etc.
|
|
|
|
|
Thanks! Once I get something working I will post the code back to see if everyone agrees with my design.
|
|
|
|
|
We have a php project (made in core php and mysql), now i am willing to scale it and would like to go for SOA. I am thinking of a service layer with WCF and calling those services from my PHP code. What would be the best way to move further? Is it the right way i am thinking or any other way should i consider?
Thanks,
PS:We are developing a product and started with core PHP due to resource shortage, Please suggest me a way so that we can design APIs and reusable components consumable by any client.
|
|
|
|
|
Not exactly sure what you think you are asking but if you are attempting to design a system to meet business needs...
First it doesn't have anything to do with specific technologies.
Second the FIRST thing that is needed is realistic business expectations as to what the business actually needs.
Finally, most business realistic needs do not require anything at all in terms of scaling with modern environments.
|
|
|
|
|
I'm developing a C# desktop app which runs on Windows, Mac and Linux (under .NET or Mono).
The plan is for the program to be divided into two parts in separate processes: The front end GUI and the back end storage server.
The reason for dividing roles in this manner is to facilitate access to the data store by indexing services. The data store can be indexed by the operating system regardless of whether or not the front end GUI is running.
So, my question is: What technique do you think I should use for inter-process communications between the front end and the back end? HTTP-based REST is feasible but how fast is it in practice? I need something fast and cross-platform compatible. Any suggestions?
|
|
|
|
|
markrlondon wrote: The front end GUI ...I need something fast
Exactly how fast are the humans that use that?
For a desktop app that has, for example, 100,000 simultaneous users to the same back end, I suspect you are going to run into other problems.
markrlondon wrote: HTTP-based REST is feasible but how fast is it in practice
Versus what? Everything is basically IP these days. And unless there is something really wrong with your network even establishing a connection takes too little time for a human to care.
So unless you have some actual real (and realistic) business metrics that are very large then use whatever you already know. Because doing that will mean less delivery time of the product and that is much more likely to be what the business cares about.
|
|
|
|
|
Thanks for the reply.
Just catching up here...
|
|
|
|
|
.NET and Mono are not the same beast; you'll find that there are subtle differences in implementation.
Fast inter-proces communication can be achieved by writing to shared memory.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hello everyone. I want to create web service for mobile game. Can anyone say about his experience and may recommend some principals, arhitecture., service.
Thank you
|
|
|
|
|
I am the senior engineer at my firm and I have been asked to outsource some of our projects. After much deliberation, we had two projects done this way.
Here is the question... my team and I reviewed the solutions and found a pattern that we could not understand... here is one example:
The ASP.NET application contained a few work steps where an email was to be sent. There were a total of 13 different instances. Each instance had code to read the app.config settings, set the mail properties and send the email. A new SMTP server required SSL and we had to update all 13 instances.
SO... why would the developers code this 13 times, instead of writing a simple static method/function???
We took the solution apart and found this "pattern" all over the place.. lots of cut/paste, hard coded values, etc... I am missing something? Is this something we have to get used to when dealing with outsourcing?
I know.. lots of questions.. but some insight would be appreciated... thanks.
LM
|
|
|
|
|
Lucas A. Martinez wrote: Is this something we have to get used to when dealing with outsourcing Yes!
Think about their business model, they make money from churning out solutions and the hours spent supporting the solutions. So the faster the solution and the more intensive the support the more money they make!
Where is the incentive to write elegant, supportable code? It always astonishes me when an organisation outsources their development and then expects quality.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Next time, give them a small job for a fixed bid that you can review at the end of the week.
If they "fail", they don't get paid or hired. Get it in writing.
(In the freelance "business", "fixed bids" typically don't get paid if you botch the job).
Another thing: the person you interview is not always the one that winds up doing the job ... You can be as skilled as you want interviewing, but in the end, they may very well just pass your project on to some code factory (because you can't see them).
And all the while you're thinking: "But they sounded like they knew what they were doing...".
And of course they did.
Anyway, outsourced or not, there should be some deliverable to review at the end of each week so you can catch issues like the one above.
I assume the project manager / lead was "theirs"?
No?
|
|
|
|
|
It probably would be best to review the code yourself and make no compromises.
Unfortunately, I am one of "them" and have seen stuff that would probably make any sane programmer want to shoot him(her)self, but I have also seen that the above method works. I would recommend trying that, if possible.
|
|
|
|
|
Hello:
I need to build a reporting tool that can read an xml file (which is the data output of a piece of hardware). The report would be populated with the read-only data (output from the hardware), but there also needs to be a comment field added to the report template that the user can data enter into and then the whole thing needs to be saved as a filled in report instance. I was thinking .pdf.
1) One way I see this application is.: I would create an xsl file for the template. The xsl file would be merged with the xml file to create the report.
The data is sensitive so I don't want the data in the cloud.
It will be available locally via a flash drive.
If I did it this way, I envision a local web server to be started on the client since a browser can not read a local xsl or xml file without security issues.
So, this design is kind of a local web application.
2) Another way is to create a desktop application, but then there are distribution issues and runtime issues, if it's a C# application. The other alternative for me is a Java Web Start application.
Either way, I do it, I think it would be easiest to have the data/template be displayed on the screen so the user can enter the comments into a field and then have another tool save to a .pdf.
Any ideas or has someone done something similar where they would be able to share what worked for them?
Dan
|
|
|
|
|
Just create a PDF with a comment field the user can edit. The user can then add a comment and write-protect the PDF / comment field if they want to.
(Later on you can start getting "fancy").
|
|
|
|
|
Background
In my workplace there is a debate on two backward Compatibility (BC) implementation approaches. I am not talking on the question if our code need to be BC, this is given and a consensus. The question is how to do it in the code level.
Lets assume that we have CodeA with inputA and resultsA and newer evolved code CodeB.
The Code, of course, knows to identify if the input is A or B.
Lets assume that ~20% of the code functionality was changed.
Lets assume that each version footprint is 1Mb.
The BC requirement is that CodeB with InputA will provide ResultsA.
Strategy 1 – if in the top + code duplication
One approach which is led by the more agile side says:
When I evolve my code from A to B, I don't want to think about BC. I will do it as if this was the very first (ever) code. Then in the last stage I will wrap both CodeA and CodeB by a switcher in the most higher level that will call the full old codeA when he sees InputA. I know it is code duplication but binary size is no concern these days and my newest code is always clean and not carry the old deprecated code. When code A will not be necessary anymore few years from now I will throw it away and will be left with B (or C, D ...). I know this is not elegant but time to market is more important and again even if I have 10 versions together it is only 10Mb.
Strategy 2 – if in the fine grained bottom level
Second approach which is led by the more classical "by the book" SW engineering says:
When I evolve my code from A to B I will put a BC handling (if or whatever) on the fine grain lower level changed functionality (functions, methods, lines …). After all it is just 20%. I know it is tiresome and my one code will be with ugly BC handling on many lines but I have at least one consistent and compact code and not huge code with A,B,C,D,E full versions inside.
What do you think? Who is right? Will be happy to hear why, cons and pros + ref to reading on this subject.
|
|
|
|