programming

Modeling C-based systems with UML

November 14, 2020
programming, C, methodologies

tags Software Engineering Methodologies Introduction # The Unified Modeling Language (UML) is used almost exclusively for Object Oriented Programming (OOP). Since embedded system design has become increasingly more complex, designers have been searching for new methodologies to manage these complexities and allowing higher productivity. Due to the exclusivity of UML for OOP, it makes it difficult for functional programmers to integrate UML concepts into the modeling because the transformation of many UML concepts to C is difficult and confusing (Wang 2009). ...

Technical challenge checklist

October 16, 2020
programming, checklist

tags Programming Software Engineering Having done quiet a lot of technical challenges, and having forgotten some details when submitting, I came up with a good checklist of things to check before submitting the technical test. Must do checklist # Keep commit readable, check if the company has any commit format of their own in their public GitHub organization or their wiki page (if any), otherwise, use conventional commits Structure your commits so we can revert in case of any bug. ...

Go binary search tree

September 7, 2020
go, algorithms, programming

tags Go Programming Software Engineering Requirements # Sorted array of lenght N Performance # Say an array contains N (search space o N) elements, and we divide N/2, getting a search space of N/2, how many steps do we need until we get down to just one an array of 1 element. O(log2 n) problem. Implementation # Can be implemented recursively or non-recursively. ...

Go Context package

September 3, 2020
go, programming

tags Programming Go Programming Keywords # Cancellation: is when you are requesting some services, and you cancel this request Propagation: means that if we asked someone for a service then you tell that person to cancel

Python temporary file

August 2, 2020
python, programming, libs

tags Python Programming Python’s tempfile standard library is pretty neat when we need to create a temporary file and/or directories. Instead of having a much of code like this: import pathlib def create_file(filename): if pathlib.Path(filename).exists(): # handle path removal/rewrite/backup pass with open(filename, "w") as f: # write to file pass We can ask Python to take care of handling this type of tasks for us. tempfile handles most of the OS API, so we can focus on writting the logic instead. ...

Python Async

July 30, 2020
python, programming

tags Python Programming Important keywords # Asynchronous IO (async IO) Language-agnostic paradigm (model) coroutine A Python (sort of generator function) async/await Python keywords used to defined a coroutine asyncio Python package that provides an API for running/managing coroutines Coroutine # A coroutine allows a function to pause before returning or indirectly call another coroutine for some time, for example: import asyncio import time async def count(n): print(f"n is {n}") await asyncio. ...

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. ...