About debugging, by Elliot, Mr. Robot

“Must cutters think debugging is about fixing a mistake. But that’s boolshit. Debugging is actually all about finding the bug about understanding why the bug was there to begin with; about knowing that its existence was no accident, came here to deliver a message like an unconsious bubble floating to the surface, popping with a relevation you secretly kwown all along.” (Elliot)

Continue Reading About debugging, by Elliot, Mr. Robot

Dart: Factory Constrcutor

Constructors in Dart are very flexible, allowing definition default or named constructor with positional or named parameters, optional, required or default values. 

				
					abstract class IHello {                 // Define interface
    String sayHello(String msg);    
    factory IHello() {                  // factory constructor returns
        return new Hello();             // instance of Hello
    }
}
class Hello implements IHello {
  sayHello(String name) {
    return "Hello $name";
  }
}
main() {
    IHello myHello = new IHello();
    var msg = myHello.sayHello("John");
    print(msg);
}

				
			
Continue Reading Dart: Factory Constrcutor

Dart class

In this basic example, I am using as most as possible features of basic features of the class definition in Flutter. 

				
					class Hello {
  var hello;                          // public
  var _name;                          // private
  sayHello() {
    return "$hello ${this.name}";     // string iterpolation
  }
  get name => _name;                  // getter
  set name(value) => _name = value;   // setter 
}
 main() {
   var cHello = "Hello";              // no type annotation
   final String cName = "John";       // typed annotation + final 
    var myHello = new Hello();        // instance creator
    myHello.hello = cHello;           // assignments
    myHello.name = cName;
    print(myHello.sayHello());
}
				
			
Continue Reading Dart class

Dart is awesome

I recently started working with Flutter by creating my first mobile application for the company’s hackathon.

Prior, I took the course in O’Reilly, which amazingly introduced me to the world of “one code – multiple platforms”.

Flutter is the whole story and requires a separate post.

In the few posts, I’d like to share my expression from the Dart language – which is the language of programming for Flutter apps.

What is Dart

Dart is a programming language designed for client development,[8][9] such as for the web and mobile apps. It is developed by Google and can also be used to build server and desktop applications.
It is an object-orientedclass-basedgarbage-collected language with C-style syntax.[10] It can compile to either native code or JavaScript, and supports interfacesmixinsabstract classesreified generics and type inference.[11]

Wikipedia

The Flutter multi-platform applications are programmed with Dart.

Dart code can be easily converted to JavaScript using dart2js tool.

There is a huge similarity between Dart syntax and Java and JavaScript languages as well as implemented features from other languages like Python.

While JavaScript implements the OOP principles prototypical, the syntax of Dart, is very close to Java with some additional possibilities (like positional and named parameters constructor, default values).

The ease of working with JSON structures and working with them as a Dart object.

Mixins, the widely used feature in Python, can be easily implemented in Dart as, one of the solutions, for multiple inheritances.

Concurrency is another important feature for developing powerful applications. Here, the syntax is also very similar.

String interpolation is the easy and clear way of constructing dynamic contents.

Example

main() {
var h = “Hello”;
final w = “Hello”;
print(‘$h $w’);

print(r’no interpolation for $h $w’);

var hello = ‘Adjusting’ ‘String’;
print(hello);

print(‘${hello.toUpperCase()}’);
print(‘The answer is ${5 + 10}’);


var multiline = “””
This is
miltiline “””;
print(multiline);
}

Dart basic code “Hello World”

Reference

Dart Language Tour by dart.com

Dart in action, by Chris Buckett

Continue Reading Dart is awesome