RESTful Web Applications: Code Less, Do More

Wed 16 November 2011 · code · Tags:

What does web development mean? Usually you build some software that gets data out of some database converts it to HTML and sends it to a browser. Usually that software has to handle the other case, too: Receive input from a browser, make sense of it and write the data into the database. There’s your average web project.

But, since this is the age of responsive web design, AJAX and web apps, you aren’t done yet. Now you code a bunch of JavaScript, that does the same stuff client-side. Chances are good, you will have to write quite some server-side code for this, too.

Doesn’t sound very DRY, you say? Some other people had the same thought. They created frameworks, environments and whole programming languages to counter the problem. But why go for solutions, that are that complicated?

REST to the rescue

Why not try this:

  • Write a REST API that translates your data to JSON.
  • Write a (semi-)static HTML page.
  • Write JavaScript that talks to the API and translates the data for the user.
  • Be done.

Some people call this client-side assembled web applications. I call it good design. It separates business logic (server-side) from the presentation layer (client-side). A bunch of benefits comes with it, for free. Want a native client for mobile devices? Just put a new interface on top of the API. Need an API for third party developers? You already got one. How about performance? Pure JSON data most likely is smaller than complete server-side rendered HTML pages.

And don’t tell me this isn’t feasible because it requires JavaScript. Even Googlebot is JavaScript enabled these days. Big players are doing client-side web applications already. And if you say but this is hard!, I recommend reading up on Backbone.js.

Want to talk about it?

Photo of Christian Kaula

I make stuff simple.
Code, interfaces, things.
You can hire me.

Christian Kaula · Thieraufstrasse 2 · 95028 Hof · Germany
Twitter · Xing · GitHub · BitBucket · Django People · Djangogigs
· Mobile +49 179 9709833
http://christiankaula.com

