Sites and Languages they are built in

Spring Framework vs Rest of the World

In summer of 2002, I worked as a research assistant for Networks lab at GMU. I did some Java and MySQL database work for them.

One day my lab manager suggested that I learn some PHP as well. She needed some dynamic web pages built for the lab and handed me a PHP book.

The whole gig lasted less than three months. Once the summer was over, the lab decided to not continue my assistantship. I had studied maybe first five chapters of PHP book by then.

I missed a chance to write anything in PHP for the lab.

But those chapters were enough to pique my interest in PHP. I started sharing how cool PHP was with anyone I met. My roommate knew I was learning PHP and asked the inevitable:

Why does anyone need Java when PHP can do just about everything?

I couldn’t explain it well to him. I did not know the answer to be honest. That was an excellent question. He was a Java developer. I was a Java developer. I was a new PHP developer.

In the post, I will address why we pick a language or a framework at all. I will go over what makes Spring Framework one of the best web development frameworks.

I will compare it with others not just in the Java web market but the entire web framework community.

I will go over Struts Vs Spring. Guice Vs Spring. Play Framework vs Spring, JSF vs Spring. I will skim over other Java frameworks for a quick comparison.

I will also go over similar mvc frameworks in other languages. I will list popular PHP frameworks, JS frameworks, Python frameworks and Ruby frameworks.

I will go over what you can do with Spring Framework that you can’t do with other web frameworks.

Languages and its web Frameworks
Languages and its web Frameworks

Most of my career has involved working on web application framework. So I will speak with web frameworks in mind going forward.

Let’s begin with the fundamental question:

What are we coding?

If you think about it, We programmers make a living doing few common things over and over. The four of them are easy to point out:

  1. We write if-else, switch, while, AND, OR and equalsIgnoreCase more than we know.  Our business logic depends on them.
  2. We also do some reading from / writing to a persistent store in most of our projects. We write to the files. We write to cache, in-memory or session. We write to the database. We write to a stream (byte or character). We write to the indexer (Solr, graph, nodes). And then we read from it all.
  3. We leverage maps and lists for the rest of the code. We store things as key value pair. We iterate over a map or list in most of our projects. We iterate over objects which come from various sources in these lists or map. We iterate over items from the persistent stores I mentioned above.
  4. We figure out a way to send the data that we played with in three steps above all the way up to the browser. This exchange of data is web development. Web Frameworks make this possible.

I don’t mean we have an easy job. But doesn’t it all boil down to the four items above. Am I missing any more?

Moving on.

My neighbor back then was starting a small consulting firm. He asked that I come up with a website for his company and offered to pay $10 per hour for the job. I think he offered to go up to $200 for the total budget. That was a lot of money for me.

So I picked up Kevin Yank’s ‘Build Your Own Database Driven Website Using PHP & MySQL’ book and read it twice.

But this took several weeks or maybe months. I can’t remember now. Summer was over and the school had started. I was a full-time graduate student. I was learning PHP on the side.

I was out of work and needed to look for a job soon.

I failed to get any technical job on-campus. I was so sure my assistantship would extend that I did not apply anywhere else. Most jobs were gone by then. And I couldn’t work off campus.

So I flipped burgers.

I would be standing for 8-10 hours straight and come home exhausted. This slowed down any enthusiasm I had for any language. It took away my enthusiasm for just about anything.

If I remember it right, my neighbor moved and I never took him up on the website offer. I lost another opportunity to see a PHP application go to production. I lost $200.

PHP is a great language.

It lets me write if else in scripts.

It lets me write to MySQL.

It lets me iterate over arrays.

It is a web-ready script.

Last but not least, It is cheap to host.

Compare that with C or C++ or Java back in those days. I can write if else without any problem in these languages. I can iterate over list or map or array without any issues. How easy was it to write to the database? Was it web-ready? Even Java which is the language of the web isn’t available for browser right away. You needed an applet to serve it.

