Skip to main content

Log: 202209

· 7 min read

Achievement

  • Fluent Python (2nd ed.)
    • read all! (about 1000 pages)
    • this was really interesting book
      • writing about python from the various perspective
        • comparing with other languages
        • applying various design patterns
        • why python choose this syntax and language features, or why python doesn't do
      • i could learn a lot of general language features, design patterns, architectures and the way to solve problems along with python's language philosophy
      • reviewing the language from only one point of view is poor thinking
        • there are a lot of fields where the language is used
      • along with Essentials of Programming Languages, i knew that how python make it simple and easy to use by hiding low layer implementation such as pointers, treatment of strings, and resource management
      • how easy to use string in python
        • default utf-8 encoding, slice
      • one of the most my favarite point is the syntax to create list and dict
        • [1, 2, 3] and {"x": 1, "y": 2} are almost diagrams
        • to realize what data is, we just look at it, never read it
        • perceivability > readability
      • after all, completely covering python code with type hints is reckless
        • some packages, even pervasive ones, don't offer types enough
        • errors of mypy and pylance are too annoying
        • personally i want to stop using mypy
          • annotate types every parameters and returns, even it's apparent, are bother; optional typing is best choice
          • even variable name, docstring and comments are sufficient to give information of what data is
          • forcing static typing may kill some advantage of python as dynamic language
    • learned
      • decorator using class with __call__()
      • explicit use TypeAlias
      • function singleddispatch
      • typings python supports
        • duck typing
          • avoiding isinstance()
          • using try-catch (EAFP; easier to ask for forgiveness than permission)
            • <-> LBYL; look before you leap
            • hmm i don't like this style lol
            • but it seems that this style has advantage at concurrent programming
        • goose typing
          • using isinstance()
        • static typing
          • mypy
        • static duck typing
          • protocols
      • favor object composition over class inheritance
        • this was also said by JavaScript: The Definitive Guide
      • variance rules of thumb
        • if a formal type parameter defines a type for data that goes into the object after its initial construction, it can be contravariant (strict)
        • if a formal type parameter defines a type for data that comes out of the object, it can be covariant (lenient)
        • e.g. given Callable[[ParamType, ...], ReturnType], each ParamType is contravariant and ReturnType is covariant
      • with statement
        • It’s like factoring out the filling in a sandwich: using tuna with different breads. But what if you want to factor out the bread, to make sandwiches with wheat bread, using a different filling each time? That’s what the with statement offers.

      • python doesn't implement tail recursion optimization (PTC; proper tail calls)
        • Personally, I think it is a fine feature for some languages, but I don’t think it fits Python: the elimination of stack traces for some calls but not others would certainly confuse many users, who have not been raised with tail call religion but might have learned about call semantics by tracing through a few calls in a debugger. - Guido van Rossum

      • coroutines
        • run event loop then manage coroutines in it
          • passing control from one coroutine to another
        • thus coroutine is the way to run the program concurrently in a sigle thread
        • only one coroutine runs at a time
        • pros
          • no data corruption (vs. threads)
          • no cost of memory and context switch (vs. processes)
        • cons
          • cannot be used for CPU-intensive jobs
            • because only one coroutine runs at a time and it blocks the entire process
            • use processes instead
          • cannot be used for file I/O
            • we can use asyncio.to_thread() to avoid blocking the entire process
      • descriptor
        • the way to abstract away property definitions
          • a class that implements a dynamic protocol consisting of the __get__(), __set__(), and __delete__() methods
        • methods in python are also descriptor!
        • Reading an attribute through an instance normally returns the attribute defined in the instance, but if there is no such attribute in the instance, a class attribute will be retrieved. On the other hand, assigning to an attribute in an instance normally creates the attribute in the instance, without affecting the class at all.

      • type class is a metaclass: a class that builds classes
        • type is a subclass of object
        • but at the same time object is an instance of type (what?!)
    • some interesting references
    • some wise words
      • Be conservative in what you send, be liberal in what you accept. - Postel's law, a.k.a the Robustness Principle

      • If you want the sum of a list of items, you should write it in a way that looks like “the sum of a list of items,” not in a way that looks like “loop over these items, maintain another variable t, perform a sequence of additions.” Why do we have high-level languages if not to express our intentions at a higher level and let the language worry about what low-level operations are needed to implement it? - David Eppstein’s

      • When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I’m using abstractions that aren’t powerful enough—often that I’m generating by hand the expansions of some macro that I need to write. ​ —​Paul Graham, Lisp hacker and venture capitalist

