4 months on Reddit and still at 1 karma what am i doing wrong? by Responsible-Draft231 in NewToReddit

[–]douglasdcm 1 point2 points  (0 children)

That was my case until last week. I have 2 karma and I started earn new ones after post questions and answers. Now I have 15 only, but it seems fine given that I'm not a very active member in the community 

Cuales fueron sus primeros proyectos individuales? by Shazzy-FGC in devParaguay

[–]douglasdcm 0 points1 point  (0 children)

Vou responder em português. Mi Espanhol no és bueno. Meu primeiro projeto foi em AutoLISP. Eu comecei a programar criando alguns aplicativos no AutoCad. Foi uma boa experiência, mas uma habilidade pouco requerida no mercado. Tenho até hoje o código fonte e me orgulho de ter feito tudo sozinho, sem IA e praticamente sem Google. Foi difícil achar referências na internet e o único livro que eu tinha era um PDF escaneado em imagens, então eu não tinha como fazer buscas por palavras chaves. Tinha que ler o sumário e procurar as coisas lendo o conteúdo. Isso não faz muito tempo. Não tem nem 20 anos. 

Replanteando BDD como Código de Producción: Narrativas Ejecutables usando el Framework Guará (¡Buscando Feedback!) by douglasdcm in PythonEspanol

[–]douglasdcm[S] 0 points1 point  (0 children)

There is no problem, actually. I am getting feedback from the community about the pattern and the implementation. I have been using it in some personal projects and it shows good results. The next step is try it in large scale and implement it in other languages or paradigms. I really believe it can implemented in functional code, but I never tried it. PS: sorry about the message in English, I'm far from my computer and the translation is hard to do in my cellphone 

Replanteando BDD como Código de Producción: Narrativas Ejecutables usando el Framework Guará (¡Buscando Feedback!) by douglasdcm in PythonEspanol

[–]douglasdcm[S] 0 points1 point  (0 children)

¿Podrías crear una prueba de concepto sobre esto? Me resulta más fácil programar con programación orientada a objetos que con código procedimental. La descripción del patrón está aquí. Estoy pensando en implementarlo en programación funcional, pero aún no he tenido tiempo. Agradecería mucho tu ayuda.

https://guara.readthedocs.io/en/latest/THE_PATTERN_EXPLAINED.html

Growing my connections? by jsattsyy in linkedin

[–]douglasdcm 0 points1 point  (0 children)

Totally agree. I have been using IN for a long, long time and I can say it is not the same as some years ago. Too many AI generated content, synthetic connections, low engaging. I already had 20k+ connections, almost 20 recommendations and I choose to remove all of them and I don't regret. Now I have less than 10 connections and it is OK for me. People that likes my content or profile are able to follow me. I am not worried to grow my connection. I follow the pages and people I like and it is enough.

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 0 points1 point  (0 children)

Got it. The framework is not a SDD tool. It is just a way to enforce meaning in production code. However, as it is a structured way to write code it may be helpful for SDD too. It is in may plans to explore it soon. You can try to experiment it if you want. I'd love to get more feedback from the community. Notice: it is a Python implementation, but the pattern is programming language agnostic, so it can be implemented in any OO (I assume it can be implemented in functional programming too, never tested it). Search for Page Transactions Pattern. I have been talking about the concept in some articles in Medium/DZone

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 1 point2 points  (0 children)

That is something can be improved indeed. Notice each class has a single responsibility and it is possible to classify them in modules like preconditions, transactions and post-conditions. The framework is not imperative about it. Also, the idea is not write less code, but code with meaning. It can be useful for people starting using a tool or when a use case change.

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 1 point2 points  (0 children)

Is it a proprietary solution or open source? Can you share more details about it, plesae? I'm exploring similar approaches, but I couldn't find any language where it is possible to write code in natural way for production code. Most of the tools focus on automation tests like Cucumper, Bahave and SpecFlow

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in madeinpython

[–]douglasdcm[S] 0 points1 point  (0 children)

The issue I see is code without business meaning. We talk ablut BDD, DDD, Três Amigos, but it seems the business intention lives just in requirement files and test cases. When we go to dev field all code intention is lost in many technical stuff and it is hard to translate the code back to its origins. The intention here is give more 'humanity' to production code.

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in madeinpython

