Questions every good Struts Developer should be able to answer? [closed] - struts

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
In the line of Questions every good Java/Java EE Developer should be able to answer?
I would like to ask what are the Questions every good Struts Developer should be able to answer?
Looking forward for some good responses.

1. What is the basic flow of a Struts handled request?
You can find a short description here and plenty of resources on the web.
(If you pretend to know Struts then there is no excuse for not knowing number 1)
Next question is "What is a Servlet?" (and I'm not kidding; if they fail number 1 they are going to fail to this also, trust me).
2. Is ActionForm part of the Model in MVC?
People think the ActionForm is part of the Model. They read the MVC description and think... Hey!... this is the Model's state, lets move this as parameters all over the Model. Now you have a tight coupling between the Model and the Struts framework.
There are plenty of examples in which the ActionForm properties are mapped 1:1 on DTO POJO objects and those used instead, but people think its a waste of code and time and just pass it along to the Model.
(Number 2 can can be excused for a junior and is later cured by experience)
3. Do you put your business logic inside the Action class? Why? Why not?
An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request... 'nuff said
(Number 3 is also cured by experience)

Difference between filters and Interceptors ?
Action Chaining
classes used as part of struts framework.
Validation Plugin
struts Configuration.

Related

How to consume External Services in DDD [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a project in DDD and I would like to know in which layer I have to code a Service to consume an external service. In this case the external service is about information (especifically payment slips) to show in the Front-End.
The question is a bit vage, but my guess is that you have a bounded context and you even have an UI for this bounded context. Now you would like to show some data from another (external)BC in the UI of your BC.
Before creating an application service for that, ask yourself: what should the user do with this information? Does it help to solve some business problem of your BC? Does the user take different actions inside your BC depending on the payment slip data that he or she sees? If so, then you probably need to model those busines rules explicitly inside the domain model of your BC, create some sort of relationship to the other BC and agree on a contract to get the data to satisfy your invariants.
If you just need a shortcut/convienience for the user in the UI then try to push this feature to the UI level, maybe a simple link to the other context is enough...
Reaching out to external BCs should not be done careless, since every external dependency makes your BC less independent and valuable on its own. First try to clarify the communication to the other context using one of the strategic design patterns like anti-corruption-layer, customer-supplier, conformist etc. After this analysis it should be easier to determine in which layer an how you would put the logic for this external call.

Documentation on how to use REST WebAPI like a boss [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I've exposed a few methods and, while crystal clear on how they're supposed to be used, I'm sure that with time, the memory will fade and I'll be standing there like an idiot wonder why on Earth I haven't provided any help.
When we use WCF, there's the WSDL file. But I'm not aware of any corresponding functionality for WebAPI. Usually I add a Ping so that I can type in the URL window of my browser .../Service.svc/Ping, just to see that I a date back.
What would be an intuitive and (hopefully fairly) canonical approach? I'm thinking .../Help. Is there a better way?
Just pushing out help will only produce a huge string (XML or JSON formatted), which isn't very like-a-boss'y. Anonymous types can't be well handled without serialization. pushing out object typed entity breaks the connection.
I wish to have a built-in documentation on how to use the calls. The names themselves, of course, but also what values are treated (I had a case where the .../Donkey?scope={scope} pattern could be null or all and we though it was any, which took a while to figure out.)
You might checkout Swashbuckle which would allow you to generate Swagger documentation for your ASP.NET Web API controllers.
Anonymous types can't be well handled without serialization. pushing
out object typed entity breaks the connection
Are you really exposing anything like the above mentioned in your Web API contracts. I hope you don't.

Is it okay to implement multiple design patterns? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm currently developing a school project and we are instructed that we are required to implement Object-Oriented Programming concepts in our software. But I don't want to implement it just by simply inheriting this class to that class and overriding this method to implement its own functionality and so on. Though it is still acceptable but I want to do it differently. By differently, I mean by using design patterns. I'm trying to understand it one by one and I noticed that some of them are very useful(Builder, Memento and Adapter). But the problem is there are so many of them and if possible I want to put/implement it all(those 3 design pattern). Is it okay if I do that? Would it mess up the project as a whole?
As always: It depends.
Overusage of patterns on small and simple bits of code can obscure the code. But it can also make it more clear.
Don't use patterns wherever possible. Use them when it serves a purpose. Every pattern has its purpose and if you can't find that purpose in your code, you shouldn't rewrite it to match a pattern. Try to keep your code a) maintainable and b) easy to read. If a pattern fulfills these criteria more than your approach without patterns: go for it.
You can have code with dozens of patterns and code with none. In both cases it can be the ideal choice.

Javascript Frameworks with Rails [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Hoping someone can help clear things up for me.
I've been reading a ton about the new javascript app frameworks out there, backbone.js, batman.js, ember.js etc...
And I see a lot of instances of them using the frameworks on top of Rails.
Can someone explain to me. Doesn't this require a ton of duplication in order to use them? ie. do I need to completely duplicate each model and controller? And if so, do I need to make changes to both each time?
I see a great benefit for rendering templates on the browser, but I feel like I'm missing something important when it comes to using these on top of an already well organized MVC structure.
What is the benefit and is there really as much duplication as it seems?
I've read the question here
But it doesn't seem to address the duplication.
Thanks in advance.
The benefits are described in the question you linked to. They provide structure which is hard to achieve when you're client side does more than simply displaying data and reloading parts of the view with AJAX.
Andrew Dupont gave a presentation at MIX 11 about writing maintainable JavaScript. He describes his journey from a stinking pile of JS to a more maintainable code base. It is worth watching.
The duplication depends on how much you do on the server side. If your server is only serving data, e.g. Rails controllers providing a JSON API to access the models, you have to duplicate the models on the client side.
I am using Rails only for JSON access to persist the entities of my application, except some JSON views. The whole user interaction and CRUD happens on the client with Backbone & jQuery.
So far, I had only to duplicate the models in Javascript and create some controllers for accessing and saving the models on the server.

"Reverse Engineering" App Architecture [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I inherited an old app, written in C#/.NET 2.0. (un)Luckily there was no documentation - not even comments. So as I'm adding enhancements to the application based on new requirements I'm also building a mental model of what the app does and how it does it - architecture in other words.
I was wondering what tools exist out there to "deconstruct" the app and go from raw code to something higher level? The app's not really heavy in OO - in fact one of the objects used is called a "function". It's mostly just a bunch of methods - a lot methods that seem to jump out of nowhere.
I want to translate the raw code to some sort of requirements doc stating what the app does and how it executes. What's the best way to do it? Are there any apps out there that can help me? Maybe templates of what I should/should not include? Maybe books/sites that you recommend? The goal is to provide documentation for me and for future developers maintaining the app.
Personally, I would start with Robert C Martin's Agile book, and Eric Evan's book on Domain Driven Design. Those are theory books, but Uncle Bob's book specifically talks about revamping code to be manageable, just like your situation.
It's pretty essential to layer your software so you can start to remove dependencies, which will make everything very simple and easy to maintain.
I am a database guy, so I started with a good ORM like Entity Framework or Fluent NHibernate. I prefer websites, so I went with ASP.NET's MVC 2, then started writing all the parts of those books, namely a data Repository, Services to pull data and Control to push it. MVC is a very nice separation of data concerns and "View" concerns which are your screens. Before long, you would have very clean and easily maintained software.
If you are using VS 2010, you can see a menu with the name: Architecture. Using this tool, you can create a dependency graph of your application, you can use it as described in the following:
Link