Skip to main content

· 4 min read

Learning Rust Language: Pros and Cons

I personally started learning Rust because I suddenly found myself loving writing in C++. Although I have experience using various languages such as Python, Java, C/C++, Go, and MATLAB, C++ has become my go-to choice for writing small programs. When I heard about Rust and its ability to compete with C++, I became interested in learning it. I’m still in my journey learning Rust, however, here I want to share some information about Rust compared to C++ for myself and anyone who feels the same. Rust is a systems programming language that has gained popularity in recent years due to its speed, memory safety, and concurrency features to the point that you will see Rust cult everywhere on Twitter. Here are some of the pros and cons of learning Rust.

Pros

  • Memory safety: Rust's ownership system and borrow checker help prevent common memory errors such as null pointer dereferences and use-after-free bugs. This can make Rust code more reliable and less prone to security vulnerabilities.
  • Concurrency: Rust's lightweight threads and message-passing model make it easy to write concurrent code that scales well across multiple cores.
  • Speed: Rust's performance is comparable to that of C and C++, making it well-suited for low-level systems programming and high-performance applications.
  • Expressive type system: Rust's type system allows for expressive and safe abstractions, such as algebraic data types and pattern matching.
  • Rust Compiler: Rust's compiler is very intelligent. It can highlight bad practices and catch mistakes effectively. Unlike in C++, where huge mistakes can fly past the GCC or Clang compiler.

Cons

  • Learning curve: Rust's ownership system and borrow checker can be difficult to understand at first and may require a steep learning curve for developers who are used to garbage-collected languages. Sometimes I personally get confused, but as I practice more problems, I start to think in terms of ownership, which helps a lot.
  • Tooling: Rust's ecosystem is still evolving, and some libraries and tools may not be as mature as those in C++ languages.
  • Strictness: Rust's emphasis on safety and correctness can sometimes lead to code that is more verbose and harder to read than equivalent code in other languages.

Rust vs. C++

Rust and C++ are both systems programming languages that offer high performance and low-level control. However, Rust has some unique features that we already mentioned in the pros which set it apart from C++:

  • Memory safety: C++ requires you to manage memory manually. But unlike Rust, where every value in Rust has a variable that owns it, there can only be one owner at a time. When the owner goes out of scope, the value is dropped, and its memory is freed
  • Concurrency: Rust's lightweight threads and message-passing model make it easier to write concurrent code that scales across multiple cores. C++ offers a powerful set of tools for concurrent programming but requires careful attention to detail and a solid understanding of memory management and thread synchronization concepts.
  • Expressive type system: Rust's type system allows for safer and more expressive abstractions than C++, such as algebraic data types and pattern matching.

However, there are also some areas where C++ may still have an advantage over Rust:

  • Maturity: C++ has been around for much longer than Rust, and has a more mature ecosystem with a wider range of libraries and tools.
  • Performance: While Rust's performance is comparable to that of C++, some benchmarks show that C++ can still outperform Rust in certain cases.

In summary, Rust is a language that offers strong memory safety and concurrency features, as well as comparable performance to C and C++. While it may take some time to learn Rust's ownership system and borrow checker, it can help prevent common memory errors and lead to more reliable code. Rust's expressive type system also allows for safer and more expressive abstractions than C++.

However, developers should be aware of Rust's evolving ecosystem and the potential for verbose code due to its emphasis on safety and correctness. It's also worth considering C++, which has a more mature ecosystem and may outperform Rust in certain cases.

Ultimately, the choice between Rust and C++ will depend on the specific needs of a project and the preferences of the developer.

· 2 min read

Openai GPT Opinion

In ten to five years, Artificial General Intelligence (AGI) definitely will reduce the number of developers in many fields. The reason for that is the current AGI, especially Openai Generative Pre-trained Transformer (GPT), even with the incredible improvement, cannot replace the whole process an individual is doing. You still need to tweak or modify AGI's final output, regardless of speeding up the time of doing specific tasks.

When AGI Will Replace People

When AGI can produce an output that does not need to be modified or tweaked with the production's reliability. For example:

  • Ask AGI to make a complete system design for specific applications. Then AGI does it from A to Z, which includes building deploy code, a testing server, handle storage.
  • Ask AGI to handel flight schedule in real time. Give the plane permission to land and another to wait in the sky while the landing lane gets empty.

Then at that level, AGI can replace people. And new jobs in monitoring with a degree of understanding of what is happening. But you will need one person and AGI to replace a large team of 100+ people.

