Saturday, November 29, 2014

Deploy to Azure button, WOW!

Deploy to Azure Button

Every now and then some technology, technique, product or whatever comes along that makes you open your eyes wide open and drop your jaw.

A few days ago Microsoft released the Deploy to Azure button, you can read the original post here, but TL;DR it’s a button you put in the README.md file of your GitHub repository and it would “automagically” deploy your repository to an Azure Web Site.

At first I thought, cool, but I’m sure there’s something they’re not telling you, like what’s the structure I need to have in my repository? do I also need to add my binaries, will they build my solution and deploy the assemblies?

So today I gave it a try. I do have a repository on GitHub which output also run on an Azure WebSite so I thought this would be the perfect test. The project is Azure Storage Explorer, and if you take a look the structure of the repository looks it is just a solution file (.sln) with two folders that are a web site project and a helper library.

github

So I added the button to my README.md file which in my case that meant adding this line to the file:

[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/?repository=https://github.com/sebagomez/azurestorageexplorer)

And that’s it. After I pushed it to GitHub I clicked on the button and this site called azuredeploy.net showed up telling me that my repository was going to published to an Azure Web Site. It let me pick a few config settings like the name of the web site AND THAT WAS IT!

What happened in between? I don’t know, I guess something cloned my repo, found and .sln file and built the solution and then moved everything (?) to a web site? I don’t know what they did, I’m just glad it worked the way it did. I’m not saying it is rocket science, it’s just that it’s nice when you find such a simple solution for a much complicated task to do manually.

Kudos to whoever thought having that button was a good idea!

p.s: I wish we had something like that in Genexus Server. I guess we could…

Read Full Post

Friday, November 28, 2014

Ctrl+[, S

VSJust a little short reminder about this useful shortcut in Visual Studio I always forget. It syncs the file you’re viewing with the Solution Explorer.
It used to be called “Locate in Solution Explorer” in previous VS versions extensions tools like Gaston’s CoolCommands.
Anyway, let’s see if writing this post helps me either remember the freaking shortcut or at least find it easily in the future.
Full list of (default) Visual Studio 2013 keyboard shortcuts here.

Read Full Post

Saturday, November 15, 2014

Contributing on Github

This is one of those things I end up doing now for the third time, and since it is not something I do pretty often, I always forget the steps since I don’t work with git on my day to day job. Also, as Scott Hanselman suggested some time ago, you should write a post for future reference, chances are it will also eventually help others.
So here it is, this is my step by step guide on how to contribute on a Github repository (actually any git repository) you don’t own. When you own it, it’s obviously simpler, we’ll see that part too, but when you don’t own it and don’t have enough privileges to push your changes to your repository, you need to create a pull request.
Little disclaimer: I’m not a git wiz or anything, I’m just annotating the steps that I found that worked for me for what I wanted to do. If there is a “better” option or you see anything that should be done differently, don’t hesitate to leave a comment.

Fork it

So, if you want to pull a request, you have to have a repository to pull from. To do that go to the upper right corner of the repository page and hit the fork button (I assume you already have a github account).
fork

Clone it

Ok, you have your “own copy” of the repository, but where? yeap, up in the sky. You now want to bring the sources to your hard drive. To do that you need to clone the repository. In order to clone it you need first to know the clone address, you’ll find that address again in your repository fork page under HTTPS clone url (clever, uh?)
So, open a command line, yes a command line, the command line is your friend, go to the directory where you want the source code to go and type:

git clone
 
After that you’ll see some magic. If it’s the first time you’ll be asked for credentials.

Do some work and commit the changes

After the transfer is done, you have your own local copy, of your own repository in your hard drive, now we can start changing what we want.
Always remember git status, git status is also your friend and it is the one that will tell you what’s going on. If you run git status right after the clone, you’ll get a message saying everything is up to date. But if you do run it after you modified a file, you’d get a message saying there are some changes but it’s not being tracked, which means it will not be committed, so you’ll need to add the files to what’s called as stage.
To do that type:
git add –a
 
If you run git status now you’ll see everything is ready for commit, so, let’s commit that.
git commit –m “your commit comment goes here”
 

Push it

Now you need to push the commit to the server, in this case, the forked repository. If you come from non-distributed version control systems and don’t know why is there a commit and a push I suggest you go read a little bit about git and distributed version control systems. Also, there’s a pretty good hand-on lab tutorial that helped me start with git (Try Git).

git push
 

Pull request

Now go to the original repository and create a pull request. You’ll see that you’ll be able to see you own repository commit where you’ll create the pull request.
And that’s it, you just created a pull request and hopefully it’ll be accepted and merged into the original repository.

Remote add

That’s it? well, not exactly. Chances are, you’ll want to keep your copy of the repository up to date so you can continue contributing. In order to do that you need to add another remote repository to your local copy. This remote will be linked to the original repository you forked from.
So type:

git remote add
 

Keep your copy up-to-date

You need to update your local copy from the original repository, the one that changed, since I’m the only one working on my own fork.

git pull master
 

Again, push

Keep in mind you just pulled the changes from the original repository, this changes are not in your own forked repository, so you need to push those to your fork.

git push origin master
 
 
And that’s pretty much all you have to do. Keep in mind you’ll be iterating thru pulling from the original repository, adding your changes, committing and pushes your changes and creating pull requests to the original repository.
The following diagram pretends to show you a “big” picture about the procedure.

git

As mentioned before, I’m not a git wiz or anything like it so if anything goes wrong, you’re pretty much on your own. Because as a common statement of this blog, this is 100% “works on my machine” certified.

workonmymachone

Read Full Post

Friday, May 30, 2014

Cross-platform is a feature

The way of making software has changed a lot since the early days, it has changed more than what the software itself has. Think of an old green-screen program where you had a lot of data entry to do. Now think of a brand new (smooth, spa) web application also for data entry, they might even look the same, but I’m sure the process of building each is totally different.

Nicolás Jodal mentioned in a recent keynote that the way of creating software is much more complicated than what it used to be. I couldn’t agree more, and I’ll try to explain here why.

Back in the old days when you were asked for a piece of software, you had (almost every time) the chance to choose the programming language and tools of your choice. Were you good at php, or asp? you could work in whatever you wanted and then tell your customer what hardware he needed to run the software you would provide. Sometimes of course, the client would tell you he had an old Linux server he wanted to use for that piece of software. Then, you would go to your office (bed room?) and hack for days in order to get to the promised schedule with something good enough to show your client. Once you had the program “done” you would deliver it to the client. There were some features he wanted but never told you about. He wanted the software to run smooth, with no delays (I remember 3secs per page load being the affordable top) and of course, secure. He didn’t want it to be hacked.

Now everything is a little more complex than that.

When you are asked for a program, it’ll will most likely be for a phone and/or tablet. That’s where the trends are. You could be asked for an app or a whole solution with back-end integration with existing software. Plus, you’ll most likely be asked to provide services to talk to other programs, and also consume from other programs. One thing is clear: you will have to provide many platforms.

Being good (expert) in Java and provide one single “flavor” of the app for Android is not good enough. You will have to learn Objective-C for iOS and C# (or Javascript) for Windows Phone. And that’s just as of today, we have no idea what will come next.

So a lot of people realized that, it is not something new, and are trying to provide some layer of abstraction so you don’t have to actually learn everything that comes out.

Xamarin provides you with a single language approach, where just by knowing C#, you can create native apps for every major smart device platform. That is OK, but still, you need to learn how the different programming models work.

Let’s say you want to show a small message in you app, you would have to write something like these depending on the platform:


Toast.MakeText (this.Activity, "Please verify your Xamarin account credentials and try again", ToastLength.Long).Show();


var alert = new UIAlertView ("Could Not Log In", "Please verify your Xamarin account credentials and try again", null, "OK");
alert.Show ();
alert.Clicked += delegate {
LoginView.PasswordField.SelectAll (this);
LoginView.PasswordField.BecomeFirstResponder ();
};


The first line is for Android, while the second snippet is for iOS. Trust me when I say they’re both C#, but as you can see, when developing for Android you need to learn what Toasts and Activities are. While for iOS the code looks totally different and you need to learn about the UIAlertView, program it’s delegate for the callback and so on.

As you can see, the language is not the problem here, the problem is that you still need to learn a lot from every platform you are targeting, and this is a simple example of course.

Xamarin recently released Xamarin.Forms. This trends to solve this problem by adding another layer with controls and pages that match a specific control in Andoid and iOS.

The other problem I see with traditional approaches, and this brand new from Xamarin, is that you need to write your business rules in a Word document (?) and then write the code, and sometimes also comment that code to explain what is supposed to do. That means that you have the same information in 3 different means.

Wouldn’t it be great if you could have all that information someplace centralized and versioned, let’s say a model? And run some process for which its output is the program that implements those rules? Wouldn’t it be great if once you have your Android app you could just (after tweaking some properties) run the process again and have your iOS app ready?

Wouldn’t that be awesome?

You cannot afford to learn everything if you really need to, I’m not saying it would be fun, but if you really need to do real world stuff that just does not scale up. What if a new platform shows up? Would your customer wait for you to learn the new thing (say Swift)?

It just does not scale up.

I mentioned before about Find my Plane, the flight tracker app I built which is now for Android, iOS and Windows 8. I could have never done that app for every platform in the time it actually took me. And now I’m able to prototype and deploy new versions easily, why? because I work on a model where I declare what I want to happen next and then I run this process to generate the many versions of my app.

image 

That’s why I believe Genexus is on the right track. I’m not saying it is done or solves every developer problem, but it sure helped me and thousands of developers around the world to take their apps out there. On time.

NOTE: The code shown above was taken from the actual app from Xamarin Store. You can download the app here: http://xamarin.com/sharp-shirt

Read Full Post

Sunday, March 16, 2014

9 reasons to use Genexus for cross-platform development

I recently came across an article talking about the best 5 reasons to use some particular product for cross-platform development, but when I read the article all I saw was smart devices development. I know we’re using the word platform for many things nowadays, but if you ask me, smart device technology is just one platform. Desktop apps and web apps are two more platforms that need to be added to the mix.

So, I thought I would write a post, from my own point of view and list the reasons why anyone considering writing cross-platform apps, should take a look at Genexus.

Disclaimer: I currently work for Genexus, but prior to joining them, I used their toolset in my previous job. And even though it will be difficult for me to be objective, I’ll try to stick to facts and leave my subjective opinions aside. These are my own thoughts.

If you’re not familiar with Genexus, let me give you a little background. Genexus is a 4GL development tool which represents your entities (or classes) in a a structure called Transaction. You define your structures (Transactions) and do not have to worry about the physical representation of the data, because Genexus is smart enough to create a 3NF normalization of your data in the database engine of your choice.

With that knowledge, Genexus will create the necessary programs to access the data, but you always have complete control of the program. You can define rules and access control. It’s everything you’re used to, but easier.

With that introduction, here’s my list of reasons why Genexus is THE TOOL to start paying attention to.

1. One Language to rule them all

If you’re a Genexus developer you can skip this one. If not, I know what you’re probably thinking: “do I have to learn another programming language?”. I’ll be honest with you.. yes, you do! But there are two primary benefits of learning the Genexus programming language.

  1. If you know English, you’re 50% closer. The Genexus language is really simple. Of course you have control flow statements, variable assignations, and basic native functions to perform every task you do, as with every other programming language.
  2. The Genexus programming language has been around for more than 25 years. It has evolved and improved over time. Can you imagine yourself using one single programming language for more than 25 years? Can you imagine your level of expertise in that language? You don’t have to move on, Genexus does it for you.

2. Real cross-platform

As I mentioned earlier, Genexus has been around for over 25 years. We didn’t generate native iOS apps back in 1989, we had COBOL and XBase. Then RPG came along. Then there was FoxPro for Windows, Visual Basic and Visual FoxPro, then Java, C# and Ruby for the web, plus HTML and Javascript, and recently Objective-C, Java (for Android and BlackBerry) and Javascript for WinJS and the new Microsoft stack.

So, we know what cross-platform is all about.

3. Native apps

We always thought of Genexus as a platform agnostic tool, so no matter what your target is, your same Genexus programs will execute in every platform. But that does not mean “platform ignorant”. We know where you what to run your programs. And we know what the best practices, or ways to execute programs, depends on the specific target platform. For that reason, we generate native target platform code. Take our Android-generated apps, for instance: you could open the generated sources with Eclipse, or use XCode for our Objective-C iOS generated code.

Let me be clear. You don’t have to -- there’s actually no need to do that -- I’m just saying you could if you wanted to.

4. Faster development

Well, of course is faster. But I’m not going to give you some marketing/sales pitch – but I can share my personal experience with you. I created Find My Plane for Android, iOS (iPhone) and Windows 8 (Modern UI) in a month using Genexus Smart Device toolset.

Do you think you can do better than that? Let me remind you that every app has specific layouts for its platform. I did reuse some of them, but most of them are exclusive for its target platform.

5. Practically no bugs

Of course we have bugs. But when you generate your code, most of the time you will generate the bug over and over again, so it’s easier to find. You could write an event and, if there’s a bug, it will depend on our event-firing mechanism or on our generated version of your code. What I’m saying is, our event-firing mechanism is the same for every event no matter what the developer wrote, so it’s really well tested (and used).

6. Model based

Since I started talking about architecture, let me tell you that Genexus is model based, which is a great feature.I won’t take up space to here to explain why that’s a great thing. Gaston created a list 8 reasons supporting the superiority of model driven development and you can find it here: 8 reasons why Model Driven Development is great.

7. Real world scenarios

We have all seen a cool demo about a new development tool, language, or technology where, with just a few key strokes you get a “Hello World!” kind of example up & running. Genexus is more robust than that. Of course, I could show you the “Hello World!” text on an iPhone in less than 5 minutes, but that’s not what Genexus is all about. Genexus is about real world stuff… from a little flight tracker app, to a huge world class ERP, and believe me, there are tons of great examples in between.  

8. Future Proof

There’s no much to say here. We told our RPG/Cobol users we were future proof; we also told that to our VB/Visual FoxPro users -- so now we are telling you we are future proof. But what does that mean? It means that no matter what the big players are going and no matter they are doing, we will take you there. And what if new players show up? We will be there too. In fact, right now we are working on our Windows Phone generator, and adding iBeacon support to our apps.

9. Free DB reorganizations

This item should get a whole post by itself. If you know Entity Framework, think of Genexus as Entity Framework on steroids. What happens when you need to move an attribute from a table to another or remove a whole table because you managed to merge its data into other tables? Genexus takes care of that. I know it sounds like black magic, but don’t just take my word for it -- give it a try yourself.

I didn’t want to write a marketing post, but I know I failed. The thing is I do believe Genexus is a great tool for agile software development. I know what some people is thinking because I’ve been there too: “I like to program my own code”, “I don’t want a generator” (and yet you use a compiler). I thought the same way. It’s a whole new world, and a whole new way of approaching a software development problem. It requires you to get out of your comfort zone, learn something new. But I guaranteed, you will never look back once you create your first app in half the time you would have using traditional tools.

Read Full Post