CodeTrigger – One of the best .net Code generator

What is Code Trigger:

Code Trigger is a code Generation tool For C#, WPF, WCF, SQL SERVER/ORACLE/MYSQL and Visual Studio 2013-2017.

One can buy the tool from Link. 14 days Trial is also available after which one can purchase the full software.

https://www.codetrigger.com

splash_vs2013

My Experience:

Now a days life of a software engineer hangs around productivity, quality and efficiency. Delivering under tight deadlines with quality is a challenge for most of us.

Consider a client asks you to build a software under in 2 weeks, which includes web front end, backend with SQL server, and rest API’s for android and IOS platforms. It compose of let us say 4 entities, user, product, orders and sale. Sounds like a tough plan.

As a project manager one would think of following things:

a- Setup code base.
b- Graphics Design Resources availability.
c- Design and architecture.
d- Meeting deadlines.

As a developer I would think of following:

a- Which design pattern to follow.
b- 4 entities. Each entitiy should provide atleast basic CRUD (Create, read, Update and Delete) operations in Data Access Layer.
c- Performance of code
d- Bug free code
e- Web Service Layer
f- Dependency Injection in code? Ninject, Unity, Autofac?
g- Repository Pattern.
h- Writing the access layer.

Approximately i assume this should take around 4-5 days if a developer works for 40 hours a week.

A similar scenario came to me, but with a twist, i had 30+ entities, performance of code specially web services had a demand of 2-3 seconds per request, code quality should be top notch, clean code.

I was look around for difference code generator tools like LLBLgen Pro, SalarDB, and many more. But I choose code trigger for some reasons.

a- It plays directly with ado.net, and ado.net is the fastest. Clearly my choice is not Entity framework as it is slow for obvious reasons.

Dapper could be the second best choice, but it is slightly slower than core ado.net. Else i might have choose LLBLgenpro.

Few benchmark links that supports my argument.

https://www.exceptionnotfound.net/dapper-vs-entity-framework-vs-ado-net-performance-benchmarking/
http://ppanyukov.github.io/2015/05/20/entity-framework-7-performance.html

I could have gone for SalarDB generator but that was too plain simple code. Could be good for very small project.

For a medium to large scale project i must say CodeTrigger is the best code generator tool ever.

Best Features:

a- Clean & quality code
b- Bug free code
c- Performance
d- Easily manage changes during sprints, one click and you get your code changes
e- Visual Studio integration
f- Nice Criteria query API
g- Nice Repository pattern implementation
h- Generate SQL Stored procedures.
i- Support for logging
j- Exception handling support
k- Unit of work pattern
l- Dependency injection pattern using either Unity or ninject
m- Generates interface definitions.

On a recent project i did some measurements for code metrices, and they are as below:

For users who want to know more of the below stats should visit URL below:
https://msdn.microsoft.com/en-us/library/bb385914.aspx

blog-codetrigger-1

You can see the high maintainability index, low depth of inheritance and nice numbers for class coupling. And around 9000+ lines of code generated in under 15 minutes by clicks of few minutes. This is really a great tool and it increases productivity and efficiency of the developers to the highest level possible.

I would recommend this tool to all the developers fellows who are missing there deadlines, or needs to code with quality and good patterns, this is a nice tool to go for.

knockoutjs and MVVM

MVVM ( Model View ViewModel ) is a new architechture that is heavily followed in mainstream enterprise frameworks these days along with other frameworks. I’ll talk less about this and talk more about knockoutjs in this post. Knockout is an extraodrinary library, which if fully utilized in its best way, it can be very efficient and day saver in the end.

You can get more info about knockoutjs here at http://knockoutjs.com/

I’ll follow through a scenerio how we can utilize knockoutjs library in the simplest way possible.

Say, we have a webservice that is returning us some Json data. We want to pull data out of it and bind to our controls back there in the html form. Lets do it here.

Suppose our html is like this:

<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2>
Now we see that we provided just some databind attributes to the input controls. What we want is that when user adds firstname or lastName in the text boxes, it should concat those and display those in the <h2> tag which we have binded with fullName.
One classic approach would be to declare a onkeydown event on both first name and last name and in the event declaration, we can concat and set it into fullName block. For that we have to declare some extra stuff like we have to id-fy our controls, declare events, write some javascript.
Lets see a more savvy approach!
We will reference knockoutjs lib in the page, and in script portion write the following code (btw we can do the same code in seperate js file as well for clean seperation of code):
// Here's my data model
var ViewModel = function(first, last) {
    this.firstName = ko.observable(first);
    this.lastName = ko.observable(last);
    this.fullName = ko.computed(function() {
        // Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName.
        return this.firstName() + " " + this.lastName();
    }, this);
};
ko.applyBindings(new ViewModel("Planet", "Earth"));

What we have done here is we created a view model, and we created firstName and lastName properties in it, and ensured the two way binding through ko.observable(first). And for the replacement of javascript keydown event we have done it in a more cleaner way by making a computed function fullName.

In the end i called ko.appyBindings() function that does all the magic to bind my form with my viewModel and with event notifications to and fro.
Knockoutjs is a great library and with a great future ahead. I will be posting more on this so keep looking.

Software Design Approach Level zero

“Give me good mothers, and i will give you good nation”.

This napolean law applies somewhat to software industry as well, i say “Give me good software design and i will deliver good software”

A good software design requires a lot to think and endevour. Few things are as below:

– Solve the big question “Why?”, if we clear the why in our software while designing, we are half way done.

– Team balancing and satisfaction ( Mostly we do not care about this )

– Not everyone is a good software designer. Choose wisely, else the project will be spinning in facade, unity, singleton.. and what not

–  Make the base strong.. If your base is not strong, you can also hang your project in air with just one charisma. and that is “Communication”. Keep in line with your client at all time. Do not let him loose you and vise versa.

– Do not go for complex architectures, which just makes you geeky and give you an extra raise at the end of year. This stunt does works, but can elongate or sometimes destroys the projects.

– Ask your developer at least  once that they want to do the job or not, do not be impositive.

– Do not  cheat, bluff, over show, or give false committments to your client at all.

– Keeping all points above in mind.. Now guys, design your software at last.

Happy Software designing.

debug symbols not loading when i debug in Visual Studio

I was going to debug my asp.net app, while running the website, i placed a breakpoint, but it was not hitting that breakpoint during the execution cycle. I tried to do it through “Attach to Process” method, and attaching my Visual studio debugger to w3wp.exe.

Still no clue, i searched a bit of options in the Tools -> Options -> Debugging -> General and un-check the option that says “Require source files to exactly match the original version”

This will make life easier, and enable us to debug the solution. Phew!!

MVC 3 & RAZOR crash course by Microsoft and HEC

14th and 15th Feb 2012

Higher education commission scheduled an event for All Pakistan university training for MVC 3, the attendees were subjected to be both university students and professors as well.

The event went well, we took deep insight into MVC and RAZOR in a 3 hours session each day.

14th Feb :

  1. Institute of Management Science Peshawar
  2. UET Taxila
  3. PIEAS
  4. Comsats University
  5. KPK Agriculture University
  6. Air University

15th Feb :

  1. Punjab University
  2. Kinnarid Collage Lahore
  3. Shaheed Benazir Bhutto University
  4. University of Health and Science
  5. Punjab University Collage of Information technology

I hope it went well for the attendees.

Html 5 Sessions in Pakistan’s top Universities

Discussed the awesome technology with the following universities at Higher education Commission Video Conference facility,  facilitated by Microsoft Pakistan. It was a wonderful session, we saw some live examples and have an introduction  of HTML 5.

Following are the universities who attend the HTML5 session on 3rd Feb, 2012.

 Mirpur University of Science and Technology

  1. Institute of Management Science Peshawar
  2. Kohat university Peshawar
  3. Dow university of Health and Science
  4. Punjab University
  5. Frontier Women University
  6. UST Bannu