Future

In the future, many valuable AGIs will be specific to particular areas or even countries. One thing I am interested in is reaching a possible AGI-to-AGI communication without any issues.

· 2 min read

Sharing a personal post. On March 6, I was finally lucky to have a vacation at Disney World in Orlando after 6+ years of graduate school in the United States. I finally gathered a good amount of cash for two days at Disney World. I choose to go to two theme parks: magic kingdom and EPCOT (Experimental Prototype Community of Tomorrow).

Magic Kingdom

Even though I'm not a fan of Disney princesses, going to the magic kingdom and seeing Cinderella castle was a unique breathtaking experience. I enjoyed all the ride experiences there, and for my bad luck, I did not try the Pirate of the Carbine ride. The firework performance for 50 years celebration was unbelievable at the end of the day.

Magic Kingdome before firework show Magic Kingdome before firework show

EPCOT

The rides at EPCOT were okay, but the most thriller one was the guardian of the galaxy ride. At that time, the line was long but worth the wait. The remarkable thing about EPCOT the had several regions that represent different countries and their food. France, Japan, Canada, Germany, Morocco, and more were there.

I plan to go back if I have another chance and stop at Universal studio, too, there. Taking a break from time to time is great, so you can come back with more energy to work.

· 3 min read
Emacs is the best IDE

Just let you know, but this always depend on personal experiences

I just wanted to share some thoughts about my journey using Emacs. I learned about Emacs around 2019 (what's wrong with me, I know!) while taking a data structure class. The professor used it to quickly make a buffer (a new window to write the text) but never forced anyone to use it. I got interested in Emacs but only switched partially to it. I was using the Atom text editor at that time. My journey with Emacs was a bit long, and many people will be hesitant to start fully using it. But I want to share maybe how to make it easier.

Emacs Vs. All Other IDE:

Many people compare Emacs with a text editor like Vim, VSCode, sublime, or Atom. Or even comparing it with IDE like JetBrains IDE. BUT Emacs is not just a text editor or IDE. It is more of a complete operating system in a program! So you can use it as a text editor and configure any programming languages you want. Emacs was built to be customizable, and you can do whatever you want. It uses lisp (emacs-lisp) programming language to write much functionality in Emacs, and you don't need to know lisp.

I had so many important projects, and I was using MATLAB, Clion, and PyCharm at that time and wanted to avoid taking the risk of using Emacs. However, once I got comfortable using it, it became my to-go choice every time.

How to Start With Emacs

The best thing you can do is to keep yourself from overwhelming yourself with all the features Emacs can offer. To do that, I recommend the following Install GNU Emacs:

  • Master using key binding in Emacs (give yourself a week). You can do that as a first step. Go over the Emacs tutorial to do that (you don't need to finish it all, only how to navigate).
  • Watch the first three parts of the Emacs from scratch series on Youtube by System Crafters Channel.
  • Only spend a little bit of time in the course series. Remember, don't want to overwhelm yourself.
  • Use already setup configuration (copy both init.el (.el = emacs-lisp) and Emacs.org (.org = emacs org mode) in GitHub repo
  • Pick any side project you have and commit to using Emacs with it
  • As you use Emacs more, you will learn more things.

· 2 min read

This is my first post on blog using Docusaurus.

Why Docusaurus? Made by Meta for a fast way to create documentation for a new project. Using it for my website is also helpful to be familiar with it in the future.

Markdown Features:

Since this is the frist post. I will include some mardown features to use with Docusaurus.

Front Matter

Metadata at the top.

my-doc.md
---
id: my-doc-id
title: My document title
description: My document description is here
slug; /my-custom-url
---

Code Blocks

src/hello.rs
fn main(){
println!("Hello, Friends!");
}

Admonitions

:::tip My tip

Use this awesome feature option

:::

:::danger Take care

This action is dangerous

:::
Take care

Thank you!

MDX and React Components

MDX can make your allows using any React components inside Markdown:

export const Highlight = ({children, color}) => (
<span
style={{
backgroundColor: color,
borderRadius: '20px',
color: '#fff',
padding: '10px',
cursor: 'pointer',
}}
onClick={() => {
alert(`You clicked the color ${color} with label ${children}`)
}}>
{children}
</span>
);

This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !

This is <Highlight color="#1877F2">Facebook blue</Highlight> !

This is Docusaurus green !

This is Facebook blue !