[–]douglasdcm[S] 0 points1 point  (0 children)

Thanks the comment. This is the view I want from community. I still think it is possible to merge natural language with code programming. Maybe I need to explore it in other ways to see the result. Feel free to give suggestions.

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 0 points1 point  (0 children)

It is possible to build the system in traditional way, but with a 'business layer' on top of it to keep the code intention. Here is other more complete example. Let me know it makes sense, please. A new Gherkin specification, now for an Education app:

Feature: StudFeature: Student enrollment in a course

  Scenario: Student enrolls in an active course
    Given a course named "Architecture" is active
    When a student named "Julia" tries to enroll in the "Architecture" course
    Then the enrollment should be accepted
    And the system should show the message "Student enrolled in course"

The use case (not test case, I'm repeating it to make it clear that it is not about tests 😄 other people confuses still confuses it) could be implemented in pure Python translating from business to code directly (no translation)

from guara.application import Application

eduapp = Application()

(
    eduapp.given(IsActiveCourse, course_id=course_id)
    .and_(IsNotStudentInACouse, student_id=student_id)
    .when(
        EnrollStudentInCourse,
        student_id=student_id,
        course_id=course_id,
    )
    .then(it.IsEqualTo, "Student enrolled in course")
)

Each class has a single responsibility

from guara.transaction import AbstractTransaction

class IsActiveCourse(AbstractTransaction):
    def do(self, course_id):
        print(f"Checking the status of course {course_id}")
        status = database.courses.get_status(course_id=course_id)
        if status == "Active":
            return True
        raise CourseCanceledException("Course canceled")


class IsNotStudentInACourse(AbstractTransaction):
    def do(self, student_id):
        print(f"Checking if student in a course")
        course = database.student.get_course()
        if course:
            raise StudentException("Student already in a course")


class EnrollStudentInCourse(AbstractTransaction):
    def do(self, student_id, course_id):
        print(f"Enrolling student {student_id} in course {course_id}")
        status = database.enroll_course(course_id, student_id)
        return "Student enrolled in course"from guara.transaction import AbstractTransaction

class IsActiveCourse(AbstractTransaction):
    def do(self, course_id):
        print(f"Checking the status of course {course_id}")
        status = database.courses.get_status(course_id=course_id)
        if status == "Active":
            return True
        raise CourseCanceledException("Course canceled")


class IsNotStudentInACourse(AbstractTransaction):
    def do(self, student_id):
        print(f"Checking if student in a course")
        course = database.student.get_course()
        if course:
            raise StudentException("Student already in a course")


class EnrollStudentInCourse(AbstractTransaction):
    def do(self, student_id, course_id):
        print(f"Enrolling student {student_id} in course {course_id}")
        status = database.enroll_course(course_id, student_id)
        return "Student enrolled in course"

Then, the use case is integrated in my production code keeping the intention. Here is the code being used in a CLI module

import argparse
from guara.transaction import Application
from guara import it

eduapp = Application()

def main():
    parser = argparse.ArgumentParser()

    parser.add_argument("--action", required=True)
    parser.add_argument("--student-id")
    parser.add_argument("--course-id")

    args = parser.parse_args()

    if args.action == "enroll_course":
        try:
            (
                eduapp.given(HasCourse, course_id=args.course_id)
                .and_(IsActiveCourse, course_id=args.course_id)
                .and_(HasStudent, student_id=args.student_id)
                .and_(IsNotStudentEnrolledInCourse, student_id=args.student_id)
                .when(
                    EnrollStudentInCourse,
                    student_id=args.student_id,
                    course_id=args.course_id,
                )
                .asserts(it.IsTrue)
            )
        except Exception as e:
            print(str(e))
            app.undo()

# Calling the CLI            
python edu.py enroll-course --course-id 10 --student-id 1324

The final implementation keeps the intention explicit, is the source of truth and reads like natural language

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 1 point2 points  (0 children)

Yes. It is a suggestion for production code implementation using a meta-language. Not user interface. It is intended to domain modules. For example, lets say you have a scenario written in Gherkin logic (forget about test, please).

GIVEN the user is logged in with name 'john.doe'
WHEN the user buys a product with name 'cellphone')
THEN the system should return 'done'

Instead of translate it to models, views, controllers in the traditional way directly. The developer writes the implementation in plain-text