Are these cheap to host? GoDaddy cost me $4 per month for PHP. It came with two free MySQL database instances as part of the hosting.

GoDaddy did not offer Java. The cheapest option to host Java was $20 per month back then from a different vendor. MySQL hosting was extra. Amazon and pay per hour hadn’t made it yet.

The truth is there is a place for each language in the software development. But it depends on who is asking the question.

Do I need Java then?

I searched “Java vs PHP” and saw Java blogs claiming that PHP was slow. I wanted to tell my roommate that PHP didn’t perform well. I didn’t.

Let’s assume for a second that Java can outshine PHP in web performance. I have never benchmarked this and don’t care which one is faster to be honest. I do know there are more PHP sites than Java sites for sure. I know so because WordPress builds on PHP. Point made.

Forget technologies for a second. A business could ask the most basic question of all.

Why do I need ANY coding at all?

How important is it to me as a business to know if my site is using PHP or Java underneath? If I were non-technical and needed a website, I would find the cheapest option to get me there. PHP seems far more lucrative than Java in that case.

I am mentioning PHP and Java here but this applies to any programming language out there that caters to the web.

Assume for a second that I am not a coder. Assume that I am a business man.

Back in those days, I would pay for the look and feel and then ask the designer if he could turn it into a website. Most I would need is a contact form that would submit and send me inquiries. That used to be 90 percent of the web business right there in 2002.

If the web designer did not do any web scripting himself, he would refer you to a friend who coded part-time. In 2002, there was good chance that coder was PHP programmer. Today there is a good chance that our coder is a javascript programmer.

In 2016, things are different. 

You pay nothing to set up a web page with Weebly or Strikingly or Wix or Squarespace.

The cost is zero.  You just need to pick colors for your site these days. Most of them will have a widget that can take user input and send that information your way.

Do you want a blog? you can create a free one on Ghost or Tumblr or Jekyll or LinkedIn or Medium.

You need a blog and a website together? WordPress will do the trick. If I started a business today, I would host it on Bluehost or GoDaddy with WordPress underneath.

In fact, This site runs on Bluehost with WordPress underneath.

Domains are cheap today. Once your site is ready, you can point your domain to sites I mentioned above and you have an online business.

We are reaching maturity in web applications now. Freelancing is not the same anymore. There are out of the box solutions for most things you would hire a developer for back in 2002.

Need to sell shirts? Go to Shopify.

Need to sell e-books or any software? Go to amazon or sell it on your site using stripe or gumroad or e-junkie or e-bay.

Need to roll out your own design? You have cheap options in Fiverr or 99designs or Upwork.

With dedicated graphic design firms, you get premium quality. With dribbble, You get quality work and a ton of options.

So why does a business need a developer these days?

I will address it soon but note something else firstI mentioned a whole bunch of sites and platforms without specifying the technology underneath.

The truth is that I don’t care about the technology as a business. The sites I mentioned above are affordable services and offer great quality.

If any of these tools ran into performance issues, you have further options. Most plans will allow you to either buy more memory or upgrade to a better platform without you hiring a coder.

This pushes you further into handling more traffic and resources on your site. Memory is cheap and faster these days. Servers are resilient and faster. Disk IO is ten times better than what it used to be in 2002.

Let me share a story to prove my point. In one of my jobs, I saw an in-house XML framework that was custom built to serve web pages. The goal of the framework was to provide quick development cycle. I said quick to develop. I did not say quick to render. And the framework hadn’t undergone any performance testing.

The project’s roll out early on proved that XML transformation and navigation ate up a lot of memory. And the engine would instantiate thousands of classes leading to PermGen error often.

But the development was faster indeed.

Guess what. When I joined the project, the app had been in production for years already. There were “plans” to upgrade it at some point in near future. The application was running on twice the JVM specs than other apps there. So What? The cost of twice the JVM specs for the project: Hardly any. Maybe few hundred dollars?

Now, what if we decided to re-write this application in a different framework? The cost to rewrite would involve at least two developers working full-time for several weeks.

