Moving from ASP.Net to Java for web development - c#

My job has required me to change technologies quite radically. I am fine with this, I am excited to be learning new stuff; but I feel like I am very much a newbie in Java, especially the web development side in which I have zero experience.
Just a little background, I would usually create websites using ASP MVC 3, Razor view engine, C# and on the backend everything will be nicely TDD'd and using EF for data access. With .NET in general I have been doing it for around 4 years.
Now I appreciate that for my purposes I wont find it difficult translating my skills from C# to Java syntactically, it's just everything around it, the frameworks, webservers and stuff which is going to confuse me in the short term. Even using a new IDE will be frustrating at first.
Can anyone offer any advice? I know we want to be using Spring MVC, presumably with Tomcat. Do I need to setup and install Tomcat for dev purposes? Or does eclipse/netbeans (which should I use?!) automagically do that for you, in a similar way that Visual Studio does by making a local IIS webserver to use.
For TDD, is there a good plugin for eclipse/netbeans anyone would recommend so i can just right click a class file and do "run tests"
Any general helpful links, getting started tutorials?
Cheers

I don't recommend to start with Spring MVC. You should start a far lower level to keep it simple at the start.
I recommend to install an Eclipse IDE version for Java EE Developers. This version contains all the stuff you need except of an application server.
So you have to install a Tomcat yourself.
In Eclipse you can now start with a "new Project" and choose Dynamic Web Project that does all you need for a clean new Web Application.
Out of Eclipse you can then rightclick the project and click Run on Server, which opens a qizard where you configure the things for your Tomcat installation.
This is what the setup is about. And you should use Eclipse, because Eclipse is a standard editor in a professional environment.
What you now should learn or where you should start is first of all learning java if you not already did. And then go on with: Servlet API and Java Server Pages (JSP) API.
You should get you some books on that to get your head around it.
After that it will be much easier to understand what Spring MVC is, what it does and how it works.
Starting with Spring MVC in this case would be like building a house starting with the roof. I think this would fail.
Edit: Just to complete this, I found this link here, which seems to me like a good first starting point.
Edit: Another last thing: the standard library for TDD in Java is called JUnit and there is a nice plugin for Eclipse to use it.

The big problem is that you are going to stay stuck in the very addictive products of Microsoft, and it's "magical" tools and editors and plugins, even keyboard shortcuts.
So, i think it's very hard to move.