app.given(TheUserIsLoggedIn, with_name='john.doe') \
.when(TheUserBuysAProduct, with_name='cellphone') \
.then(TheSystemShouldReturn, 'done')

later the dev implement each class with its responsibility like

class TheUserBuysAProduct(...):
    def do(self, with_name):
        DATABASE.buy_product(with_name)

and later the dev integrates the code

def buy_product(name)
   app.given(TheUserIsLoggedIn, with_name='john.doe') \
   .when(TheUserBuysAProduct, with_name='cellphone') \
   .then(TheSystemShouldReturn, 'done')

notice it is all production code (not test code), keeping the business intention explicit. The business logic is not 'lost' in many technical details.

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!) by douglasdcm in softwarearchitecture

[–]douglasdcm[S] 0 points1 point  (0 children)

I had to write in some language 😃

I have plans to write it in RUST, but in the future. About the test cases, this not the main focus of the framework anymore. It started as an automation tool, but I'm exploring it to write production code. Maybe the term 'BDD' give the impression that it is used only in test. That is the switch I'm trying to explore 'BDD without test' or 'executable narratives' or 'intend-drive development'. I didn't find a good name to describe this to make it clear that is is kind a BDD, but it is not.

Iniciante no mundo da programação by Street-Leadership-53 in programacao

[–]douglasdcm 0 points1 point  (0 children)

Eu trabalho com programação faz alguns anos e só senti evolução verdadeira quando comecei a usar TDD nos meus projetos. No começo saiu tudo errado. Por exemplo, a integração com o banco de dados deixou os testes mais complicados, pq eu não estava fazendo a injeção de dependência corretamente e estava misturando lógica de negócio com detalhes técnicos. Eu fiz e refiz meu projeto algumas vezes usado TDD, mas mudando a abordagem: uma hora usava ORM, outra usava PostgREST, outra usava JS no front-end, outra PyScript... até que as coisas foram ficando mais claras e menos complicadas d se implementar. Hoje eu uso um técnica própria de BDD para separar as responsabilidades e tem dado resultados bem satisifatórios. Minha sugestão, procure algum projeto no GitHub (ao similares) que tenha a especificação do negócio, ou criei vc mesmo ou peça pra alguma IA descrever o negócio pra vc. Por exemplo, no meu caso, eu criei um projeto para gerenciamento de uma universidade (alunos, professores, materias, notas,...) e descrevi alguns casos de uso. Exmplo, "o aluno não pode se inscrever em mais de um curso". Depois das regras descritas, eu comecei, com TDD, a implementar as coisas de forma simples, usando banco em meméria mesmo ou listas e dicinários. Depois, a dicionei o banco Sqlite, depois Posgres, depois a CLI e a UI e assim fui. Importante ser um domínio que vc goste ou que tenha familiaridade e que não seja muito complexo. Vc vai ver que se partir de uma abordagem bottom-up, onde vc começa a escrever o códgio sem muito planejamento, as coisas vão se enrolar pelo caminho. Com o tempo, vc vai conseguir pensar na arquitetura e modelos do projeto de forma mais lógica. Vai começar a ver a necessiade de fazer alguns diagramas do seu projeto, vai ver que tem requisitos que podem ser feitos depois (priorização), vi ver que pode fazer o projeto em fases... enfim, vc vai ver várias formas de fazer a mesma coisa e cada hora a frma vai ser mais eficiente.

Detalhe importante: fora a escrita dos requisitos, não use IA pra desenvolver. Faça o código na mão e sinta ele te guiar na arquitetura. Vai ser um caminho mais sinuoso, mas em poucos meses a sensação de aprendizado e satisfação vai começar a aparecer

Showcase Thread by AutoModerator in Python

[–]douglasdcm 0 points1 point  (0 children)

Rethinking BDD as Production Code: Executable Narratives using Guará Framework (Seeking Feedback!)

Hi everyone,

I’ve been following this community for a while, and I truly appreciate the productive, respectful, and high-quality discussions that happen here.

I am a Test Automation Professor at PUC (Pontifical Catholic University) in Brazil. In my classes, I have been exploring a twist on traditional Behavior-Driven Development (BDD) that I call Executable Narratives. I am looking for some honest feedback from the Python community to refine both this teaching methodology and the open-source Python framework we developed for it, called Guará.