This would mean missing the deadline. There is also a risk of business rules lost in translation if the developers are new.

All this would cost at least 10 times the amount that went into just boosting the hardware and server spec.

Do we still need a developer? 

Let’s pretend for a second that PHP is slow. Most small businesses don’t survive 5 years. As a business owner starting out, I am looking for cheapest and fastest way to get up and running.

With $4 per month that got my business to thriving state, I don’t mind trying out other options now. Only after my business has withstood the time and market test.

My own web hosting platform can add Memcached in front of my website for few more bucks per month. My site is caching static pages now.

If traffic spiked up again, I can add another server and load balance it. It is amazing how far this will take you in your business.

The amazing word reminds me of Amazon and its capabilities. I can buy more servers on demand and at a fraction of 2002 costs these days.

If you thought PHP was slow, I have a website reference that we all use that builds on PHP. You may have heard of it. It is Facebook.

I know Facebook modified PHP much later in the process.

You may have heard of another lesser known site called Wikipedia that still uses PHP that we all know.

If you thought Python was slow, You may have heard of a tiny video sharing website called Youtube. How about Quora that gets 80 million monthly Uniques. Quora builds on python’s pylons framework.

Popular sites and languages that power them
Popular sites and languages that power them

If you thought Ruby on Rails was slow,  go to GitHub, GoodReads, Basecamp. Dribbble, Fiverr, Shopify and scores of successful sites fall under this category.

If you thought Java was slow, May I introduce eBay, LinkedIn, and Amazon to you.

Stack Overflow builds on ASP.NET

And sites like GoDaddy and Netflix leverage Node for specific modules. Read this. There are no bad languages. PHP vs Java performance was just an excuse to bust the myth.

Read this. There are no bad languages. PHP vs Java performance was just an excuse to bust the myth.

Web Frameworks

I hope I was able to convince you that successful projects don’t skew to any one language. You can build successful applications with any language of choice.

You may be asking. If languages aren’t bad and they all do the same things, then what makes for a good language? Or a good framework?

Does it matter if we pick Java or Python or PHP or .NET? Does it matter if we pick Spring Framework for web framework over Grails or Ruby on Rails? After all, we can always boost the hardware and buy ourselves more time with whatever we have.

Technology is only getting cheaper by the day. Developers are getting more expensive as time goes on. What gives?

Who is a developer working for today?

In 2016, I can see a developer working on the following things:

  1. You are helping direct consumer perform things they can’t do. You couldn’t be coding in PHP or javascript for a direct consumer these days. Are you? I mean you may be helping them with the tools and websites I mentioned above. They need help setting up blogs on WordPress. You may be modifying WordPress a little bit but you aren’t coding something from scratch. Am I right? This category of developers is shrinking in my opinion.
  2. You could be writing code for service providers. You are not paid by the direct consumer. Your client is these service providers. It is possible they make you write something from scratch. This is your true bread and butter. This is where you moved to since 2002. You are coding WordPress plugins, chrome extensions, Mozilla plugins, integration tools, mobile apps  etc.  You are writing web applications in java or ruby or groovy or Scala for federal agencies. You are integrating with CMS written in PHP for some. You are writing Angular JS or jQuery for some. You don’t code for bakery business anymore. You work for hosting company that hosts bakery business website. You get the point.
  3. You could be writing a brand new product for direct consumers. This is the startup world. You are writing from scratch in most cases. You are coding in Python and Django at a startup accelerator. A success in this world would become tools and websites for direct consumers one day. You will be the Shopify, stripe, WordPress or even amazon some day. But this is by no means the majority of you.

I will assume your role to be item #2 above going forward. As a developer, you are dealing with companies that are in turn serving customers on the web.

Can I say you are an integrator more than a creator here? Let me explain.

Your primary job is to take these different services that exist and put them together as fast as you can. You are never writing anything in a silo anymore.

Unless you are one of the lucky ones, your project is an extension of something. You could be upgrading an existing service or extending it to work with others. But you are working on something that exists already.