In Progreess

  • Essentials of Programming Languages

    • Chapter 5. Continuation-Passing Interpreter
      • learned how to optimize tail recursion
      • if recursive function is tail recursion, it no longer need data stored within the current scope of the function for the next call
      • the way passing control flow like data was really fresh idea to me, i had never think like that
      • but i still have a question
        • continuation-passing style actually doesn't leave the function on stack, which is waiting for the value returned from the function called in it
        • but instead, continuations, which is a multi-nested closure, appear as arguments at a function call
        • does this really work as optimization?
  • A Book of Abstract Algebra

    • Chapter 5. Subgroups done!
    • there are many terms that appear in A First Course In Graph Theory
      • i've stopped reading it
        • a lot of terminologies to which i'm not familiar
        • very abstract
        • boring
      • maybe i should've learn abstract algebra first
        • i wanna revenge after learning abstract algebra!

Stack

  • implement something in rust

    • there is demand to rust in the company
      • honestly i think typescript is the best choice for almost all of our product
        • can write both frontend and backend
          • maybe server-side react will come
        • easy to learn and use
        • good googlabiliity
        • cost to learn rust and the strictness don't correspond with our products
        • questionable to implement web apps in such a low-level language
      • but i wanna use rust if used go lang
  • Programming in Haskell

    • putting aside good or bad, i like static typing and functional languages after all
      • really fun to write program in them
    • i wanna read again
  • SQL Antipatterns: Avoiding the Pitfalls of Database Programming

  • Database Internals

  • Computer Organization and Design MIPS Edition: The Hardware/Software Interface (6th ed.)

Music

  • Beautiful World / Utada Hikaru

Log: 202208

· 2 min read

Achievement

  • React
  • Python
    • FastAPI
      • smaller and simpler then flexible than nonolithic Django
      • we have to composite other tools such as for migrations and for ORM
      • instead, we can customize it for our favor
    • Pydantic
      • better than Django REST framework
      • but doesn't reach at all how we can handle objects far easily in JS/TS
      • so far, replacement Django with FastAPI doesn't solve my demand to backend TS
    • SQLAlchemy
      • API is similar to raw SQL so better to learn and use than Django models and queries
      • i don't want ORM to wrap a logic part of SQL such as join and where or so by like filter() or query() because they don't abstract them or make them easy to use at all, they just alias them.
        • i first assemble logic in raw SQL then i have to think of like how do i write this in ORM query API...what a waste of time!
        • most cumbersome when writing raw SQL is to convert result records to objects
        • that's all i want ORM to do
      • query API of SQLAlchemy v2.0 match my demand

In Progreess

  • Essentials of Programming Languages

    • 4.State done!
  • Fluent Python (2nd Edition)

    • Chapter 11. A Pythoinic Object done
    • decorator using a class with __call__() is easier to understand the working than a multi-nested function
    • functools.singledispatch
      • enable to divide the generic function into small functions for each type
    • Protocol type
      • enable to add type hint to duck typing
  • A Book of Abstract Algebra

    • many erratum
    • but the contents give many examples to help understand
    • the level of excercises is easy
      • working by my hand is also help to remember and understand the properties of groups
    • done
      • Chapter 4. Elementary Properties of Groups
    • in progress
      • Chapter 5. Subgroups

Stack

  • Database Internals

Music

  • State of Slow Decay / In Flames

Log: 202207

· One min read

Achievement

In Progreess

  • Essentials of Programming Languages
    • 4.State
  • Fluent Python (2nd Edition)
    • more than 1000 pages lol
  • A Book of Abstract Algebra
    • 2.Group

Stack

  • Database Internals

Music

  • Bibouroku / Sana

Log: 202205

· 2 min read

Achievements

  • Essentials of Programming Languages
    • Re-implemented chapter 3 using SLLGEN
  • Hacking: The Art of Exploitation
    • learned about
      • memory segments
      • the foundation of network again
        • how is the content of a packet in binary

Stacked

Monthly Review

  • i could take a break

    • honestly the first half of May i've been burned out and had no motivation
    • that's good once in a while
  • Hacking: The Art of Exploitation is interesting

    • i learned the foundation which is necessary for programming again
    • i'm not good at network but i could get interesting in it
    • read raw socket implementations
      • all data flowing on network is simply binary: a sequence of bits
        • which is thought that it should be arranged, following a standard like RFC
        • but we can send binary data by any bit arrangement to hack
    • some knowledge about network was useful for my job
      • building local DNS server using Dnsmasq to access local web app on Mac by hostname from iPad
  • wish list

    • learning Rust
      • i'm interesting in the lower part of programming
      • i wanna use static typed language
    • books
      • Fluent Python 2nd Edtion
        • i read the 1st Edition
          • it was very long but the 2nd is twice longer!
        • honestly, recently i don't like python
        • but many project use python so the demand cannot be ignored
      • Mastering Regular Expressions: Understand Your Data and Be More Productive
        • after that, program is a sequence of strings before compiled
        • handling strings can be a hack
        • and regex is powerful enough to make my development more efficient

