Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Web Development with Smalltalk

1,544 views

Published on

"Web Development with Smalltalk" presentation at "Summer School on Languages and Applications" 2014 in Cochabamba, Bolivia.

Published in: Software
  • Be the first to comment

Web Development with Smalltalk

  1. 1. Web Development with Smalltalk PhD. Mariano Martinez Peck marianopeck@gmail.com http://marianopeck.wordpress.com
  2. 2. Mariano Martinez Peck Academics Software Engineer at UTN-FRBA, Argentina. PhD in Computer Science at the Université de Lille. Open-Source Fuel, Pharo, DBXSuite (OpenDBX and Glorp), etc. Industry Previously, many years at different companies developing in different languages. Currently, Independent Software Consultant
  3. 3. Muchas Gracias!
  4. 4. Context
  5. 5. Objective-C
  6. 6. Why Smalltalk?
  7. 7. Things are changing
  8. 8. Smalltalk is powerful Pure Object Oriented. Dynamically typed and reflective. Closures. Debug and changes “on the fly”. Everything is an object. Runs in a VirtualMachine.
  9. 9. 1. Domain specific logic. 2. Web logic (UI).
  10. 10. Two common possibilities Use Smalltalk for domain logic and building UI (using a web framework). The server will answer the generated HTML + Javascript. Write a separate UI (web logic) in another language (a fully JS client) that connects somehow (rest/json for example) to a Smalltalk server (domain logic).
  11. 11. Web frameworks Seaside AidaWeb Many others…but above are most famous ones.
  12. 12. Quick intro Open Source (MIT). In production since 2002. It is different to most web frameworks. Fully written in Smalltalk.
  13. 13. In a nutshell It is component based (pure Smalltalk). It provides natural flow. Components are reusable and statefull.
  14. 14. In a nutshell It is component based (pure Smalltalk). It provides natural flow. Components are reusable and statefull.
  15. 15. We don’t think in pages…
  16. 16. We think in Components There are no templates! There is no JSP, XML, PHP or whatever. You never see HTTP requests or responses (unless you want to). Simply Smalltalk.
  17. 17. Components are c☺☺l
  18. 18. Reuseable
  19. 19. Model View Controller Model, View, Controller
  20. 20. You can debug!!!!
  21. 21. We can read Seaside code and learn from it
  22. 22. Canvas and Brush html div id: ‘title’; with: ‘Title’ <div id=”title”>Title</div>
  23. 23. html div id: ‘list’; with: [ html span class: ‘item’; with: ‘Item 1’. html span class: ‘item’; with: ‘Item 2’ ] <div id=”list”> <span class=”item”>Item 1</span> <span class=”item”>Item 2</span> </div>
  24. 24. html anchor callback: [ self inform: ‘Hello World’ ]; with: ‘Show Message’ <a href=”/seaside/example1 ?_s=Ru8ZKgqjy0uDX3kf &_k=K5EQyqKE &32”>Show Message</a>
  25. 25. Demo
  26. 26. Pros: • Great learning curve: only one language. • Manage all code the same way. • We use the same IDE tools. • Excellent debugging capabilities. • Reusability. Cons: • More complicated graphic designer integration.
  27. 27. Demo
  28. 28. In a nutshell It is component based (pure Smalltalk). It provides natural flow. Components are reusable and statefull.
  29. 29. Natural Flow
  30. 30. value1 := self request: ‘First Number’.
  31. 31. value1 := self request: ‘First Number’. value2 := self request: ‘Second Number’.
  32. 32. value1 := self request: ‘First Number’. value2 := self request: ‘Second Number’. self inform: value1 + value2.
  33. 33. Not concerned about HTTP No manual request parsing No XML configuration files
  34. 34. x := A call: B A
  35. 35. x := A call: B AB
  36. 36. B answer: AB
  37. 37. B answer: A
  38. 38. x := A
  39. 39. This is thanks to Continuations… as we will see later.
  40. 40. Demo
  41. 41. In a nutshell It is component based (pure Smalltalk). It provides natural flow. Components are reusable and statefull.
  42. 42. ¿Qué pasaría si todo lo que haces, lo que conoces y lo que te cuentan se te olvidara? – Memento
  43. 43. ¿Qué pasaría si todo lo que haces, lo que conoces y lo que te cuentan se te olvidara? – HTTP
  44. 44. What happened in the movie?
  45. 45. If it is so bad…why it has certain success?
  46. 46. Well…. Good scalability. It seems natural (because it is mainstream). The database performs well so…
  47. 47. But…it’s tedious and manual
  48. 48. You must juggle to keep conversational context…
  49. 49. Abusing of databases is not good either
  50. 50. Seaside is based on reusable statefull components
  51. 51. Continuations self call: (AnotherComponent new) 1. Snapshots current estate. 2. “Jumps” to another place (.e.g #call:) 3. Do something. 4. When it comes back (.e.g #answer:), the state is available.
  52. 52. Advantages of Continuations It’s call and return. Transparent management of the state and the threads. It helps with double-request and back-button problems. You can decide what is considered state.
  53. 53. Is not paradise either…
  54. 54. Using continuations I have be heavier!!!
  55. 55. Scalability is a bit different
  56. 56. Other characteristics
  57. 57. Other characteristics Very nice integration with JQuery, AJAX, Comet, etc. We can use our preferred Web server when deploying. It’s not tight to any persistency framework. Tons of wrapped libs like Twitter Bootstrap, Highcharts, etc…
  58. 58. MIT License
  59. 59. • http://book.seaside.st • http://www.seaside.st
  60. 60. Some conclusions Very easy to learn, develop and debug. Good integration with existing libs. Great with web applications with complex logic and workflows. It could be heavy (statefull) for certain scenarios. A bit complicated to build app from graph designer template. May not be the best choice for plain web pages.
  61. 61. Write a separate UI (web logic) in another language (a fully JS client) that connects somehow (rest/json for example) to a Smalltalk server (domain logic).
  62. 62. Thanks! Questions? PhD. Mariano Martinez Peck marianopeck@gmail.com http://marianopeck.wordpress.com

×