Posts From Category: programming

Herencia vs composicion

Ambas son dos maneras de reutilizar código para crear nuevas clases

Herencia

Permite que una subclase herede propiedades y métodos de su superclase o clase base. Facilita la reutilización de código y creación de relaciones jerárquicas entre clases.

Sin embargo puede llevar a estructuras de clases rígidas y complejas, y a problemas de acoplamiento.

Composición

En lugar de heredad de una clase base, la clase se “compone” de otras clases incluyendo instancias de otras clases como campos.

Esto promueve un diseño más modular y flexible ya que permite cambiar el comportamiento en tiempo de ejecución.

Depende del problema específico pero la composición suele ser preferida por su flexibilidad y capacidad para evitar problemas comunes de herencia.

Read More

Notepad++ log analysis

Delete all lines which doesn’t match a pattern

This pattern looks for everything that’s not [error] and deletes it from the file

^(?!.*\[error\]).*$

ctrl + F and replace everything with empty

See log files with colors

Go to C:\Users\your_user\AppData\Roaming\Notepad++\userDefineLangs. If the folder doesn’t exist, create it.

Create a file logSyntax.xml with the following content

<NotepadPlus>
    <UserLang name="logSyntax" ext="log" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="yes" Keywords2="no" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00WARN 01 02 03 04</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1"></Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1"></Keywords>
            <Keywords name="Keywords2"></Keywords>
            <Keywords name="Keywords3"></Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00 01 02 03INFO 04 05202 06DEBUG 07 08202 09ERROR 10 11202 12TRACE 13 14202 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="0080FF" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="FFFF00" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="B2C57F" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="00CA28" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="0080FF" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="8000FF" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="FF0000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="FF0080" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="FF0000" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="FF0080" bgColor="FFFFFF" colorStyle="1" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="00FF80" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="0080FF" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="0080FF" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="FF8040" bgColor="FFFFFF" colorStyle="1" fontStyle="3" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="61D502" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="4FA7FF" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="FF0000" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="8080FF" bgColor="FFFFFF" colorStyle="1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="C0C0C0" bgColor="FFFFFF" colorStyle="1" fontStyle="1" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

Restart
Select it from Language

Read More

SOLID Principles

These principles establish practices that helps maintain and extend software as it grows.

S - single responsibility
O - open/closed
L - liskov substitution
I - interface segregation
D - dependency inversion

Single responsibility

A class should have only one job - it should have only one reason to change

Read More

i18n & l10n

i18n is just a nomenclature for Internationalization. i18n involves, among other things, the ability to display translated content. It prepares a digital product for localization by for example, separate the content into strings so they are ready to be translated and delivered.

The same goes for L10n. This is a nomenclature for Localization. L10n involves translating content, adapting graphics and finalizing the producto for each regional market.

Reference(s)

https://www.oneskyapp.com/blog/i18n-need-to-know-internationalization/

Read More