cs

Use case template

June 23, 2020
programming, methodology, cs

tags Computer Science Programming Methodologies Software Engineering The following is a requirements template developed by Alistair Cockburn. This template may or may not have all or more fields related to the requirements itself. Recommended reading: Basic Use Case Template USE CASE #N Goal in context Scope Level <one of: Summary, Primary task, Subfunction> Preconditions Success end condition Failed end condition Primary actor <a role name for the primary actor, or description> Trigger <the action upon the system that starts the use case, may be time event> Priority <how critical to your system/organization> Frequency Usage example: ...

Go interfaces

June 22, 2020
go, programming, cs

tags Go Programming Programming Code snippets The following implements a DataModel, like Django’s Model class which requires Validate and Save methods be implemented by whoever uses that Interface. The problem is the Model. m object will be nil, because Model cannot access the User due to the embedded Model struct within the User struct. package main import "fmt" type DataModel interface { Validate() Save() } type Model struct { DataModel } func (m *Model) Validate(){ fmt. ...

Database

June 21, 2020
database, cs

Notes from Data and Reality: A Timeless Perspective on Perceiving and Managing Information in Our Imprecise World William tries to approach data towards how we perceive the world. The following key concepts can be considered in data modeling as to our inner domain. Existence: To what extend are you really present and engaged in the process of life around yourself? How real are the physical things around you? Identity: Who are you? ...

Go defer

June 19, 2020
go, programming, cs

tags Go Programming Programming import "fmt" func trace(name string) string { fmt.Println("Entering ", name) return name } func un(name string) string { fmt.Println("Exiting", name) return name } func a() { defer un(trace("a")) fmt.Println("Hello, world") } func b(){ defer un(trace("b")) fmt.Println("Before i < 10 loop") for i:=0 ; i < 10; i++{ defer fmt.Println("i =", i) } fmt.Println("After i < 10 loop") } func main(){ a() b() } Entering a Hello, world Exiting a Entering b Before i < 10 loop After i < 10 loop i = 9 i = 8 i = 7 i = 6 i = 5 i = 4 i = 3 i = 2 i = 1 i = 0 Exiting b

Coding Theory

May 31, 2020
coding, theory, cs

tags Information Theory Computer Science Programming Related video: https://www.khanacademy.org/computing/computer-science/informationtheory/info-theory/v/source-encoding-language-of-coins-4-9 Source encoding # Say Alice and Bob want to communicate with each other over some cable. They both live far from each other, so they decided to run a wire between both of their houses. Their communication has been working fine until winter. When winter arrived, lots wind noise started to happen and they are unable to communicate with each other over their cable communication system. ...

Binary calculation

May 31, 2020
math, cs

tags Math Computer Science Computer Architecture The b before the code blocks mean binary number, to avoid confusion Binary Addition # Possibilities # A OP B \= 1 + 1 10 1 + 0 1 0 + 1 1 0 + 0 0 1 + 1+1 11 Carry is involved whenever we have a result larger than bin 1 ...

Compiler

May 31, 2020
compiler, cs, theory

tags Computer Science Programming Syntax Analysis # Syntax analysis happens after the Lexical phase, and it is responsible for detecting syntax errors. Grammar # Be design, computer languages have defined structure of what constitutes a valid program. in Python, a program is made up of functions/classes/imports, a function requires declarations and/or statements and so on. In C, a valid program needs to have a least a function called main, otherwise the GNU’s linker is unable to link the program. ...