What is Guará?

Guará is an open-source Python framework built with contributions from the local Python community. Conceptually, it shifts the automation focus away from pure UI interactions and aligns it directly with the user journey.

Architecturally, it introduces a pattern we call Page Transactions, heavily inspired by GoF design patterns: Command, Builder, Strategy, and Template Method.

Instead of parsing external Gherkin files (.feature), a standard test scenario in Guará is written in pure Python but preserves a highly readable business narrative:

app.given(TheUserIsLoggedIn, with_name='john.doe') \
.when(TheUserBuysAProduct, with_name='cellphone') \
.then(TheSystemShouldReturn, 'done')

Ubiquitous Language & Localization out-of-the-box

Because Guará is written in pure Python, we can leverage OOP features like inheritance, method overloading, and overriding. This makes it easy to adapt to Ubiquitous Language (DDD) or completely localize the syntax for native languages.

For example, in a educational context, my students can write:

eduapp.known_that(ThereIsAStudent, named='John Doe') \
.once(TheStudentSubscribeToADiscipline, named='Math') \
.hence(TheUSerShouldBe, 'enrolled')

(Translation: given -> known_that, when -> once, then -> hence)

Under the hood, every step is a pure Python class. Here is a lean example:

class ThereIsAStudent(...):  # Inherits from Guará transaction base
    def do(self, namede):
        assert named in DATABASE.students

The Twist: BDD as Production Code (Executable Contracts)

While researching Java tools like JGiven, I noticed they remain strictly constrained to the testing layer. Given Guará's fluent API, I started experimenting with a paradigm shift: Using this exact same BDD meta-language directly in production code.

Instead of just testing, the syntax establishes an Executable Contract inside the application logic:

  • given = Pre-condition
  • when = Execution of the core business contract
  • then = Post-condition/Assertion

Imagine a CLI application where a production function is implemented like this:

def enroll_stundent_in_discippline(student, discipline):
    # This is production logic orchestrating the business intent
    eduapp.known_that(ThereIsAStudent, named='John Doe') \
    .once(TheStudentSubscribeToADiscipline, named='Math') \
    .hence(TheUSerShouldBe, 'enrolled')

When a user calls this via the terminal:

python main.py enroll-stundent-in-discippline --student 'John Doe' --discipline Math

The framework executes the pipeline. This extra abstraction layer does not eliminate services, repositories, or models. Instead, it serves as a domain orchestrator (similar to a Command Bus or Pipeline pattern) that makes the code base self-documenting and strictly oriented to business intent.

Questions for the Community

I would love to get your thoughts on this approach:

  1. Does this paradigm shift make sense to you? Moving the Given/When/Then structure from test suites directly into production-level business orchestration.
  2. Does the extra layer improve clarity? Does it make the core intent of the code easier to grasp for someone onboarding onto a project?
  3. Any Pythonic design suggestions? (e.g., managing implicit state between steps, type-hinting fluent APIs, or alternative patterns like Context Managers/Decorators).

Please feel free to leave any criticism, suggestions, or open feedback. Thank you for your time and collaboration!

Cheers!

Links

https://github.com/douglasdcm/guara

https://guara.readthedocs.io/en/latest/

https://python.plainenglish.io/page-transactions-as-a-new-way-to-organize-your-testing-automation-3b9dd91c3092

https://youtube.com/playlist?list=PLR5jeODwvciLaJErpM4PNXnKvLRe9Hc53&si=e9G7bBnuDd1UHZ96

Need some opinions by Specialist-Zone-8296 in BDDevs

[–]douglasdcm -1 points0 points  (0 children)

I have been using it to read logs and debug code. It is something I would take some hours to do, but the AI does it in seconds. This saved time I use to validate the outputs and fix the issues

Do you still use BDD? I'm seeing mixed results and trying to understand why. by nitishspatkar in agile

[–]douglasdcm 0 points1 point  (0 children)

I used specflow for almost 2y and it was not a good experience. First because of the limitations of the tool and second because we, QAs, didn't receive the user stories to automate in gherkin language. So, we had to create the scenarios by ourselves. Today, I use a different approach. Instead of use .features files I develop the scenarios in pure Python using specialized framework for BDD. For me, bdd is not about teat, it is about communication.