Archive

  1. RESTful Web Applications: Code Less, Do More

  2. How to Handle Database Views in Django/South

  3. Entrepreneurship Summit 2011 Thoughts

  4. Improving Copy: EntryDNS

    misc · Tags:
  5. How to Come Up With a Good Product Idea (As a Coder)

    misc · Tags:
  6. Siri is from the Future

    interfaces · Tags:
  7. How to Make a Better Analog Watch

    interfaces · Tags:
  8. Where to Not Put Django Templates

    code · Tags:
  9. Camila-overload.de

  10. Studi-tools.de

  11. On CSS Structure

    code · Tags:
  12. My Take on Indention

  13. Why Web Development is Done in PHP or Java

    misc · Tags:
  14. Yay for Lanyon

    misc · Tags:
  15. Why My Mac Made My Sansa Clip+ Hang

    misc · Tags:
  16. Python: Decorate a Method That Gets Passed the Class Instance

    code · Tags:
  17. Django Template Tag to Shorten URLs Like Google

    code · Tags:
  18. Studi-tools.de is Online

  19. Nice to Know About Virtualenvwrapper

  20. Having been at Tschitschereengreen

    misc · Tags:
  21. A Howto on Django Syndication

  22. The Difference Between Work and Play

    tools · Tags:
  23. Nginx is Even Better Than I Thought

    misc · Tags:
  24. Clear Up Gelato CMS' Gibberish

    code · Tags:
  25. Don't Listen to the Idiot

    misc · Tags:
  26. Snow Leopards' Bad Sides

    misc · Tags:
  27. Make Django Send Mails to Admins Only

    code · Tags:
  28. How to Fix Portage

    code · Tags:
  29. Archive Twitter Stuff With Python

    code · Tags:
  30. Wee Free Icons

    tools · Tags:
  31. The Problem With Django, Nginx and FCGI

    misc · Tags:
  32. New Design

    misc · Tags:
  33. Pink Ponies for Everybody!

  34. Whoosh Makes the Haystack

  35. Selenium is Pretty Neat

  36. OpenID for Free

    tools · Tags:
  37. Multi-Object-Edit With Django FormSets

    code · Tags:
  38. CSS is the New C - Sass is the Future

  39. Where Asimov was Right

    misc · Tags:
  40. The Webdesigners Arch Fiend: IE6

  41. Die Cache, Die

    code · Tags:
  42. What if Twitter Stopped to be Tomorrow?

    misc · Tags:
  43. Django Performance Tuning - Speed Up!

  44. Django Members That are in Fact Raw SQL

    code · Tags:
  45. What to Do if You Have to 'Make All Strings Editable'

    code · Tags:
  46. Twitter is Even Worse Than I Thought

    misc · Tags:
  47. A Little Birdy Told Me…

    misc · Tags:
  48. With Django Debug Toolbar You Can Debug Django… Duh

  49. Lackeying Some Trading Card Fun?

    tools · Tags:
  50. By the Power of CSS… I Revisit You

  51. Jabberbot is Coming

  52. MacS are Like Tools

    misc · Tags:
  53. Jabber With Me Over XMPP

    projects · Tags:
  54. By the Power of CSS…

  55. Why I Barely Ever Read Comments

    misc · Tags:
  56. Internet Explorer 6 on Mac - Actually Easier Than IE on Windows

  57. Bash and the Secret of the Lost Folders

    misc · Tags:
  58. MAME on Mac - Already Like the Sound

    misc · Tags:
  59. Python - Strings Very Much Attached

    code · Tags:
  60. Fun With Forms in Django

    code · Tags:
  61. Subversion: Ignore More

    code · Tags:
  62. It's Time for Python Dateutils

    tools · Tags:
  63. That is Why Developers Aren't Called Testers

  64. Now With Legacy Tag-URLs

    misc · Tags:
  65. Html Validator - Valid HTML - Profit

  66. More Fun With Tracebacks

    tools · Tags:
  67. jQuery That Python

  68. Django Can be Too Convenient

  69. Long Live the South

    code · Tags:
  70. Get Windows for Free (For Internet Explorer Testing on Mac)

  71. Viva! Vista! Worms Armageddon!

    misc · Tags:
  72. Fun With Python Stracktraces

    tools · Tags:
  73. So Sweet the Crons - Sweetcron

    tools · Tags:
  74. News From the South

    code · Tags:
  75. VoodooPad - Its a Wiki on Your Desktop

    tools · Tags:
  76. Heeyoo, SEO

    misc · Tags:
  77. Take a Note on the Side With Sidenote

    tools · Tags:
  78. Piwik Even Sounds Cooler Than Google Analytics

  79. Pixen, Pixel… Editor

    tools · Tags:
  80. Long Hard Road Out of Hell

    misc · Tags:
  81. Suspicious SuspiciousOperation Exceptions

    code · Tags:
  82. Apple Mail AKA Hides-Best-Things

    misc · Tags:
  83. Don't Bring Me Down…

  84. Me and the Boys

    misc · Tags:
  85. I Have a Dream

    misc · Tags:
  86. Compress This Mess

  87. Ack, Knowledged

    tools · Tags:
  88. Plug in TextMate

    tools · Tags:
  89. Put Into Grand Perspective

  90. Code-A-Robot

    misc · Tags:
  91. Sub Fine Mecum Nemo Non Consentiet

    misc · Tags:
  92. DNS - the DNA of the Web

    misc · Tags:
  93. Open a Can of Worms

    misc · Tags:
  94. You Don't Print the Web Do You?

    misc · Tags:
  95. Postgres on Mac Revisted

  96. What the Heck is a KeePass?

    tools · Tags:
  97. Saving and Its Massive Effects

    misc · Tags:
  98. I'm Too Cheap for .Mac

    tools · Tags:
  99. You Can Even Calibrate Batteries These Days

    misc · Tags:
  100. Don't Mind Me - Just Passing Through

    misc · Tags:
  101. Virtual Python Revisited

  102. Going South

    code · Tags:
  103. These Windows Aren't Clear at All

    misc · Tags:
  104. Database Switcheroo

  105. Django? Isn't That Something Like Rails?

    misc · Tags:
  106. Magical Ponies

    misc · Tags:
  107. Yay for Automatic Deployment

    misc · Tags:
  108. A Quick Comparison of JavaScript Frameworks

  109. Apples and Pears

    misc · Tags:
  110. What I Forgot to Mention…

    misc · Tags:
  111. Good Friends

  112. Me vs Virtualenv

    misc · Tags:
  113. Where to Buy Apples Cheap

    misc · Tags:
  114. First Post!

    misc · Tags:
  115. MacGre

    misc · Tags: