Internship Log (Part 1)
Well, today is the third day of the internship, and so far it’s quite different from what I had imagined.
I’ve complained before about the internet and its speed here: there’s no internet in the dorm at all, and the connection in the classroom is quite poor. This situation has suddenly made me realize how much of an internet addict I am. However, I personally don’t think that’s a problem. The internet can indeed become a “Khala” that enlightens people’s minds, ultimately elevating our entire species to a highly advanced…
Getting back on track, these past two days I’ve been learning the Spring framework, and it feels refreshingly new. As a newcomer, I couldn’t help but marvel at how elegant Java code could actually be.
This exclamation probably reveals how inexperienced I am. On second thought, what language can’t be elegant? Elegance is the crystallized wisdom born from meticulous thought and careful design; it doesn’t seem to have much to do with the medium itself.
RESTful
Currently, using the Spring framework is mainly for building web applications. Following the official tutorial, I also revisited the benefits of the RESTful architecture, which can be summarized as follows:
- Decoupling frontend and backend: Since this architecture is resource-oriented, formatted text (often JSON?) rather than entire HTML pages is returned as the Response. This allows for complete separation between frontend and backend.
- Clarity of representation: RESTful makes full use of the characteristics of the HTTP protocol. It uses URIs to request resources instead of long query strings separated by
&, embodying the design philosophy of HTTP (Hypertext Transfer Protocol) rather than just treating it as a low-level transport protocol and messing around at the upper layer. It strictly defines CRUD operations on resources and implements them using HTTP verbs.
I’ve only recently emerged from the ancient mindset of web development, so my understanding probably isn’t very thorough yet. If there are any misconceptions, please don’t hesitate to correct me!
Spring as a Web Framework
It’s been exactly a year since the major Java Web course project in my sophomore year. I’ve encountered several web development technologies since then. I can still recall the excitement when I first deployed an application to a server and successfully accessed it from my phone :) Having curiosity and following it to explore unknown territories is truly a wonderful thing.
From Java’s JSP to Python’s Django and then Flask, and finally back to Java, I met Spring.
JSP is a truly ancient technology, and using it is so cumbersome, especially during later development stages when modifying things for a specific feature. The entire Servlet can turn into a huge, lengthy monster. And when JavaBeans involve database connections with pagination requirements, achieving elegance is almost a pipe dream. JSP pages, originally intended to demonstrate high reusability, can become disfigured by various <%if(...)%> statements, to the point where I could write code that made me question my own existence. I should probably write a separate article reflecting on these heinous crimes I committed. Come to think of it, I don’t even know how to write RESTful-style web services with JSP.
Things became much clearer with Python. Whether it’s the powerful capabilities of Django or the simplicity and clarity of Flask, frameworks in general seem much more straightforward compared to the most foundational, path-breaking technologies. If we categorize developers into tiers—the first being the creators of the technology, and the last being the users of applications (even if they are purely derivative developers)—I believe framework developers occupy the second tier. They summarize common development workflows for a technology, extract the most frequently used, fundamental, and essential parts, and package them into reusable components, thus creating an excellent framework. Precisely because of this, excellent frameworks are often stripped from real application projects; Django is like that, and so is Spring.
But ultimately, I think Spring is more similar to Flask. They are both very lightweight and impose almost no restrictions. Perhaps the developers of Flask drew some inspiration from Spring.
An Interesting Point – Regarding the Symbol @
During my learning, I noticed that Spring’s controller routing is implemented using Java’s “annotation” syntax feature. I need to study this feature further. Coincidentally, Flask uses a similar form, though in Python @ is called a decorator—a syntactic sugar for wrapping functions. After browsing some materials, it seems this feature was indeed inspired by Java but is more complex in Python.
Therefore, as someone who already appreciates Flask, seeing this similarity instantly increased my fondness for Spring.
Summary
In short, my current skill level is still far from adequate, so I haven’t touched upon some of Spring’s core features like IoC, DI, etc. But it has made me realize why Java, a language that seems old and weary, remains enduringly popular, and it has also significantly increased my appreciation for Java.
Looking forward to learning more. It’s truly exciting.
Let’s end with a classic log conclusion: “Today was a truly meaningful day.”