There may even be a web service involved in your lifecycle. You are either pulling data from somewhere or pushing it for others to consume. And I don’t mean pushing or pulling from database alone. There is a third party or a vendor involved here. The bigger the organization, the less control you have over data. So you may be sharing data as well in some capacity.

I am almost certain that a web component exists for the service you are integrating. More and more applications are coming up for the web and mobile. That is where your customer is. That’s where everybody is. That is where you are.

It wouldn’t surprise me that you don’t control this web component. This could mean two things. You either have to work with existing web flow or UI or screens. Or you have limitations based on browsers, web behavior, device support, clients etc.

As a developer now, you have a tough job. Let me identify the criteria your clients are looking for from you in a successful project:

Criteria 1: You need to build something fast.

Criteria 2: You have to learn an existing system and improve upon it.

Criteria 3: You have to integrate with an outside service provider to pull or push data.

Criteria 4: You are able to work with limited control over presentation.

Criteria 5: And you want your system to be mature and perform well.

Notice the criteria above does not care about the technology. That’s the point.

So, What are your options?

I hope it is clear that you need some sort of web framework or an existing library. You will fail the six points criteria in no time otherwise. For instance, a web framework will help you build something fast. Without it, you may be reinventing the wheel.

But there is more to what web framework can provide you with than just faster development. Let’s look at our criteria one by one by discussing different web frameworks and what they have to offer.

I will discuss Java based frameworks here but will extend the concept to other languages soon.

Please note that what I am going to say below are just my opinions and not complete assessments in any way.

Web Frameworks Criteria
Web Frameworks Criteria

DropWizard may help you build RESTful web services fast. But let’s say you decide to switch from Jersey to Restlet to Spring REST to RestEasy? Ditto for Spark Java. Integration with third party vendors may come up here as a hurdle. I am also not sure how mature these are.

Struts led the java web market at one point. But they went from version Struts 1 to WebWork to Struts2 and lost some of their fans (me). I am not confident how hard it would be to upgrade an existing system between Struts versions.

GWT makes Java web development easier. It assumes you have no javascript developers. You write your code in Java and GWT will take care of converting it into Javascript. I love Javascript and couldn’t move away from it. If we ran into javascript issues, it was hard to troubleshoot GWT.

Vaadin reminds me of GWT. I think it uses GWT underneath. Vaadin is stateful by nature. It breaks one of the tenets of good design. Check out twelve tenets of good app design.

JSF, Wicket, and Tapestry are component based frameworks. Which means they interact with the web using components. The other category is the URL based frameworks which use URLs (surprise!) for the same purpose.

Tapestry moved from one version to another with major implementation differences. It was hard to migrate code between tapestry versions. I speak from experience with a project that asked for Tapestry migration. This was 2008 and painful. I know another project that uses an old Tapestry version (even today) and they are moving away from it. Tapestry used to have steep learning curve. I haven’t touched it in several years.

JSF implementations are also not fast development. Two of my projects used JSF. It was hard to integrate as portlet for one of the projects. And we ran into performance issues.  It is hard to integrate any component based framework with web-based security.

Wicket attaches your java components to HTML via wicket tags. I have never used Wicket. I looked at the documentation and saw you could use wicket tags to build HTML and include CSS and javascript. I see your HTML and Java live together here. I also saw that you need to weave javascript via Java. There is some learning curve and I am not sure its fast development.

Stripes have tags that wrap around HTML. I can see its usage in small applications. It is a lightweight and simple framework. I would use it as a front layer of my application. I would still rely on something else to expose data or integrate with others.

Grails builds on Groovy and allows you to build your code fast. It is the groovy version of ruby on rails. I see that latest Grails builds on Spring 4 and Spring Boot. As a Java Developer, you will have to learn Groovy. You may need to understand GSP – groovy server pages vs JSP concept. You may need to understand  GORM – Groovy ORM vs Java ORM. This is not a steep learning curve but takes time regardless.