Music

  • last few years i've almost linstened to instrumental music

  • wish every metal band would stream the intrument version for their all songs...

  • artists

    • Hedras
    • Xeuphoria

Log: 202204

· 4 min read

Achievement

  • One web service releaced
    • python
      • django
    • typescript/javascript
      • react
        • next.js

In Progress

Review since Feburary

  • one of the busiest days in my life
    • Feburary and March
  • develop and release a web app by a team for the first time

Good

  • knowledge about
    • django
      • especially ORM, QuerySet and Q object
  • make common react components from scratch
    • such as
      • list select
      • pagination
      • multi-sortable table
      • login required layout
    • i know there are libraries for these components and it's better to use them for a production development
    • but i wanted to write them by my hand once
  • write abstract functions in functional fashion in python
    • deep map
    • deep filter
    • deep zip
    • flatten
    • fit
  • make github actions
    • auto-deploy
  • write sql for data migration
    • make sqls written by a teamate more faster
      • first make a big table by joining source tables, then select from it

Bad

wrote a lot of, complex tests

I wanted to
  • check for any pattern of parameters each test
  • make each test more general
Why Bad
  • hard to maintain tests
    • tests are broken even when i changed source code a bit
    • readers else, other teamates can't understand what the test is for at a glance
      • they should followed the logic in the test
      • they need to debug to make the failed test pass
      • it's much burden to write tests like so by themselves
        • tests are written not only by me but also teamates
So I should
  • prefer simplicity to generality when it's difficult to make a test general while keeping the simplicity
    • writing tests that cannot be maintained is the same as not writing tests at all
    • it's a good and sipmle method for getting a test more general to make factory methods (fixtures) to make objects used in tests repeatedly
    • don't use if statement in a test
      • divide the test into two or more
    • keep the number of objects used in a test the least
  • don't repeat the same test cases tested in other tests
    • if the same test cases should be checked in several tests, it might be good to modularize source code to separate the test cases

BTW

