Symfony inteface based constructor dependency injection [closed] - symfony

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 .NET developer and have some questions about Symfony's IoC implementation.
Does Symfony is capable for .NET-style (i.e. Ninject, Castle Windsor, etc.) constructor injections. Namely, can I avoid the necessity of giving name to each service and bind service implementation to interface instead? Also can I do not define each controller as a service for make DI working? "Controller as a service" and manual configuration constructor's parameters in services.yml(xml) seems to me redundant after years of .NET development. Thanks.
P.S. Sorry for my english.

Namely, can I avoid the necessity of giving name to each service and bind service implementation to interface instead?
No, you can't. It one of the things I'm missing in the di component too.
Also can I do not define each controller as a service for make DI working?
The good point about symfony2 is that it removed most of the convention-based things. Doing the thing you suggested adds a mew convention to symfony. You could check the KnpRadBundle, to see how they implemented auto registering of other services, based on conventions and create your own bundle which does it for controllers.

Related

Java spring combined with a Go web server? [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 am looking at using Go for my web server:
https://golang.org/doc/articles/wiki/
I was actually going for:
https://spring.io/
since it comes with tons of modules for a web server, like security, data, etc.
Would it make sense to use Go as the Web Server for handling traffic/request and have Spring behind for the actual building of the back-end/MVC?
Or would you typically needs to make a decision between either Go or Spring?
Would it make sense to use Go as the Web Server for handling traffic/request and have Spring behind for the actual building of the back-end/MVC?
No, I don't think so. It's better to take nginx and have Tomcat server with Spring application behind it.
Or would you typically needs to make a decision between either Go or Spring?
Yes, choose what's better for your current task. You can use Spring for the entire web application, Go for some parts, etc.

Web Api vs MVC Controller [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 6 years ago.
Improve this question
We had a discussion at work where one of our employees was creating a Web Api controller specifically for one method that returns JSON data. While it works, I noted the fact that he didn't have to create a Web Api controller for this since the scope of that data is really only to be used in that application and not to be consumed elsewhere. I mentioned that he should have just put a JsonResult method in the already existing controller and that now we have two controllers to maintain instead of one. That's when the chairs went flying!!!
While I don't think my suggestion is wrong maybe it is. Am I wrong in my thought process.
It is an opinion based question, so take my answer with a grain of salt.
If this is all just for a single action method, my opinion is not worth to have a separate API Controller.
Why?
You need to register route for Web API.
You need to register Web API controller for Dependency Injection.
You need separate Exception Handler.
You need separate Filters for Web API.
1 and 2 are quite easy, but 4 is not if you have too many filters.

AngularJS and ASP.net MVC [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
I Have a question regarding those 2 techniques, if I'm going to use both techniques in my project doesn't they clash?
for example, they both use the MVC model. So if I use the angular routing isn't the ASP.net MVC routing unnecesarry than?
Is it a smart move to only use ASP.net to create the WEB API and the other backend processing, and angularJS to implement MVC and talk to the API
any suggestions?
You shouldn't have to worry about them clashing if done correctly. Your bigger concern should be the additional and redundant work it may cause. For the large majority of situations, having Angular interact directly with WEB API is favorable because it eliminates a layer and makes your UI completely portable between technology stacks.
There are merits to the hybird approach though that are concisely expalined here: https://softwareengineering.stackexchange.com/questions/209735/mixing-angular-and-asp-net-mvc-web-api
The two can complement each other. MVC routing only kicks in when you make a server request. So long as no HTTP request to the server is made, then MVC routing doesn't kick in. I use the server for returning "dynamic content" that depends on some server resident information. You can fetch modals from the server as Partials. Using the Server for mostly API work is however advisable.
There is a project called TwitterBootStrapMVC (https://www.twitterbootstrapmvc.com/) That enables you to render pure bootstrap markup on the server and deliver it to angular after some "post processing". It is handy and works well with Angular.

Should you use log4net for small to mid-sized projects? [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
I just got introduced to log4net and its abilities. For starters I'm currently working on a small project. We need to log errors,warnings etc to a file and also send an email to all developers involved about any Fatal errors. Is log4net an overkill for a small project thats got about 10 classes that require the logging functions? Are there any benefits of using log4net in the long run? We were initially going to just use FileIO manipulations and Mail functions to achieve the same.
The answer on this question is primarily opinion-based, some reasons to use a logging framework from the start:
Standard way of logging
Easy configuration
Small projects will grow, if you do it right from the start, there is no later rework needed
Using a logging framework will not cost you more time than writing your own. It will probably safe time. For example log4net will never crash your program when logging fails. Your own framework might interact with your business logic and gives you unexpected results.

Symfony2 Admingenerator vs. Sonata admin [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 9 years ago.
Improve this question
Just found out about this new project Symfony2 Admin Generator. It is for easy development of backends for symfony2 based applications.
I was wondering, how this tool is different from Sonata admin project? Is there any use case where this new admin generator would be preferred?
The two bundles are actively developed so those considerations can
change in the near future.
I've migrated my admin panels from symfony2admingenerator to SonataAdmin recently, partly due to some bug in symfony2admingenerator, and partly because I've found SonataAdmin clearer.
SA uses an OOP approach, while S2AG rely on a yml config to define the admin panels
S2AG need to generate a complete CRUD structure via command (controllers, views, and a yml config), while SA panels are only 1 DI Service Class
in S2AG the configuration options are more obscure, since they are based on a yml file and on autogenerated classes, and often an error doesn't yield a meaningful message/stacktrace
in S2AG is simplier to customize the rendering of a field.
in the S2AG web pages, some parameters (like the filter of a list) are stored in the Session, rather than in the query string. This lead to the difficulty to link directly to a filtered list (eg: The comments by an user)
SA seemed more stable, but the MongoDB part is less developed and has less features than the ORM part.

Resources