Play builds on Scala and looks promising. You can use either Java or Scala to build with it. I am new to Scala as well as Play. I know that Play Framework versions aren’t backward compatible.

Google Guice is an alternative to Spring Dependency Injection and not the web framework. It looks promising and provides plugins/modules for The Web just like Spring and others. It has a good offering but a smaller community. I have never worked with Guice.

And I could go on for some more but obscure names. I will wrap it up with last but not least – Spring Framework.

Spring Framework

With Spring, I can build something fast. Let me give you an example.

I am learning Cassandra for one of my projects. I spent couple hours learning how to setup Cassandra and understanding CQL.

I am already familiar with Spring Data for MongoDB and Oracle. Bringing Spring Data for Cassandra was as simple as pulling ‘Cassandra’ dependency Jar.

The Spring Initializer generated jar came with a unit test. I added Cassandra properties and an example I copied from the web. Voila! I am in business. Maybe I will do a video showing this next.

With Spring, I can work with an existing system and improve it.

Most of my projects involved taking an existing system and enhancing it with Spring. Spring Framework allowed me to not disrupt any existing behavior but build in parallel. I migrated to Spring in increments.

With Spring, I can integrate my application to expose to or pull from third party services. 

I can give you a number of examples here.

I used to work with Axis2 and brought Spring to expose my service as SOAP.

I had an existing Spring MVC application and leveraged same service to expose as a REST resource.

Spring allows me to switch between JAX-RS Implementations.

Spring allows me to switch between databases with minimal code changes.

With Spring, I can work with any front-end technology.

I have worked with Struts, jQuery, AngularJS, Tapestry and JSF with Spring as a backbone. I worked with Handlebars, Thymeleaf, JSP, JSTL, Tiles, Free Marker, SiteMesh and Velocity templates. Speaking of AngularJS + Spring, check out jHipster.

With Spring, I get a mature framework.

This beats almost all the other criteria above. And I can say this separates Spring Framework from the rest of the offerings out there in any language.

I can bring upcoming technologies into Spring and later swap it with others if needed. Without disturbing the underlying architecture.

You could use Spring framework for web applications. You could use Spring as an MVC framework which is only one part of its offering. You could use it as a backbone for integrating all layers.

Spring provides full stack flexibility in my projects that is hard to come by in ANY language or a framework. The thriving community has a plethora of plugins to integrate with most other prominent tools.

You could take these same criteria, apply it to any language and identify winner amongst them. Remember your winner may be different than someone else’s winner for the same criteria.

You have Symfony, Laravel, CodeIgniter, Nette, CakePHP, FuelPHPZend Framework etc. for PHP frameworks.

You have Django, Flask, Pyramid, Bottle etc. for Python frameworks.

You have Angular JS, jQuery, Ember.js, React.js or Babel for Javascript JS frameworks.

You have Express, Koa, Flatiron, Hapi etc. for Node frameworks.

Summary

In the post, I identified criteria for picking the best web framework. I compared several frameworks in the light of this criteria. My focus was Java.

And I showed how Spring Framework is a unique offering in the entire web frameworks community. I hope you will agree that Spring is the best web framework with all that it has to offer.

I am finally seeing some spring-like offerings in the non-java world. I am glad to see languages learning from each other.

To finish the story. I flipped burgers for a whole year before I picked up another research assistantship. That same month, I also picked up a 3-month internship working for an online campaign firm in DC. The internship involved coding in PHP for some reputable companies.

Fast forward to few years from then, I made tens of thousands of dollars coding PHP for some of my clients.

If you think this post was helpful, please subscribe here.

Also, Please don’t be shy in sharing your thoughts. Come and say hi on facebook or tweet or leave your comments below.

Thanks and Have an awesome day!

-Amit

Amit

I work as an independent consultant in and around DC metro area. My clients have included federal agencies, non-profit firms and semi-government organizations. I live in Sterling, Virginia with my wife and our two kids.