Entendendo Back-End para Iniciantes em Programação (Parte 1) | Série "Começando aos 40"

Entendendo Back-End para Iniciantes em Programação (Parte 1) | Série "Começando aos 40"

New Section

In this section, Fabio Akita introduces the topic of Back-end technologies and emphasizes the importance of understanding the context behind technology creation.

Context Behind Technology Creation

  • Fabio stresses the significance of grasping why specific technologies were developed, highlighting that technologies are tools created with a purpose.
  • He acknowledges the vastness of Back-end technologies compared to Front-end and expresses challenges in covering all aspects comprehensively within a single episode.
  • Fabio mentions the common question regarding which programming language to learn for Back-end development, listing various languages like Javascript, Java, C#, PHP, Python, among others.

Exploring Computing History

This section delves into Brazil's computing history and its impact on technological advancements.

Brazilian Computing History

  • Brazil's delayed entry into computing due to historical factors such as living under a dictatorship until the 1980s is highlighted.
  • The influence of market restrictions like import limitations on technological progress is discussed.
  • Mention of Brazilian computer brands like Itautec and Microsiga creating clones of international models such as IBM PC and Sinclairs is made.

Evolution of Programming Skills

Fabio reflects on his early experiences with computers and emphasizes the importance of mastering available technology rather than focusing solely on advanced systems.

Mastery Over Advanced Technology

  • Personal anecdotes about using Basic with Apple II and MSX computers in the late 80s are shared.
  • The rarity of senior programmers due to limited exposure before the 80s is highlighted.

Understanding System Fundamentals

This part discusses fundamental concepts related to hardware, CPU instructions, system calls, and assembly language.

Fundamentals of Systems

  • The evolution of programming careers post-web era in Brazil is outlined.
  • Explanation on how CPUs understand instructions through registers and execute functions akin to calling arguments in programming languages is provided.

Importance of Abstractions

The significance of abstractions in programming for efficiency and ease-of-use is emphasized.

Significance of Abstractions

  • Assembly language's role in communicating directly with machines through mnemonics like JMP or ADD is explained.

Understanding Compilation and Linking in Programming

In this section, the speaker discusses the intricacies of programming languages, compilers, and libraries, emphasizing the importance of writing code that is understandable to humans while allowing compilers to optimize it for machine efficiency.

The Role of Compilers in Programming

  • Different CPUs require different instructions, leading to language dependencies.
  • Compilers translate C code into machine instructions, optimizing code by removing unnecessary instructions and predicting outcomes.
  • Emphasizes that code should be primarily written for human understanding; compiler's role is to enhance efficiency.

Utilizing Libraries and Linkers in Programming

This section delves into the significance of libraries in programming, highlighting their role in simplifying development tasks and the options available for linking programs with libraries.

Leveraging Libraries for Development

  • Importance of reusing libraries like LIBC or Boost to streamline development.
  • Explanation of static and dynamic linking processes; static linking merges binaries into a single file while dynamic linking allows sharing library binaries.

Dynamic vs. Static Linking Considerations

The discussion shifts towards comparing dynamic and static linking approaches in programming, outlining their advantages and drawbacks based on program requirements.

Dynamic vs. Static Linking Analysis

  • Static linking results in larger binaries due to merging library binaries; dynamic linking reduces size by sharing library binaries.
  • Dynamic linking requires ensuring library presence on other machines; debate among programmers regarding the preferred method.

Programming Choices: Static or Dynamic Compilation?

Delving deeper into compilation choices, this segment explores when static or dynamic compilation is preferable based on factors like dependency management and ease of distribution.

Deciding Between Compilation Methods

  • Programmers debate benefits of static versus dynamic compilation based on ease of dependency management and distribution concerns.
  • Advocates for static compilation highlight simplicity in avoiding dynamic dependencies but note challenges with updates across multiple programs.

Software Management Systems: A Comparative Analysis