Some suggestions:
Test Driven Development - JUnit, HTTPUnit
IDE - Eclipse (free), IntelliJ (commercial) - both offer all the advanced IDE features you would expect, including embedded Servers
Web framework - Important: a criteria you should use in choosing a framework is whether you can make changes without having to redeploy or restart the server to make a change. (Two examples that support this are Grails (script based) and Tapestry5 (uses live class reloading - I'm sure there are plenty more that do these days....but check this first or you'll waste loads of time waiting to deploy changes)
Server - Tomcat7 and Jetty are both good
Jetty is small, fast and flexible, it can make a good choice for development even if you ultimately use another server in production. You can either embed it in Eclipse (RunJettyRun) or write your own hooks to start it, as simple as:
private static void run(int port, String resourceBase, String descriptor) {
Server server = new Server(port);
WebAppContext context = new WebAppContext();
context.setResourceBase(resourceBase);
context.setDescriptor(descriptor);
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}

Try Oracle ADF(Application Development Framework), It is very similar to Microsoft Visual Studio.

Related

Adding existing Node Js project to Existing .Net Solution

Updated.
Updated the question since it looks little ambiguous and not the answer i was looking for.
We have a huge .NET application running on MVC and angular. It has multiple projects under the main solution. .
We also have a replica of that application in Node.js for front end developers.
It looks something like this :
What happens is - Front end developers make changes in Node js solution (like js or .less files or controller) - make changes and move those changes to .Net solution which is the actual live project.
Off late - we have issues with developers working with two different solutions (Node and .NET) and keeping two copies of assets everywhere.
We ultimately decided to combine them and bring the whole Node.js application into ours .NET Solution as 6th project.
Something like this
Wondering if anyone has previously done so - adding a .NET application with existing Node.js application. If so any pros and cons to consider.
Some points to note - the Nodejs project and .Net project are completely independant of each other. The idea is to consolidate the applications so that We can either run the .net application or UI application from single solution.
Eventually, we will consolidate all the assets to just one project so that - we dont have to do duplicates.
Also, would appreciate any links where I can see how to start merging these two applications.
You definitely want to look at JavaScript Servcies. Building Single Page Applications on ASP.NET Core with JavaScriptServices.
Made for .NET Core, but you can run .NET Core on Full .NET Framework, which should make it easier to migrate to.
What I think you have is, say, a production version in .NET and a development environment in node.js for developers which prefer that.
At the company I work for, we use AngularJS for our front end and .NET/Entity Framework back end and it works pretty well.
I'm not sure if you are integrating some sort of JavaScript back end in with it or not. Assuming you are going to stick with a .NET backend and a JavaScript heavy frontend, it should be fairly easy.
That being said, nothing in this career is truly "easy". I would recommend using an AngularJS frontend as it has seemingly endless functionality.
Some minor suggestions if you choose that route is to check out John Papa's style guide. great reference for writing AngularJS. Make sure you have consistent naming, especially in Visual Studio as AngularJS can be a little moody.
I prefer to bind values to the view when working on AngularJS, e.g.
vm.title = "Data I want to bind"; in the view: <h1>{{vm.title}}</h1>
If that renders as {{vm.title}} instead of Data I want to bind you know something isn't working. I prefer catching it sooner rather than later.
Dependency Injection is another thing to be careful with, the style guide covers it as well. Basically if you minify your AngularJS files and the minifier removes the information required for DI, your project will break. I've been down that rabbit hole a few times.
If you aren't intending on using AngularJS then forget I said anything. I was just exercising my fingers. I hope that helps shed a little light on your decision.

Build scripts for C# project - written in C#?

We've got a quite complex deployment scenario and want to make use of continuous deployment. Currently we've got a huge MSBuild script for everything, however, MSBuild is ok for building but not really suitable for deploying.
We'd love it if there would be some kind of C# project where we could write the deploy code directly with C#. Is there some C# scripting language which is suitable especially for deploying applications?
While it's not a C# project, you can use my company's product BuildMaster to handle deployments. It's designed to solve some of the problems you're already having, and some you probably don't realize you have (configuration file deployments, database schema updates, process automation, approvals, etc.)
However, if all you want is to write C# scripts for deployment, there's a tool called con-dep which looks like what you're describing.
Well, with Roslyn now I suppose that you can technically now use C# as a scripting language. I don't know if it would be terrible appropriate to do so...
Depending on your deployment solutions you might want to look into the NAntBuilder IDE. We used this for continuous ddeployment together with SVN server. If you have TFS why don't you just look into the details and many possibilities of Build Process templates?
You can use the .NET integrated C# compiler.
The advantage is that you can use the same DLLs/APIs in a C# 'script' as you do in your own software.
I use it in our production software. Our production engineers are able to write some small programs for special stuff.
See this answer for details.
You may want to look into using a tool that's specifically designed for handling deployments. If you're using Team Foundation Server, Team Build + InRelease provides a well-supported, well-documented way to handle your builds and deployments. Now that Microsoft owns InRelease, it'll be part of Team Foundation Server pretty soon.
If not, you can always write PowerShell scripts to handle your deployments. PowerShell isn't C#, but it's built on top of the .NET framework (so all the framework methods you're familiar with are still available), and the learning curve isn't very steep.

How to convert an ASPX.net application to WebPart in Sharepoint2007?

I'm starting with Sharepoint.
I have a simple C# application using a database.
I want to show it in Sharepoint2007, and my boss told me that I have to do it with a WebPart, but I've been looking for information and I haven't found it.
Sharepoint 2007 web parts are difficult to build because you need to programmatically build up the presentation layer in your code.
You should definitely use Smart Part as this allows you to develop Web parts like they are user controls in a conventional .Net application.
You should also read up on Sharepoint patterns and practices as it is fairly different in certain aspects.
You could possibly use (see link below) to show data from the DB.
http://blogs.technet.com/b/paulpaa/archive/2010/01/26/data-view-web-part-to-view-data-from-non-sharepoint-database-adventure-works.aspx
However if you want more adaptability and the feeling that you know what your doing(I guess your a developer with some knowledge of c#)
You would possibly be best off going down the coding route. I always say work smart not hard!
Get some tools to make your job easier. WSP.builder for one(Codeplex) and start with something very simple. People say theres not much use in the hello world but it's a great place to start when learning how to deploy, Debug your first sharepoint web part.
What i would advise is.
Read up on how to use WSP builder. This will help you build your Sharepoint projects with the required structure.
You will want to use visual web part feature within wsp builder for this.
Once you know how to deploy this, Should come with reading around wsp builder! you should be well on your way to getting your web part done.
If you ever find it hard keep at it SharePoint can be a tempramental beast! Theres a wealth of knowledge on google exploit it!(Work smart not hard;))
Also if you have your own development area back it up! If it breaks you don't want to have to rebuild it i learnt the hard way!
Hope this helps

Creating a web service for a system built on nHibernate & stored procedures

I have been asked to build a rather simple form processor application that interacts with an already-existing system that is built on nhibernate & uses stored procedures to manage all the business logic in the system.
My goal is to build a (hopefully) simple web service (json if possible) that I will be able to access from both a web site, and ultimately an iphone & android app down the road.
I've built a couple fairly substantial RESTful api's using other technology (PHP, python, Redis, Mysql, etc) however aside from my basic understand of the overall syntax of C#, i'm pretty green to the whole ASP world. And frankly, the thought of doing anything drag and drop makes me want to stab rusty forks into my eyes ;)
My questions to those with C#/ASP/nHibernate experience:
I have visual C# express 2010 - do I need to purchase visual
studio to build this app?
Is it even possible to build a simple
JSON api/web service that can handle simple transactions (ie: return
a list of dates, and insert a single new entry) with C#? What tools do I need to get started down that path?
Does anyone have
any resources or recommendations for a crash course or high level
tutorial in C# web service construction?
I've done a fair bit of reading on nHibernate now, and feel i have a loose understanding of how the thing works, i'm just foggy on how to link a few simple classes/stored procedures with the actual web service.
My goal is to completely avoid re-inventing any wheels, and keep this thing as lean as possible... essentially, the web service is only there to pass data back and forth to the database.
Any help would be GREATLY appreciated - I know I can build this thing, I just can't seem to figure out where to start - if I could just sit down and code the thing, I would be fine... but it seems that with microsoft, you can't just sit down and code anything :S
EDIT: I'm working on Windows 7 Professional, I have downloaded nhibernate 3.2.0 and installed visual C# express 2010, I also have a windows 2008 server box with ASP.net 3.0 at my disposal for testing purposes.
EDIT 2: Which express package should I be downloading here? I have C# express, which seems to be the wrong one to start with - http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express
EDIT 3: Thanks for the answers so far... currently downloading visual web developer and will dig into WCF and MVC a bit further.
No need to purchase VS. The license for VS Express allows for commercial applications to be built with it.
Yes, you can build a simple JSON api/web service - use ASP.NET-MVC, not webforms. I have done this a few times.
http://asp.net/mvc and for a working example of an MVC web site http://nerddinner.com
For web work, VS Web Developer Express is what you should be using.

Coding Standard Wiki

At my place of work I've been put in charge of creating a coding standards document. Generally we follow what FxCop and StyleCop tools report to some degree but what we really require is document that will explain when to use a convention, why and maybe even a simple example.
This could be extended in the future for other purposes as well.
The first thing that came to my mind is to have an internal wiki site that we could build up and change easily over time but I've never used a wiki-based engine before and would like some recommendations.
If possible the engine should be in C# so we're able to tweak it to our needs if required.
If you think a wiki solution is the wrong way to go about this then please give an alternative :)
Update
I've just been informed, although we do have a php server it wont be staying, so I'm afraid php-based wiki ideas are off the table.
Update 2
Could you also (if possible) let me know if any of these solutions work with Active Directory?
Cheers
Tony
ScrewTurn Wiki is an free and open-source wiki made in C# and ASP.Net. Different database back-ends can be used, like MSSQL and MySQL, but also works without any database. It has several plugins to work with Active Directory.
Mindtouch Deki
Great wiki and it's built on C# and PHP, so you can use it on Mono or .NET
It also has Active Directory integration.
Download their ready-to-use VMware image. It started using it on my own PC then moved it to the company's VMware server when they had it ready.
We keep an internal wiki at my shop that has almost all of our documentation (not just coding standards). We didn't really see the need to roll our own so we just used MediaWiki...
We use JAMWiki and love it.
It is a solid application, we have had nothing but good interaction with both the application and the developers.
The guy you maintains the code does a great job answering questions and helping users out.
Brad Abrams has published an online set of C# coding standrds:
http://blogs.msdn.com/brada/articles/361363.aspx
If you go to the starter kits section of the Microsoft ASP.NET site, you will find several wikis to download such as ScrewTurn and Flexwiki. A wiki would be ideal for your needs by the sound of it :-)
I second MediaWiki. It's not C#, but it can be a nice excuse to sneak some free software in through the backdoor.
If you guys are a Microsoft shop, though, and are using Sharepoint, it has some built-in wiki-esque functionality.
In one project that I develop, I set up one MediaWiki wiki for development documentation, and one for online help.
I even generate part of the development documentation right from source code and database.
At the shop I'm at they use a commercial package which is really good: Confluence. What's especially nice is that it integrates with LDAP/AD so that you don't need a seperate login and it's build especially with business use in mind and has lots of free plugins. We couldn't live without it.
I am confused by what you mean when you say you don't have a php server. It runs on every platform known to man. I am noticing most Visual Studio Developers don't know that PHP runs on IIS.
I would go with mediawiki It has the biggest feature set and most add-ons developed for it in case you ever need to port your data elsewhere. If you need to modify your wiki you are doing it wrong.

Categories

Resources