Learn2Blog
Tags: opensource, beginners, dotnet, csharp
Published: 2023-09-15 18:50:10

## Learn2Blog

This week, I officially published my first open-source application called [Learn2Blog](https://github.com/Yousef-Majidi/Learn2Blog). While I've had a few public repositories on my GitHub account, they primarily served as a small portfolio showcasing the projects I've worked on so far, accompanied by simple descriptions. None of them were intended for further development as open-source projects. However, with Learn2Blog, I aim to change that.

Learn2Blog is a console application developed in C#. Its primary goal is to assist beginner developers, or anyone interested, in cultivating the habit of regular blogging without the burden of dealing with technical intricacies. You can quickly jot down your ideas in a text file, and the application will process and generate a valid HTML5 file from the content of the text file, ready to be published on your blog. Feel free to check it out and contribute! You can find installation and usage instructions [here](https://github.com/Yousef-Majidi/Learn2Blog).

## Slack and Open-Source Collaboration

This week also introduced me to working with [Slack](https://slack.com). In my open-source course at Seneca College, our task was to communicate on Slack to identify a repository for review, create issues for it, and find a partner to review our repository. Everyone in the class worked on creating their version of the same console application.

Working with Slack proved to be straightforward. I explored various threads where my classmates briefly introduced their projects. Among them, I found [rabroldan's](https://github.com/rabroldan) version of the app intriguing because it was developed in Python. I opted for a Python project since it's a language I'm less familiar with. In my software development journey so far, I haven't had many opportunities to work with Python, so I saw this as a chance to delve into it.

## Waypoint

[Waypoint](https://github.com/rabroldan/Waypoint) offers a unique approach to our task of creating a text-to-HTML converter. The developer implemented several interesting features that I found particularly innovative. Testing their application and providing feedback through GitHub issues was a rewarding experience. Definitely checkout their project!

Running their project was fairly straight forward. I had clear instructions on how to run the app, but the `README` file could be improved for clarity. So I filed an issue for them [here](https://github.com/rabroldan/Waypoint/issues/1). I also noticed that example files were missing from the repository. So, another [issue](https://github.com/rabroldan/Waypoint/issues/2) was filed for them. This was not a big concern for me personally, As I already had them ready for my  own project, but I thought another developer would probably find this helpful to have. Issues [3](https://github.com/rabroldan/Waypoint/issues/3) and [4](https://github.com/rabroldan/Waypoint/issues/4) were about documentation and code structure respectively. This was a point of challenge for me after cloning their project. The entire application was written in a single file with no comments on the flow of the application. As somebody who is not particularly familiar with Python, it took me a while to get familiar with the code. In terms of user experience, I also found that there is no proper way of exiting the flow of the application so [issue #5](https://github.com/rabroldan/Waypoint/issues/5) was filed for that. Issues [6](https://github.com/rabroldan/Waypoint/issues/6) and [7](https://github.com/rabroldan/Waypoint/issues/5) targeted two other bugs that I came across during testing. 

## Issues Created for Me

The issues created for me on my project were immensely helpful, as they helped me uncover critical bugs. These were issues that could have prevented me from achieving a top score on the assignment. I was genuinely grateful that my peers took the time to thoroughly review and test all edge cases. This experience truly underscored the power of open source collaboration.

### 1. [Incorrect Output](https://github.com/Yousef-Majidi/Learn2Blog/issues/2)

The first issue created (technically issue #2) was regarding the processing of paragraphs in the input text to create `<p>` tags in the HTML. Every blank line counts as a delimiter for a new paragraph, and therefore a new `<p>` tag. However, I was only searching for 1 end-of-line character when I should have been searching for 2, because the end of a paragraph is followed by 2 end-of-line characters. This was causing each line that ends with a `\n` character to be wrapped around with a `<p>` tag. See the example below:

Input:

```txt
This is paragraph 1.
This is part of paragraph 1.

This is paragraph 2.
This is part of paragraph 2.
```

expected output:

```txt
<p> This is paragraph 1. This is part of paragraph 1. <p>
<p> This is paragraph 2. This is part of paragraph 2. </p>
```

output when the issue was created:

```txt
<p> This is paragraph 1. </p>
<p> This is part of paragraph 1. <p>
<p> This is paragraph 2. </p>
<p> This is part of paragraph 2. </p>
```

This was a small oversight on my part, but it was easily fix. 

### 2. [Non-text Files](https://github.com/Yousef-Majidi/Learn2Blog/issues/3)

The application was incorrectly process any given file as input. This was because I had forgotten to check for non-text files. This was also causing the application to delete and recreate the output directory and potentially lose any HTML files in there. Even when no files were processed. Both of these issues were pointed out to me and fixed. 

### 3. [Clone Repository Command](https://github.com/Yousef-Majidi/Learn2Blog/issues/4)

When I created the repository, I chose the name `learn2blog` and promptly created the `README` file with instructions on how to clone the project. However, I later capitalized the name and changed it to `Learn2Blog`, but by doing so I broke the link to cloning the repository that was given in the `README` file. So this was an easy fix.

### 4. [Title Detection](https://github.com/Yousef-Majidi/Learn2Blog/issues/5)

One of the optional features I added to my application was to detect a title from the input text file. This title is to be added to the HTML as the `<title>` attribute as well as an `<h1>` tag at the top of the `<body>`. What I missed from the instructions is that this title is only added if it is detected in the input, and not all the time. 

### 5. [No Text Files in the Directory](https://github.com/Yousef-Majidi/Learn2Blog/issues/4)

When processing a directory as input, the code was already only searching for `.txt` files, however, in the case that none were found, no message was displayed for the user to inform them. 

## Summary

Perhaps the most valuable lesson I learned this week was the importance of paying meticulous attention to instruction details. I realized that I had missed some key points from the instructions and hadn't conducted sufficient testing, especially for edge cases. However, as I mentioned earlier, I was fortunate that my peers identified these issues and brought them to my attention.

I also learned that by reviewing other people's work, I was able to find issues with my own code and improve upon it.

Developing my application was not only educational but also enjoyable. I'm genuinely excited about it, and I know that more features will be added in the future. So, stay tuned for updates. Until next time, the journey continues...