Concluding insights focus on software management systems prevalent in Linux distributions, detailing package managers like RPM, DEB, apt, pacman, among others.

Software Management Systems Comparison

  • Various Linux distributions employ distinct package managers such as RPM (Redhat), DEB (Ubuntu), apt (Debian), and pacman (Arch Linux).

New Section

In this section, the speaker discusses the process of installing dependencies, running configure, and using make to compile C code into binaries.

Installing Dependencies and Compiling Code

  • The process involves installing dependencies, running configure again, then executing make.
  • Modern programs rely on numerous libraries, requiring compilers like GCC or CLANG to transform C code into binaries.
  • Windows typically uses pre-built binaries in installers with included dependencies.

Compilation Process Comparison

A comparison between how programs are installed and managed in Windows versus Linux systems is discussed.

Windows vs. Linux Compilation

  • Windows installs programs with pre-built binaries and manages multiple library versions system-wide.
  • MacOS combines aspects of both concepts by maintaining older libraries while providing compilers for direct source compilation.

Interpreted Languages vs. Compiled Languages

The distinction between interpreted languages and compiled languages is explained along with examples of each type.

Interpreted vs. Compiled Languages

  • Interpreted languages translate code at runtime without compiling it into native binaries.
  • Interpreters include components like parsers to interpret code based on language grammar rules.

Functionality of Interpreters

The functionality of interpreters in reading and executing code is detailed for various programming languages.

Interpreter Functionality

  • Interpreters read code files, parse them into internal representations, and execute instructions accordingly.
  • Popular interpreted languages include Perl, PHP, Python, Ruby, and JavaScript with varying features such as pre-compilation options.

Interpreter Optimization Techniques

Techniques used by interpreters to optimize performance are explored through examples from Perl and Python.

Interpreter Optimization

  • Perl and Python offer options for pre-compiling source code to save parsing time.
  • Some languages like Ruby do not have pre-compilation features due to modern hardware capabilities reducing the need for optimization techniques.

Executable Creation Methods

Different methods of creating executables using interpreters are discussed alongside historical practices in programming environments.

Creating Executables with Interpreters

  • s Visual Basic allowed embedding interpreters within executable packages for portability.

Understanding Process Creation in Windows and UNIX

In this section, the speaker discusses the process creation in Windows and UNIX systems, highlighting differences in overhead and resource management.

Process Creation in UNIX

  • Creating processes in Windows incurs more overhead compared to UNIX due to different requirements.
  • In UNIX, forking a process is a common practice to serve multiple TCP clients simultaneously.
  • Forking creates a new process quickly by reusing memory through Copy on Write (COW), minimizing memory duplication.

Evolution of Web Servers

  • Transition from static to dynamic web content led to using Perl and PHP within servers like Apache.
  • Introduction of mod_perl and mod_php as modules within Apache improved performance over CGI but raised security concerns.

Optimizing Performance with FastCGI

The discussion shifts towards optimizing server performance using FastCGI as an alternative approach to enhance speed and security.

FastCGI Implementation

  • FastCGI operates as a separate server alongside web servers, maintaining interpreters in memory for faster response times.
  • Communication between web servers and FastCGI occurs via TCP or Unix Sockets, ensuring efficient data exchange for processing requests.

Windows vs. Linux Performance Considerations

Contrasting the performance disparities between Apache on Windows versus Linux systems underscores the impact of system compatibility on efficiency.

System Performance Variation

  • Windows lacks high-level API support for forking processes like CreateProcess, leading to slower execution compared to Linux.
  • Emphasizes the importance of matching software with the appropriate operating system for optimal performance outcomes.

Process Management: Threads vs. Forking

Delving into process management strategies, the speaker explores the dynamics between threads and forked processes in modern programming paradigms.

Process Management Strategies

  • While threads are prevalent today, forked processes remain relevant; examples include PostgreSQL's database connector utilizing forks.

Understanding Processes, Threads, and Multi-threading

