[Spring MVC] References

JAVA 2015.07.10 14:47




저작자 표시 동일 조건 변경 허락
Posted by 라딘.

자바 웹 어플리케이션에 대해서 매우 정리가 잘 되어 있는 글이다.

여러분은 자바 웹 애플리케이션 서버에 대해 얼마나 알고 계신가요?

추가로 서블릿에 대해서도 함께 정리해 보면,

  • Servlet

Servlets are server side components that provide a powerful
mechanism for developing server side programs. Servlets
provide component-based, platform-independent methods for
building Web-based applications, without the performance
limitations of CGI programs. Unlike proprietary server
extension mechanisms (such as the Netscape Server
API or Apache modules), servlets are server as well as
platform-independent. This leaves you free to select a "best
of breed" strategy for your servers, platforms, and tools.
Using servlets web developers
can create fast and efficient server side application
which can run on any servlet enabled web server. Servlets
run entirely inside the Java Virtual Machine. Since the
Servlet runs at server side so it does not checks the
browser for compatibility. Servlets can access the entire
family of Java APIs, including the JDBC API to access
enterprise databases. Servlets can also access a library of
HTTP-specific calls, receive all the benefits of the mature
java language including portability, performance,
reusability, and crash protection. Today servlets are the
popular choice for building interactive web applications.
Third-party servlet containers are available for Apache Web
Server, Microsoft IIS, and others. Servlet containers are
usually the components of web and application servers, such
as BEA WebLogic Application Server, IBM WebSphere, Sun Java
System Web Server, Sun Java System Application Server and

Servlets are not designed for a specific protocols. It is
different thing that they are most commonly used with the
HTTP protocols Servlets uses the classes in the java
packages javax.servlet and javax.servlet.http. Servlets
provides a way of creating the sophisticated server side
extensions in a server as they follow the standard framework
and use the highly portable java language.

source: http://www.allinterview.com/showanswers/4911/what-is-servlet-and-what-you-get-when-we-use-servlets.html

general definition of Servlet from Wikipedia

  • performance limitations of CGI programs.



  • JSP vs Servlet

      View 가 필요없는 서비스일 경우엔 바로 Servlet으로 구현하고, View 가 필요한 서비스일 경우엔 JSP 를 활용.

       reference : Performance Comparison of Alternative Solutions For Web-To-Database Applications

저작자 표시 동일 조건 변경 허락
Posted by 라딘.




An interface is a contract: the guy writing the interface says, "hey, I accept things looking that way", and the guy using the interface says "OK, the class I write looks that way".

An interface is an empty shell, there are only the signatures (name / params / return type) of the methods. The methods do not contain anything. The interface can't do anything. It's just a pattern.

E.G (pseudo code):

// I say all motor vehicles should look like this:
interface MotorVehicle
    void run();

    int getFuel();

// my team mate complies and writes vehicle looking that way
class Car implements MotorVehicle

    int fuel;

    void run()

    int getFuel()
        return this.fuel;

Implementing an interface consumes very little CPU, because it's not a class, just a bunch of names, and therefore there is no expensive look-up to do. It's great when it matters such as in embedded devices.

Abstract classes

Abstract classes, unlike interfaces, are classes. They are more expensive to use because there is a look-up to do when you inherit from them.

Abstract classes look a lot like interfaces, but they have something more : you can define a behavior for them. It's more about a guy saying, "these classes should look like that, and they have that in common, so fill in the blanks!".


// I say all motor vehicles should look like this :
abstract class MotorVehicle

    int fuel;

    // they ALL have fuel, so why not let others implement this?
    // let's make it for everybody
    int getFuel()
         return this.fuel;

    // that can be very different, force them to provide their
    // implementation
    abstract void run();


// my team mate complies and writes vehicle looking that way
class Car extends MotorVehicle
    void run()


While abstract classes and interfaces are supposed to be different concepts, the implementations make that statement sometimes untrue. Sometimes, they are not even what you think they are.

In Java, this rule is strongly enforced, while in PHP, interfaces are abstract classes with no method declared.

In Python, abstract classes are more a programming trick you can get from the ABC module and is actually using metaclasses, and therefore classes. And interfaces are more related to duck typing in this language and it's a mix between conventions and special methods that call descriptors (the __method__ methods).

As usual with programming, there is theory, practice, and practice in another language :-)


The key technical differences between an abstract class and an interface are:

  • Abstract classes can have constants, members, method stubs and defined methods, whereas interfaces can only have consts and methods stubs.
  • Methods and members of an abstract class can be defined with any visibility, whereas all methods of an interface must be defined as public.
  • When inheriting an abstract class, a concrete child class must define the abstract methods, whereas an an abstract class can extend another abstract class and abstract methods from the parent class don't have to be defined.
  • Similarly, an interface extending another interface is not responsible for implementing methods from the parent interface. This is because interfaces cannot define any implementation.
  • A child class can only extend a single abstract (or any other) class, whereas an interface can extend or a class can implement multiple other interfaces.
  • A child class can define abstract methods with the same or less restrictive visibility, whereas a class implementing an interface must define the methods with the exact same visibility.

저작자 표시 동일 조건 변경 허락
Posted by 라딘.

Simple Git-Hub manual

IT_Etc 2015.02.22 11:50


<make a local repository at root folder of project: do it once>

git init

<check that all files are tracked or not, modified, end so on>

git status

<add files that should be added or updated>

git add test.txt

<commit add or change into local repository>

git commit -m "2nd"

<check its status and log>

git status

git log

<add remote repository: do it once>

git remote add origin https://github.com/username/tutorial.git

<publish local commits to remote>

git push -u origin master


저작자 표시 비영리 동일 조건 변경 허락
Posted by 라딘.
TAG git hub

When a programmer executes the following make from README file, he may have a compile error related on 'size_t' of 

    "cd ../libfree  # continue building the basic library

    make "

Solution : Refer this site.

  (replace size_t with socklen_t)

  Then you execute 'make' without other error.

저작자 표시 동일 조건 변경 허락
Posted by 라딘.

티스토리 툴바