I just got the "Hello, World" app running for the first time. It was a long journey

I am looking to make the same commitment to ICP that I made to Java in the early days and later, The Web.

I know onboarding will get better.

My first mistake was trying to get started with Windows System for Linux. It’s not soup yet.

Then I got Hyper-V installed and a stable installation of Ubuntu. I like Windows. It’s stable. I don’t run Windows as my daily machine. So, sue me.

Everything was smooth after I realized, I was not going to get ANYWHERE until I figured it out …

If I want the latest version installed, I have to specify that …

DFX_VERSION=0.7.0 sh -ci “$(curl -fsSL https://sdk.dfinity.org/install.sh)”

I didn’t want version 0.6.26 and it didn’t work under Ubuntu 18.XX anyway.

That took some time to figure out … now I’m on Ubuntu 20.04 LTS and everything is sweet. A beginner would NOT be able to figure that out.

And then the last hurdle, what Canister ID do I need to run the project from the browser.

$ dfx canister call hello greet Galaxy

works from the command line, but what canister ID do I need so that it will work from the browser??? … Ohhhhh…

dfx canister id hello_assets

Everyone knows that … RTFM …

Ok. now, I’m dangerous. I can build a local app … next …

Rule the Galaxy !! Greetings, Galaxy !!

6 Likes

Create the canister command: DFX deploy

1 Like

I’m going through all of the tutorials and I’m on … “Import library modules” … although it works and I understand what it does … I am struggling with the syntax below and I’m not sure I could write it …

    // A shared invokable function that inserts a new entry
    // into the phone book or replaces the previous one.
    public func insert(name: Name, phone: Phone): async () {
        let (newBook, _) = A.replace<Name, Phone>(book, name, nameEq, ?phone);
        book := newBook;
    };

    // A shared read-only query function that returns the (optional)
    // phone number corresponding to the person with the given name.
    public query func lookup(name: Name): async ?Phone {
        return A.find<Name, Phone>(book, name, nameEq);
    };

I’m right there with you. I get that typing is important for larger projects and for larger teams, but man would it be nice to write:

public func insert(name, phone){
if(book == null){
book = ;}
book.push({name: name, phone: phone});
};

In the beginning, this language just trips all over itself. Maybe I’ll get with the program and I’ll fly with it one day. Maybe I’ll bash my head in before I get there. :disappointed:

You do get the hang of it ; )

These examples are mostly using a functional approach where values and objects are immutable, so you’re passing them to functions that return a new value, instead of using methods to modify them.

The base library also provides imperative data structures though: HashMap, Buffer, TrieMap (actually wraps the functional Trie) which are often easier to work with.

Motoko is very good at type inference too, so many times you can omit the type arguments <…, …>. It can sometimes help to be explicit with them while writing, then later remove some where things are still clear but it helps readability.

1 Like

We have to put effort into learning the Motoko Base Library “batteries included” … Motto of the Python programming language which I love … I guess We need to learn those batteries.

I feel you man. The docs is so shattered. I need to scavenge for info everywhere.

And after spending two weeks working on IC app, I kinda feel motoko is a second class citizen at its current state. Not bad as a new language, but without enough low level stuff exposed, I run into limitations here and there. Rust is the first class citizen here.

I guess read through the IC interface spec and write in rust is the best option if you wanna get full potential and eventually up to full speed with IC development.

If you want to write Rust, don’t you have to implement the system functions somehow? Do you have to manually manage async calls? Can you even do cross container calls in rust at the moment?

Haven’t really tested rust on IC. But check this link: Introduction to working with Rust :: Internet Computer

My main concern/complaint of Motoko:

  1. It’s new and lack community lib, interop with rust or other lang is not supported currently
  2. Sometimes low level lang ability is desired, but motoko doesn’t expose that

Motoko is trying to abstract away details and bring down the onboarding requirement, which is of course good direction.

However, unlike Solidity which exposes low level stuff, Motoko is JS level high. I soon feel capped in regard of ability in this lang. But with Rust, via their CDK, you kinda see the full picture and get direct access to full ability of IC.