The speaker discusses the concepts of processes, threads, and multi-threading in the context of programming.

Real Addresses and MS-DOS

  • In MS-DOS era, only one program could run at a time due to real machine addresses.
  • Switching between programs like Word and Excel required exiting one to load another.
  • Modern systems allow multiple programs simultaneously, easing memory concerns for programmers.

Processes and Forks

  • Processes can be cloned via forks in Linux for parallel execution.
  • Forked processes are isolated from each other, ensuring smooth operation.
  • Threads within a process are cheaper alternatives to forks but share memory space.

Thread Safety Challenges

  • Writing multi-threaded programs requires ensuring thread safety to prevent memory conflicts.
  • Programmers must manage locks to avoid corruption or deadlocks in multi-threaded environments.

Web Servers and Process Management

The discussion delves into web servers' functioning, process management strategies like forking, and challenges with thread safety.

Web Server Architecture

  • Web servers use forks for serving multiple requests concurrently.
  • Windows-based servers employ ISAPI as a cost-effective alternative to forks for thread-safe operations.

Programming Evolution

  • Delphi programmers have worked with DLLs like ISAPI or NSAPI for web development.
  • Various architectures like CGI, FastCGI, ISAPI gained prominence alongside interpreted languages during the dot-com bubble.

Multi-Threading Challenges and Java's Emergence

Exploring the complexities of multi-threading programming and tracing Java's origins from Oak at Sun Microsystems.

Multi-Threading Mechanics

  • Managing multiple threads involves schedulers pausing/switching threads for apparent simultaneous execution.

Java Development Background

  • Understanding C++, Smalltalk, Lisp aids in grasping Java's evolution from Oak at Sun Microsystems in 1991.

Java Virtual Machine (JVM)

Unpacking the concept of JVM as an advanced interpreter/compiler system abstracting underlying hardware specifics.

JVM Functionality

  • JVM acts as a virtual OS layer above physical hardware, executing Java bytecode independently of native OS platforms.

Compilation Process

Understanding Java Virtual Machine (JVM)

In this section, the speaker explains the role of the Java Virtual Machine (JVM) in compiling Java code and its similarities to a computer system.

The Role of JVM

  • When JAVAC compiles Java code, it generates a specific binary for the JVM, acting as a simulator of a computer system.
  • Java is not ideal as a replacement for Perl in command-line usage due to its slow initialization caused by sophisticated memory management and heavy loading during startup.
  • Ideal use of Java involves running a single process on a machine within the JVM, which manages parallel programs. Threads are essential for parallel execution within each program.

Java Compilation and Optimization

This section delves into how Java optimizes code execution through Just-In-Time (JIT) compilation and compares it with traditional compilers like C.

JIT Compilation in Java

  • JVM optimizes code in real-time to native machine binaries for enhanced performance using JIT compilation.
  • JIT compiler dynamically optimizes code during runtime execution, focusing only on actively running code segments for efficiency.

Java Portability and Compatibility

Here, the discussion revolves around Java's portability across different systems and its growth due to platform independence.

Portability of Java

  • Java's popularity stems from its ability to run on various platforms with different JVM versions required per system but maintaining compatibility.
  • Unlike other interpreters, Java encapsulates most functionalities within the JVM itself, enhancing portability across operating systems.

Interpreters vs. System Dependencies

This part contrasts interpreters like Perl with their reliance on system libraries against Java's self-sufficiency within the JVM environment.

Interpreter Dependencies

  • Interpreters bind to native libraries for functionality access, potentially causing thread safety issues if these libraries lack support.

Desenvolvimento de Linguagens de Programação

This section discusses the development of programming languages, focusing on the evolution from Visual J++ to CLR, .NET framework, and C#.