Windows > Mac for me now

  • peformance of docker on mac is too poor
    • slow
    • typescript extension and prettier in vscode remote container often die
  • linux compatibility
    • i can use ubuntu in windowns thanks to WSL
  • mouse > trackpad
    • my shoulder, arm and hand often hurts using trackpad
  • keyboard
    • mac compatible keyboards less
      • mac compatible mechanical keyboards much less
      • HHK is out because of the keyboard layout
      • i had no choice but to use realforce but ... i don't like realforce keyboard so much
        • (why USB is type-A but for mac?)
    • HyperX Alloy FPS Pro is the best keyboard for me now
      • (although i don't play FPS)
  • cost
    • mac is too expensive

Team Development

  • do write documents and tests
    • don't think that it's ok if i know it or i can do it
    • if there is no document and test
      • new teamate will take long time to understand the project, the system and the source code
        • we cannot get help when we want help
      • we cannot share information about our project
        • we don't want to touch the thing we don't know well
          • motivateion and teamwork down
        • we have to explain about our project reatedly
          • it's lazy to explain so some part of work get more dependent on one developer
      • developer also need to maintain the developed part by him/herself
        • because only he/she knows about how it works

Music

  • LIFE / YUI
    • listened over ten years ago when i was a elementary school student, and listen now too

Log: 202201

· One min read

Happy New Year!

Achievement

  • Pragmatic Programmer (20th Anniversary Edtion)
  • The Unix Philosophy
    • i got different perspective from before to develop softwares
      • more ambitious and larger scale (both timely and systemly)

In Progress

  • Essentials of Programming Languages

What Next

  • make a smartphone app
    • study app
      • which language?
        • Dart looks good but it seems that i'll suffer from problems such as build errors and dependency errors due to cross platform...
        • probably i'll choose Kotlin and Swift so far.
  • learn Rust
    • although the priority is low in my mind
  • read
    • Computer Organization and Design MIPS Edition: The Hardware/Software Interface
    • kinda Biology introduction
      • i think that biology might give me somewhat ideas about system and software.

Log: 202112

· 7 min read

Achievement

  • Programming TypeScript / Boris Cherny / O'Reilly
  • Responsive Web Design with HTML5 and CSS / Ban Frain / Packt
  • Effective TypeScript / Dan Vanderkam / O'Reilly

In Progress

  • Essentials of Programming Languages / Daniel P. Friedman, Mitchell Wand / The MIT Press
  • Pragmatic Programmer / David Thomas, Andrew Hunt / Pearson Addson-Wesley
  • The Unix Philosophy / Mike Gancarz
  • Database Internals / Alex Petrov / O'Reilly

Review of My 2021

Learned about

  • CS
    • Systems
      • Clean Architecture
    • Algorithms
      • AtCoder
        • Green
      • Cracking the Coding Interview (6th Edition)
        • C++
        • Python
    • Math
      • Number Theory
      • Logic
      • Computation Theory
      • Linear Algebra
      • Statistics
      • Graph Theory
    • Machine Learning / Deep Learning
      • TensorFlow
      • Keras
    • Database
      • Database Internals
  • Languages
    • C++
    • Python
      • Pytest
    • JavaScript/TypeScript
      • React
        • Next.js
        • React Testing Library
      • Node.js
        • Jest
    • Functional Programming
      • Haskell
      • Scala
      • Scheme
      • JavaScript
        • React
  • AWS
    • SAM
    • Lambda
      • Lambda Layers
    • API Gateway
    • S3
    • CloudFront
    • CloudWatch
      • log
      • watch
    • DynamoDB
    • Route53

Programming Languages

JS/TS

it was soooooooooooo big for me to have learn about JavaScript/TypeScript deeply.

  • JS/TS is the best language for me so far.
    • i can write code easily.
      • i can write both frontend and backend in just JS/TS only.
        • i knew that it's hard so much to keep learning and using some languages in practice.
      • rich syntaxies and language features
        • array function
          • this is a very big feature to those who like functional style.
        • spread syntax, object destruction, promise, await/async etc
      • transpile
        • always work in the newest JS/TS version
          • JS has many pitfalls that are awkward and surprise novices.
          • new syntaxies or language structures have been released to replace them although old ones will remain in the future for backward-compatibility.
          • but we can always write program safely and comfortably in the newest JS/TS version, then transpile it to a target older version so we don't worry about the old language features.
        • prototyping or tracer bullet
          • i can ignore compile errors from TS and emit the build product anyway.
          • this flexibility is useful for prototyping or tracer bullet
            • in early stage, implement roughly to think of specification details
            • then gradually get it strict for realistic system
      • static analysis
        • i can catch bugs not at runtime but at compile time
        • type safe
          • TS gives me useful infomation about a variable, funciton, or so when i'm writing code
          • TS notifies me even typos by using String Union
      • structural type
        • it's more flexible and useful for web development than nominal type
    • it's popular
      • someone said that googlability is preferable to language goodness. it's one of truths
      • supported by many services and platforms
        • AWS
      • a lot of frameworks and libraries provided by communities
  • demand to master JS
    • JS is popular but i feel that those mastering JS is less than i expect

Python

  • i still think that Python is a good language
    • simple syntax
    • useful language features and built-in functions
    • we can run an implementation anyway because of dynamically interpreted.
    • we can add type infomation using typehint.
    • popular
      • many books about Python
      • many services and platforms support Python
      • many libraries and platforms published by communities
  • but i feel that it might not satisfy strictness to develop a production.
    • type system is insufficient
      • VSCode often doesn't show up type information even when using typehint
      • these is no compile time error; just all occur runtime
    • less maintainancibility
      • there is no constant variable in Python
  • for my preference
    • the syntax is not for functional sytle
      • not type safe
      • lambda function can be written in only one line
      • it's difficult to chain functions

Haskell/Scheme

  • writing programs in Haskell and Scheme was very good excercise to implement logics in functional programming style.
    • i got familiar with the recursion.

Development

Test

  • i wrote tests right for the first time.
  • i spent a lot of time to learn how to write tests, and implement actually and run tests properly...
    • Pytest
    • Jest
    • React Testing Library
      • not easy to use...
      • GUI test is more difficult than tests for backend.
      • i don't know React design pattern to make tests easy.
        • i can't divide a form component into API fetching and renderer.
  • i knew that writing test take more time than implementing features.
    • it makes me to consider testability while implementing features.
      • i got to be to prefer functional programming style.

Algorithms

  • AtCoder and Cracking the Coding Interview was very good practice to implement algorithms.
    • when i'm in trouble to implement logics in ordinal development declined.
    • i can easily modify an existing data structure or implement a new custom data structure if needed
  • search algorithms such as DFS and BFS is most useful for me.
    • i can manage to implement so many logic using DFS if i can ignore the time complexity.
    • to constrast, i've had no chance to use algorithms regard to the number theory in app developement.

AWS

  • i was astonished by the number of services and configurability at first.
    • examples in official docs are too few so i had to had so many trials and errors to deploy properly.
    • i knew that each service has the depth to experiment and configure options to optimize the perfomance.
    • but i could know the convinience of cloud service and the power of infrustructure as a code.
      • i implemented a web app backend in a template file.
        • we can manage infrustructures in VCS
        • we can copy it and create the same another environment easily
        • we can deploy and delete it easily
  • i didn't take exam for Certified Solution Architect finally.
    • i want to use time for other things to learn and i feel that it's better to work actually rather than memorize details including possibly unnecessary knowledge

English

  • i've read about 20-30 books written in English this year.

  • i've bought Japanese books about math or programming no longer.

    • i noticed that when there are things difficult to understand in English, they are also difficult in Japanese.
    • why it's difficult to understand them is not because the English texts are difficult, just because they themselves are complicated.
    • if the difference is little, it's better to read and learn about them in English because i can learn and practice English at the same time.
  • my English skills are reading >> writing > listening > speaking.

    • reading was improved so much.
      • i'm no longer in trouble when i read refarences or manuals in English.
      • vocabulary is still poor.
        • there are so many words i can't read.
        • i can't understand jokes or parables.
        • i don't know about casual or daily English at all
          • i'm now just specific to programming or math.
    • writing
      • writing is still slow but i feel it get to be better.
      • i became to be able to write documents about sysmtes or tools.
      • i can't write casual English.
        • i can't chat by chat apps.
    • listening, speaking
      • it's stil not good but improved by
        • watching youtube videos, explaining programming launguages, frameworks, algorithms or so, with CC feature.
        • reading books aloud

What Next?

  • i want to implement a middle or large system
  • i want to make apps
    • my blog
      • i want this to be a platform to exhibit my implementations
        • not only interesting but also entertainable or artistic
    • study app
      • like izanami jinja i made before
  • i want to read
    • Essentials of Programming Languages
    • Computer Organization and Design MIPS Edition: The Hardware/Software Interface
    • The Linux Philosophy
    • about computer network
    • about functional programming in practice
    • about software architecture
    • about system architecture

Log: 202111

· 2 min read

Achievement

  • JavaScript: The Definitive Guide
    • done
  • AWS Certified Solution Architect STUDY GUIDE
    • almost done

Comments

i learned a lot of things in these three months.
i really struggled to work them properly and i remberred importance of experiments and experimence; take your time, try the simplest case at first.

  • Back-end
    • AWS
      • CloudFront
      • CloudFormation
      • API Gateway
      • S3
      • DynamoDB
      • Lambda
        • Lambda Layers
    • Python
      • Pytest
  • Front-end
    • JavaScript
      • React
      • React Testing Library
      • Next.js
      • Mock Service Worker
      • Jest
    • TypeScript

it was good to learn about JavaScript.
it is easy to write code in JavaScript and JavaScript supports the functional programming style.
i found that mastering full-stack skills is sooooooooooooo hard.
i need to implement the both back-end and front-end, but i can use JavaScript to them.

i found that it is difficult to use interpreter languages such as Python and JavaScript for productions because of maintainancibility.
also i know that it is better to use popular languages for googlability and new people to team.
TypeScript almost meets my requirements so it maybe good to replace Python with it.
i wish to use a static typed language but there is no one i feel like good...

What Nexts

Work

  • Infrastructure
    • learn basics about network
  • TypeScript
    • basics: Programming TypeScript / Boris Cherny / O'Reilly
    • advanced: Effective TypeScript / Dan Vanderkam / O'Reiily
  • React
    • directory structure
    • component architecture
    • recipes: React Cookbook / David Griffiths, Dawn Griffiths / O'Reiily

Hobby

  • Programming Language
    • Essentials of Programing Language / Daniel P. Friedman, Mitchell Wand / The MIT Press

Log: 202109

· One min read

Achievement

  • Clean Architecture / Robert C. Martin / Addison-Wesley
    • done
    • too abstract for me to grasp the written
    • I do not have a memory which is enough to remember such many acronyms of principles
  • A First Course in Graph Theory / Gary Chartrand, Ping Zhang
  • The Go Programming Language / Alan A. A. Donovan, Brian W. Kernighan / ADDISON-WESLEY PROFESSIONAL COMPUTING SERIES
  • The Scheme Programming Language (4th edition) / R. Kent Dybvig ( scheme.com/tspl4 )"
  • Database Internals / Alex Petrov / O'REILLY