[ 프로젝트 BEP ] 최종장 - 엔지니어로서의 마인드셋에 대해 : 우수한 엔지니어는 누구이고, 가져야할 마인드 셋에 대해

이미지
  들어가면서 이제 2025년도 얼마 남지 않은듯 하다.  조금 길어질 수도 있기 때문에  실제로 업로드 하는 것은 새해 이후가 될 가능성도 있으나  올해는 이 글로 마무리 해보려고 한다. 이제 이 최종장을 끝으로 이 프로젝트를 다소 마무리 할 수 있을 것 같다. 물론 전체적으로 글 자체가 부족한 부분이 여려 곳 보이지만,  이는 천천히 개선하기로 하고 일단 마무리를 잘 지어보려고 한다. 이 프로젝트의 목표는 어디까지나 주니어 엔지니어(넓은 범위로서)에게  도움이 될 수 있는 부분을 정리해 놓은 것 이며, 이를 전달하는 것에 주력을 했다. 정확히는 그 사이에 몇 번이나 직장은 바뀌었지만,  내가 다니고 있는 회사에서 작게는 멘터,  크게는 주니어 교육에 활용하기 위한 초안이였다. 들어가기 앞서서 먼저 개발자는 무엇인가에서 부터 시작해서,  수학은 필요한가, 그리고 학위에 대한 이야기를 나누어보았고, 그 다음으로 컴퓨터가 무엇인가에 대해서는,  가장 첫 장인 컴퓨터 개론에서 메모리 손실과 함께 설명하였다. 다음으로는 개발 방법론과 시스템 설계,  그리고 프로그래밍 언어에 대한 이야기로 간단하고 이론적인 이야기를 하였다. 눈치가 빠른 사람은 알 수 있듯이,  현실에서 가질 수 있는 몇 가지 의문으로 시작해서  컴퓨터라는 하드웨어 부터 시작해서,  프로젝트(개발 방법론), 설계, 프로그래밍 언어 순으로  일부러 점점 컴퓨터 세계로 들어가도록 구성을 해 놓았다. 여기서 한 걸음 더 나아가자면, 알고리즘이 들어갈 수는 있겠으나  어디까지나 가볍게 전달하는대에 목적이 있기도 하고,  개인적으로는 당장은 크게 중요하지 않은 부분이 라고 생각 했기 때문이다. 먼저 이 부분에 대해서 좀 더 자세히 이야기해보도록 하자. 시작 부터 모든 지식을 쌓을 수는 없다 이는 개발 영역에서만 해당되는 이야기는 아니지만,  모든 것에는...

[ Django, Python ] mozilla 튜토리얼 예제로 살펴보는 Django 분석 ② - 3 : 언어(Language) Model


도전 과제 - 언어(Language) Model


지역 후원자가 다른 언어로 저술된 새로운 책들을 후원한다고 생각해보자.

도전 과제는 도서관 웹사이트에서 
이것을 가장 잘 나타낼 수 있는 방법을 찾아내고,
Model을 추가하는 것이다.

고려해야 할 사항들
  • 언어(language)는 Book, BookInstance, 아니면 
    어떤 다른 객체와 연관되어야 할까?

  • 서로 다른 언어들은 Model로 나타내어야 할까?
    아니면 자유 텍스트 필드? 하드 코딩된 선택 리스트?
생각한 후에 필드를 추가해보자.



















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
from django.db import models
 
# Create your models here.
 
from django.urls import reverse  # To generate URLS by reversing URL patterns
 
 
class Genre(models.Model):
    """Model representing a book genre (e.g. Science Fiction, Non Fiction)."""
    name = models.CharField(
        max_length=200,
        help_text="Enter a book genre (e.g. Science Fiction, French Poetry etc.)"
        )
 
    def __str__(self):
        """String for representing the Model object (in Admin site etc.)"""
        return self.name
 
 
class Language(models.Model):
    """Model representing a Language (e.g. English, French, Japanese, etc.)"""
    name = models.CharField(max_length=200,
                            help_text="Enter the book's natural language (e.g. English, French, Japanese etc.)")
 
    def __str__(self):
        """String for representing the Model object (in Admin site etc.)"""
        return self.name
 
 
class Book(models.Model):
    """Model representing a book (but not a specific copy of a book)."""
    title = models.CharField(max_length=200)
    author = models.ForeignKey('Author', on_delete=models.SET_NULL, null=True)
    # Foreign Key used because book can only have one author, but authors can have multiple books
    # Author as a string rather than object because it hasn't been declared yet in file.
    summary = models.TextField(max_length=1000, help_text="Enter a brief description of the book")
    isbn = models.CharField('ISBN', max_length=13,
                            help_text='13 Character <a href="https://www.isbn-international.org/content/what-isbn'
                                      '">ISBN number</a>')
    genre = models.ManyToManyField(Genre, help_text="Select a genre for this book")
    # ManyToManyField used because a genre can contain many books and a Book can cover many genres.
    # Genre class has already been defined so we can specify the object above.
    language = models.ForeignKey('Language', on_delete=models.SET_NULL, null=True)
 
    def display_genre(self):
        """Creates a string for the Genre. This is required to display genre in Admin."""
        return ', '.join([genre.name for genre in self.genre.all()[:3]])
 
    display_genre.short_description = 'Genre'
 
    def get_absolute_url(self):
        """Returns the url to access a particular book instance."""
        return reverse('book-detail', args=[str(self.id)])
 
    def __str__(self):
        """String for representing the Model object."""
        return self.title
 
 
import uuid  # Required for unique book instances
from datetime import date
 
from django.contrib.auth.models import User  # Required to assign User as a borrower
 
 
class BookInstance(models.Model):
    """Model representing a specific copy of a book (i.e. that can be borrowed from the library)."""
    id = models.UUIDField(primary_key=True, default=uuid.uuid4,
                          help_text="Unique ID for this particular book across whole library")
    book = models.ForeignKey('Book', on_delete=models.SET_NULL, null=True)
    imprint = models.CharField(max_length=200)
    due_back = models.DateField(null=True, blank=True)
    borrower = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
 
    @property
    def is_overdue(self):
        if self.due_back and date.today() > self.due_back:
            return True
        return False
 
    LOAN_STATUS = (
        ('d''Maintenance'),
        ('o''On loan'),
        ('a''Available'),
        ('r''Reserved'),
    )
 
    status = models.CharField(
        max_length=1,
        choices=LOAN_STATUS,
        blank=True,
        default='d',
        help_text='Book availability')
 
    class Meta:
        ordering = ['due_back']
        permissions = (("can_mark_returned""Set book as returned"),)
 
    def __str__(self):
        """String for representing the Model object."""
        return '{0} ({1})'.format(self.id, self.book.title)
 
 
class Author(models.Model):
    """Model representing an author."""
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    date_of_birth = models.DateField(null=True, blank=True)
    date_of_death = models.DateField('died'null=True, blank=True)
 
    class Meta:
        ordering = ['last_name''first_name']
 
    def get_absolute_url(self):
        """Returns the url to access a particular author instance."""
        return reverse('author-detail', args=[str(self.id)])
 
    def __str__(self):
        """String for representing the Model object."""
        return '{0}, {1}'.format(self.last_name, self.first_name)
cs

이 블로그의 인기 게시물

[ Web ] 웹 애플리케이션 아키텍처 (Web Application Architecture)

[ Web ] 서버 사이드(Sever Side) ? 클라이언트 사이드(Client Side)? 1 [서론, 클라이언트 사이드(Client Side)]

[ Web ] 웹 애플리케이션 서버 아키텍처의 정의 및 유형 ( Define and Types of Web Application Server Architecture )