Evolution of Programming Languages

  • : Microsoft's early language, Visual J++, was not compatible with Java due to its proprietary JVM and unique features like RMI for native bindings.
  • : The incompatibility led to legal issues with Sun, resulting in the discontinuation of Visual J++. However, it laid the foundation for CLR, .NET framework, and C#.
  • : Contrasting Java's cross-device goal, .NET initially targeted Windows only. Over time, Microsoft shifted towards open source collaboration.
  • : The emergence of Scala, Clojure, and Kotlin compiling to JVM bytecode mirrored Microsoft's approach with C# and VB.NET compiling to CLR bytecode.

Implementing CLR on Linux

This part delves into Miguel de Icaza's project Mono that aimed to implement CLR on Linux as an open-source initiative.

Mono Project Implementation

  • : Mono project aimed at implementing CLR on Linux by rewriting .NET libraries for compatibility.
  • : Challenges included adapting Windows-dependent libraries for Linux performance parity.
  • : Mono utilized GNOME bindings for performance optimization similar to Windows-native applications.

.NET Core Development and Open Source Shift

Discusses the transition from Mono to .NET Core under Microsoft's open-source strategy shift.

Transition to .NET Core

  • : Under Satya Nadella's leadership, Microsoft embraced open source by acquiring Xamarin (formerly Mono) and rebranding it as .NET Core.
Video description

Este é o 5o episódio da série "Começando aos 40". Você deve assistir os episódios anteriores da série pra entender onde estamos e recomendo assistir os 2 vídeos da série "Sua Linguagem Não É Especial". No episódio de hoje vou começar a introduzir os conceitos básicos para o que chamamos de "back-end", que na prática é a própria introdução à programação. A intenção do vídeo não é serem aulas nem tutoriais, mas conectar os pontos de diversos assuntos que vocês vão encontrar de forma desconexa se sair pesquisando pelo Google. Se você fez faculdade, já deveriam saber tudo que vou dizer aqui, então veja o que faltou nos estudos e acelere! Em resumo, vou falar rapidamente sobre os conceitos mais simples, linguagem Assembly, compiladores, interpretadores, máquinas virtuais, bytecode, processos, forks, threads, tudo que qualquer programador tem obrigação de saber na ponta da língua e em paralelo vou passar rapidamente de novo pelos anos 90. Como o episódio ficou longo, eu dividi em 2 partes. Na de hoje vou só até o crash das ponto coms em 2001, e vamos continuar dali na Parte 2 da semana que vem. Links: * Playlist "Começando aos 40" (https://www.youtube.com/watch?v=O76ZfAIEukE&list=PLdsnXVqbHDUc7htGFobbZoNen3r_wm3ki) * Sua Linguagem Não É Especial Parte 1 (https://www.youtube.com/watch?v=p9-WuJbVHHc) * Sua Linguagem Não É Especial Parte 2 (https://www.youtube.com/watch?v=XcTTajFENHI) * Conheça a história (brasileira) da informática (https://keepgeek.wordpress.com/2010/08/01/conheca-a-historia-brasileira-da-informatica/) * Meet the Unitron Mac 512 – the World’s First Macintosh Clone (https://www.cultofmac.com/266710/meet-unitron-mac-512-worlds-first-macintosh-clone/) Canais Retro: * The 8-bit Guy (https://www.youtube.com/channel/UC8uT9cgJorJPWu7ITLGo9Ww) * Modern Vintage Computer (https://www.youtube.com/channel/UCjFaPUcJU1vwk193mnW_w1w) * LGR (https://www.youtube.com/user/phreakindee) Me sigam também em outras redes sociais: * Twitter (https://twitter.com/akitaonrails) * Instagram (https://instagram.com/akitaonrails) * Facebook (https://facebook.com/akitaonrails) * Quora (https://www.quora.com/profile/Fabio-Akita) * Blog (https://www.akitaonrails.com) * Transcript: https://www.akitaonrails.com/2019/02/20/akitando-40-entendendo-back-end-para-iniciantes-em-programacao-parte-1-serie-comecando-aos-40 * Audio: https://anchor.fm/dashboard/episode/eav9tl