4
$\begingroup$

I just started teaching an introduction to web development to high school students (they have the most basic knowledge of java) and this year my school has decided to make a change in the curriculum.

Previously we used JSP to dynamically generate pages, but now we decided to look for a different technology to replace JSP.

So, I am looking for a language for dynamically generating webpages (again, a replacement for what JSP does: servlets in Java). Bearing in mind that they know a bit of java, it would be highly preferable to use a language that is similar to Java.

I am well aware that there might not be a Java like language for this (other than JSP), but the more the language is similar to Java, the better.

If they end up learning a new language (not necessarily one for dynamic webpage generation), all the better.

$\endgroup$
  • $\begingroup$ Are you after creating dynamically generated pages, or dynamic pages? (The latter being pages with code embedded in them. So that the page can run code and change it self, without talking to the server.) $\endgroup$ – ctrl-alt-delor Sep 4 '17 at 9:49
  • $\begingroup$ @ctrl-alt-delor edited to clear that part. $\endgroup$ – ItamarG3 Sep 4 '17 at 10:06
  • $\begingroup$ Is javascript close enough? If so then I would suggest you look at couchdb. $\endgroup$ – ctrl-alt-delor Sep 4 '17 at 10:12
  • $\begingroup$ Why do you want to move away from Java? The reasons might change the answers as well. $\endgroup$ – Sirko Sep 4 '17 at 11:25
  • 1
    $\begingroup$ Then maybe turn towards a more client focused architecture like Angular in the frontend and Spring for Rest services in the backend. Not sure, however, how suitable this is for high schools students. $\endgroup$ – Sirko Sep 4 '17 at 11:41
3
$\begingroup$

I would recommend C#, more specifically .NET with MVC.

  1. It's fairly straightforward to move from Java to C#, seeing how they are both pretty much the same in terms of usage and maturity as a widely used OOP language.
  2. .NET allows you to use controllers + Views + Razor Engine which in turn allow you to use C# to generate most of the web portion i.e. HTML + CSS + JS.

On a related note, the days of programatically generating web code are behind us, now that JS based libraries are becoming ever more powerful. So, I have to opine here that teaching dynamically generating web pages using a Java like language is perhaps not the best step forward. They are better off taking up jQuery (or react if they are Facebook/Instagram fans).

$\endgroup$
  • $\begingroup$ I strongly disagree with the choice of proprietary technology which only really runs on top of another proprietary technology for academic use. (Yes, I know there's open-source version of ASPX and Mono, but they don't really work...) But even if they did, it would be far too easy for students to be led astray and into the non-free world of perpetual hand-holding and hand-twisting performed by large corporations on unsuspecting users. $\endgroup$ – wvxvw Oct 1 '17 at 13:34
4
$\begingroup$

I would recommend:

  1. Starting by teaching students just plain HTML, CSS, and perhaps JavaScript and focus on teaching the frontend first.
  2. Once students are ready for the backend, switch to using a minimalist framework such as Spark. Have them first construct HTML using plain old string concatenation, make a big deal over how sucky that is, then switch to using a templating engine (any one will do, so it's probably best to pick one with the best documentation).

Teaching the front-end first does require you to make a "clean break" and switch away from Java, but I do think it's for the best for several reasons:

  1. It's essential context for the students to have. Many backend tutorials will assume you already have a good understanding of the frontend, so it'll likely be more confusing if you don't start with the frontend.
  2. Starting from the frontend lets students get instant gratification.
  3. Starting from the frontend lets you move from simplicity to complexity: you start with static websites and gradually progress to something more complex (dynamic page generation, AJAX hijinkery, etc...).

I like using micro-frameworks such as Spark (for Java) or Flask (for Python) for teaching the backend. There's minimal ceremony, and micro-frameworks tend to closely mirror the HTTP request-response model, minimizing conceptual overhead. And since Spark is Java, you don't need to spend unnecessary time teaching a similar language.

In fact, there's even an argument to be made that the best thing to do is to ditch even micro-frameworks and start with just plain CGI or something: you literally manipulate strings, and that's it. Then, time permitting, you have students write their own framework/templating engine/what-have-you on top of that.

Basically, I view web development as one giant exercise in working with abstractions, and I feel one of the best ways to make students understand an abstraction is to have them build it from the ground-up/start without the abstraction. Web frameworks and trends come and go at a ludicrously fast pace, so I think it's particularly important in web development to focus on the fundamentals rather then trends. (You can see more about this philosophy here)

In particular, I like emphasizing that web frameworks are just complex ways of processing and sending strings: I think it helps demystify a lot of things, and gives students a concrete footing to help build their understanding of these abstractions.

(Tangent: you can work in all kinds of interesting CS topics depending on how much you want to commit to this "build everything yourself" model. For example, you can talk about compilers, parsers, and DSLs if you have students build their own templating engine; you can talk about NFAs, DFAs, regexes and such if you have students build their own regex engine to match routes... This is all probably overkill if your focus is just on teaching web development though.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.