Showing posts with label Technology. Show all posts
Showing posts with label Technology. Show all posts

Thursday, November 6, 2014

Mastering a new coding language is very easy

I know many languages starting with C, C++, Java, C#, Visual Basic, VB.Net, Basic, Pascal, FORTRAN…

Last year, when I started on the venture of developing iPhone games I had to start on a new language (Objective C). 

Here, I will try to list few things to keep in mind while learning a new language to make life easier and learning faster.

#1–Language is just tool of the trade. Making programs which solves my problem in efficiently is what matters 

I have come across many people who are hung on a language. Freshmen out of collage are advised  about the importance of a language. They many a times leave good jobs in search of find a job in search for a specific language. Programming for them is learning syntax of a particular language. They would be list on their experience of how to write for loop, defining arrays …

I have found many people who have spent more than 4 years in one language without knowing more than writing for loops and few simple statements.

Unless, you understand the data structure of a language, different constructs, like hash maps, arrays, and sets … you would stick to solving your problem by just using the arrays where set would have been a better choice.

#2 – 80-20 rule Pareto principle. 20% of syntax makes 80% of language

Each language has 20% most common key constituents. If you learn them you would be able to code 80% of your programming needs.  
1.       A Hello World Program
2.       Compute Program
3.       Loops
4.       Symbolic Constants
5.       Conditionals
6.       Arrays
7.       I/O Capabilities
8.       Functions

If you are able to just learn 8 above topics, you would have mastered 80% of the language for your programming needs.

#3 – Common Constructs

All languages common constructs are designed same. Example- for loop is for in all languages, all languages would have while, do-while constructs for loops.

Their defining would mostly in scoping the loop

In C,    for (;;) {    } à  {   }   curly brackets are scoping any construct.

Same is the case with PHP, java …

In C,   printf("\n");   for printing words…

Java, System.out.format("\n");

PHP,  printf("%d", "17,999") 

Don''t they look just the same :) 

#5 – Save your money. The best resources are free

In my life I have never used any book to learn a language. 

All my language learning is hands-on with Google, StackOverflow when I am stuck …

All you can ever learn in language exists somewhere in some site. All you need is to find it. However, you will need to be smart enough to change the things as per your needs to make it run ….  

#6 – Create SMART goals.

S.M.A.R.T. goals on the other hand are Specific, Measurable, Attainable, Relevant, and Time-bound.

Start with a hello world program to set up environment. 

And then begin your journey to learn the language with a small but very creative program which would include using functions, for loops , reading and writing files. 

If the language includes database then after files you could relace file by a database query and updating.

If you start with same program in language you would be able to relate new language construct with newer one giving you fast-track learning. 

It is exactly like how we do in our speaking language where we relate a new language like French with our mother tongue.

Ex- What is eating called in French?  What is sleeping called in French …  

Ex- How will do this thing like calling function in “C#”. How will I pass parameters to new function?

#7 – Time to Master- Explore uniqueness of the language.

Once you have mastered the average constructs and making easy programs. You will be able to understand other peoples coding. 

Now is the time to explore new features of the language and also the complex features. 

For this you may google for specific "technical terms" as you now know specifically what to search for.

You may get these things from Git-hubs, Open-Source repositories as they have code of people who have written best of utilities. 

You can learn from their codes, their best practices and lot more things specific to language.     

That is all there is it to learn a new language …

Happy Learning!!!

Thursday, April 7, 2011

.Net 4.1 Entity Framework 3 approach

Entity Framework allows the developers to write code against the domain classes for storing, retrieving and creating domain entities. .Net Entity Framework handles everything for you by generating all the data access code.



Entity Framework in .Net 4.0 provides multiple options of creating the data access code for a MVC Application.


1. Code-first, provides code-centric development workflow for creating the data access. The developer creates the domain class (and configures the database settings using CTP). The database and tables are created from the class and its public attributes.


http://msdn.microsoft.com/en-us/data/gg685467

Any change in the class or adding of an attribute, triggers the altering of the database entities automatically. (However, data may get deleted because of the database drop and recreation). There is option to stop the auto recreation of the database.

2. Model-First, model first workflow allows creating the domain model (Entity relationship diagram) in a designer.


http://msdn.microsoft.com/en-us/data/gg685494

Any change in the model by designer triggers the change in the data access code automatically for adding new attributes, and classes.


Any customization is done on the class extended from base data access code class. These custom classes are not recreated and our changes/customization are retained.


3. Database-First, allows starts with legacy database which creates the model thus generating the data access code of the models/domain.


http://msdn.microsoft.com/en-us/data/gg685489

Any change in the database triggers the changes in the model and hence in the data access code.

Sunday, March 13, 2011

Learning ASP.Net MVC 3


An excellent step-by-step tutorial by Scott Hanselman Reference:
 "http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part1-cs"


It is very good resource for the people who wants to move from ASP classic to ASP.Net …


Using New Project  “ASP.Net MVC 3 Web Application “  creates the MVC code:

  1.     Controller folder containing the Controllers 
  2.    View folder containing the view Templates
  3.    Model folder would contain the Models



Controllers are the link between Views and the Models.


In the HomeController, which is created by default by convention  invoked when we request,


<>/home


HomeController has multiple actions,


<>/home/index is the default action


<>/home/about would invoke About() action in the Controller class.


A typical action would return a View() which is mapped with View Template (About.cshtml) in the Views folder default named after the Action name.


About.cshtml will have all the HTML tags and embedded scripts like; @ViewBag, @HTML, @URL, @RenderBody etc. for displaying the dynamic content.


Controller can pass data to the view using,
ViewBag.Message = "Hello " + name; 
ViewBag.NumTimes = numTimes; 


Which is accessible in View as,
@for (int i=0; i < ViewBag.NumTimes; i++) {  
    

  • @ViewBag.Message




  • }


    Model is added, using EFCodeFirst,
       << EntityFramework Code First >> for developing model and database.


    Add a class in Model,


    The Classname maps to the Database table and all the public attributes of the class, maps to the database column name.


    Defining the Connection String, for Database connection


         <add name="MovieDBContext" 
          connectionString="Server=.\SQLEXPRESS; 
         Database=Movies;Trusted_Connection=true" 
         providerName="System.Data.SqlClient" />;
    and running the code, generates the database and table according the definition the class.


    Now this, model is accessible from Controller.


    Now using Linq, in the Action method



    1. Query a model,
    2.  Fill the View
    3. Return the view as ActionResult
    4. Now, in the View template ; Model is accessible for displaying. 



    Updating the Model code, like adding a new publics attribute will allow for dropping and re-creating the database again.


    Then using,
        @using (Html.BeginForm()) { 
        @Html.ValidationSummary(true) 


    We can create the form…


    For validation….


    [Required(ErrorMessage = "Title is required")] 
    public string Title { get; set; } 


    So just by few clicks, I have a fully running code auto-generated.

    Friday, February 25, 2011

    JQuery and CSS3 : Way to create Powerful Web Pages


    JQuery is doing magic. 
    Recently in a small project I had a chance to use JQuery. I was very surprised at seeing the amazing powe rof the JQuery. What I used to do in a day using Javascript is now possible in minutes. 
    I took me few minutes to make the divisions draggable, resizable and selectable.   


    It haandles everything from event handing, animating, and Ajax without actually specifying the javascript functions at each element level but by just binding using a selctor using id, class, or at any other attribute.


    JQuery is way too powerful and helps to creating rich web interfaces very rapidally. 


    For what i used to write a cumbersome code like, 

     document.getElementById("x").xxxxx


    in JQuery,
    --> $("#x").xxxx


    To make element draggable,
        $("#x").draggable();


    To make element resizable,
        $("#x").resizeable();




    $(".icon")
    .bind('click',function(event) { ... }


    And all elements with class="icon" will be bind with onclick = function


    $(".icon").hover(function() { ...}


    similarly, for hover ....




    Ajax is as simiple as this,
    $.ajax({
       url: "member/chat",
       cache: false,
       type:"POST",
       data:myparam,
       success: function(data) {
           $(msgWin).html(data);
       },
       error: function(xhr, ajaxOptions, thrownError) {
         alert("An error has occurred");
         alert(xhr.responseText);
         alert(ajaxOptions);
         return false;
        }
    });
       
    and much more.... http://docs.jquery.com/Main_Page




    If I remember, Google Web kit, many Java frameworks tried to solve this problem by creating a cumbersome framework which will allow java programmer to create interfaces which will create javascript transparently. I always found them problematic. I had always preffered to code my client interactions in Javascript.


    With JQuery coming in, I think those frameworks are redundant. 


    CSS3
    Other thing, I used in my project was CSS3. I am really amazed at what is being made possible by CSS3. I could provide shadow, round rectangles, skew rectangles, transform, translate, animate etc. 
    I do not think I would need to use images to so any effect, I can as well do it using CSS3.


    I was surprised at the power of CSS3 of making so many things possible which I never thought is possible in Web pages.




    JQuery and CSS3 are 2 technologies which I will recommend for anyone to learn as they will definately shape how the web pages  will be created in future. I definitely am a fan of both of them.

    Tuesday, September 7, 2010

    REST & SOAP

    SOAP

    SOAP has been the protocol in use for making the web services. SOAP which stands for the Simple Object Access Protocol was designed to convert the OOP's (Object Oriented programming) Objects to be transformed over network using XML.
    So it is a direct logical descend from the OOP world where SOAP are the objects which are passed across between RPC calls.

    RPCs are exact match for the Object method calls. They were promoted to allow the transform the OOP design wihtout much change to distributed architecture over network.

    However, this exact thinking needs to be avoided in a distributed architecture. People tend to abstract the location aspect of distributed objects. In any distributed architecture the frequent expensive network calls leads to latency and degraded performance.

    Hence, the case of making web service using SOAP using the RPC style Vs Document style.

    The SOAP with Document style web services do not exposes the several methods with many parameters but single method with large document.
    Example-

    SOAP RPC wil be like -

    CreateOrder(int Order#, String OrderType, String CustomerNAme, Orderline orderline1...

    SOAP Document will be like

    CreateOrder(Document OrderDocument)

    SOAP RPC style makes it very difficult for clients because they have to deal with so many parameters to use and maintain and, their types.
    It also makes it difficult for future changes because in case new field is added then the method will change, or change in type of the parameter also causes problems.

    SOAP Document style provides the XML format in which client can provide his data. He has to provide just one parameter; the order document.
    It also solves the problem of the future by allowing any changes to be made like adding new fields or change in field types inside the document.

    SOAP RPC however is much used because of ease of development because of no requirment of thinking or design. One-2-One Mapping with old techniques of Objects in OOP makes it so easy.

    The tools also promotes SOAP RPC because of easy automation of converting the methods by straight forward conversion to soap, hence is preffered by developers.

    REST

    REST has been lately been preffered protocol for making web services. REST is applying the HTTP methods (GET,POST, PUT and DELETE) on the objects and entities as they have been applied to the HTML pages.

    HTTP few methods (GET, POST,PUT and DELETE) is the secret of making it so popular and success of the internet by allowing a simple browser to be able to handle HTML pages by just 4 verbs(methods).

    It works on the principle-
    There are only 4 things which can be done on an entity like say ORDER

    GET RDER
    POST ORDER - change the order
    PUT ORDER - Add an Order
    DELETE ORDER - Delete Order

    ORDER changes its state based on the method acting on it. And these verb returns the representational state of the entity (as describe by the URI) as HTML resouces like Web pages, images etc.

    REST simplicity is its power by allowing just few verbs(manageable by internet agents like browser to process) as aginest SOAP which introduces hundereds of methods thus making so unmanageble and requires manual intervention.

    REST usage in architecture is however recent. There are strategies and best practices which needs to be developed to popularize REST and give confidence to people to be able to use REST actually in spirit and not like transformed version of older technologies.

    A for the other concerns like security, REST based on HTTP protocol would be implementing security very similar to how WEb pages is implementing it. It depends on the Server implementing the security on access (for GET, POST, PUT and DELETE) on enities.

    Monday, June 28, 2010

    Security

    • Security is providing access to the information based on the credentials (authentication / authorization).
    e.g  I should only be allowed to open my account using my password. I should be allowed to view required report related to me not other bank reports.If the credentials are not right the information is kept confidential and not allowed access.

          However, security is also ensuring that information is secured even in exchange and not allowing any information leakage (confidentiality) and information tampering (integrity).
    • Confidentiality services restrict access to the content of sensitive data to only those individualswho are authorized to view the data. Confidentiality measures prevent the unauthorized disclosure of information to unauthorized individuals or processes.
              e.g. When I am sending the username/password using browser over network somebody   should not be snooping to read it and later do transaction posing as me.

    • Integrity services address the unauthorized or accidental modification of data. This includes data insertion, deletion, and modification. To ensure data integrity, a system must be able to detect unauthorized data modification. The goal is for the receiver of the data to verify that the data has not been altered.
    Ex- I transferred money in my own account but in transit someone changed the account number to his own.

    • Non-repudiation services prevent an individual from denying that previous actions had been performed. The goal is to ensure that the recipient of the data is assured of the sender’s identity. Security is also assigning responsibility/accountability of action (non-repudiation)
    e.g :- After transfering his money person should not say that his where his money go becuase he did not transfer it but it someone else. 
    • Availability Security is also allowing information access at all times (availability) for right people. Availability services prevents the services getting down due to threats like Denial Of Service (DOS) attack.

    • Integrity
    • Confidentiality
    • Identification & Authentication
    • Non-repudiation
    • Availability

    Information Security framework can be categorized in 3 main tenants:

     
    1. People, this is usually in terms of security awareness spread among the employees, NDA (Non Disclosure agreement), Security certifications; ISBS
    2. Technology
      1. Preventive: Security infrastructure comprising of Firewall, DMZ, anti-viruses, VPN. This is defined by the deployment architecture. Comprehensive "Threat modeling" is done which analyzes all threats dividing the architecture in zones, “Asset Classifications” and then necessary means of preventing/mitigating those threats. These threats can be at hardware levels like operating system hardening, open ports etc, Or these threats can be at software or application level like SQL injection etc. It can also be at level protocols; http, https ...
      2. Detective: Although, preventive measure are quiet strong, there needs to constant monitoring on the security breaches and attempt. Event relation tools, regular vulnerability scanners, port scanner, investigative tools etc. needs to be running to catch and fix loopholes in security.
      3. Corrective: In case of any security breach is caught, the threat must be immediately plugged. Unnecessary ports needs to be close. Virus removed, threats mitigated. 
    3. Processes help to implement the best practices for managing the security. 
      1. Preventive: It could be hardening guidelines, Information security policy, change management like process for changing the passwords, encoding key etc. It could also be code review, vulnerability scanning tools, ISMS etc.
      2. Detective: Process also needs to measure and monitor the security aspects in term of audit, metrics and Assessments. 
      3. Corrective: In case of any security breach, there needs to be processes for mitigating, and changing the process for filling the new gaps, adoption of new technology.

    Sunday, May 16, 2010

    Environment for Software Development

    The application during development has to go several phases in the SDLC. So large projects usually have several independent environment for different users, so that they can work on their phase independent of each other.
    Environments:

    Development Environment : Developers use this environment to code and work on the application to add new features, fix bugs reported by testers etc.Development environment is usually separate for each developers. It facilitates the developers to work on his code and restart server or database as many time as required without hindering development of other developers.

    The caching is usually disabled becuase developer needs to see changes of his code and hence the latest page. He also needs to get maximum information from exceptions and erros thrown.

    Test Environment : After developers have developed thier module and unit tested it. It moves into test environment. Testers use this to test the application automatically or manually.
    In case the module fails it moves back to Development Environment for developers fix the bugs. If modules passes this testing it moves to staging environment.

    Test Environment is also usually separate for each testers or automatic test environment. It needs to facilitate reloading data and starting from point required by the testing scenario.
    His environment should match the Production to get the view seen by the end-user.

    Staging Environment: Customers use this environment to test the features of the application and report bugs. In case of problem, issues are logged and reported to developers for fixing the code which may be in fixed modules or related module.

    Module only after passing the acceptance testing by the customers moves to the production.

    Staging Environment is also usually separate for each testers or automatic test environment. It needs to facilitate reloading data and starting from point required by the testing scenario. His environment should match the Production to get the view seen by the end-user.

    Producton Environment: Production environment is used by the actual public or end-users. It is working with live data. Module after passing all kind tests can move to this environment so that there is minimum risk of failure.

    This environment has all optimization enabled, caching enabled , only error logging at server level, customized exception understandable to the end-user, load balancing, scalability , firewall etc. all are enabled properly configured.


    Saturday, May 15, 2010

    Technology Stack in Market

    Technology Stack

    For building any application Web or Windows from scratch requires a technology stack. Most popular technology stack can be divided into 3 main groups:

    1) Microsoft Technologies
    a. .Net Technologies which support building Windows and Web application
    b. .Net CE (Compact edition) for embedded and mobile applications.
    c. Classic Windows C++ legacy for windows applications, components and device drivers

    2) Java Technologies which is supported by big non-Microsoft vendors like IBM, Oracle (includes Sun and BEA), JBOSS
    a. JEE Java Enterprise Edition for building Windows and Web application
    b. J2ME for Mobiles
    c. Java Card etc.

    3) LAMP which includes (PHP, PERL, Ruby, and other RAD scripting) getting very popular for web systems because of open source supported community , fast development and easy learning path.

    These technology stacks are being supported by available industry framework for fast track development and has built-in best practices. These are very important to add to your skill because they are now integral part of any application development large project development.

    Frameworks

    1) Microsoft Technologies
             a. Enterprise blocks, OpenMVC framework for (MVC), NHibernate for ORM
    2) Java Technologies
             a. Hibernate, Spring, Struts, JSF etc
    3) LAMP Technologies
             a. Symfony, Zend

    Development environment: includes tools for development of large project. These again are very important for skill and development in large projects.

    1) Microsoft Technologies
           a. IDE - Visual Studio for Integrated development. It is must know in Microsoft technology.
           b. Version Control - Visual source Safe is used for synchronized development of projects, modules in a large team. No large project can be successful without it.
           c. Auto Build/Deploy – is usually done by using scripts like nmake.
           d. Code checker – Like FxCop
           e. Tools for checking security -
           f. Code Generators – Like CodeSmith
           g. Testing Tools – like ACT, nUnit etc.
          h. Profilers

    2) Java Technologies
            a. IDE – Eclipse/NetBeans for Integrated development. Eclipse is must know in Java technology.
            b. Version Control – CVS, Subversion. They are technology independent and can be used for any type of code.
            c. Auto Build/Deploy –Maven, Ant. CruiseControl for auto build.
            d. Code checker –
            e. Tools for checking security -
            f. Code Generators – AndroMDA etc.
            g. Testing Tools – like JUnit etc.
            h. Profilers : JProfiler

    3) LAMP Technologies

            a. IDE – Eclipse.
            b. Version Control – CVS, Subversion. They are technology independent and can be used for any type of code.
            c. Auto Build/Deploy –Framework like Symphony provides this.
            d. Code checker –
            e. Tools for checking security -
            f. Code Generators – Framework like Symphony provide this.
           g. Profilers
           h. Testing – Selenium, PHPUnit etc.

    Products: Vendors in this market are also coming out with many products in horizontal as well as verticals space to fast track the people requirements. Some of these product are tied to the technologies some are not.

    1) Horizontal products are not specific to any domain but utilized across domains for building scalable, high performance applications.
           a.Application Server : They are used for deploying large scale application because of out-of-box     functionalities like scalability, clustering, deployment, caching. Ex – WebSphere, Web logic, JBOSS AS,
           b. Databases: Persistence requirement.
           c. Reporting: Reporting requirement.
           d. Portal Server: For building portals by aggregating from smaller parts.
           e. Content Management System: For managing content i.e text, digital media like audio, video etc. It also has component like Web Content Management System, workflow for document work flow. Also comes by name of ECM (Enterprise content Management), WCMS, Digital Content Management, and Document Management System.
                  i. Microsoft ‘s Sharepoint, Documentum , Interwoven, OpenContent
                  ii. Alfresco, Drupal etc.
           f. Data warehouse /BI: For building data warehouse for data mining and business intelligence for decision making. Ex – Cognos, WebMethod, SQL Server DW etc
           g. Enterprise Service Bus: For building SOA architecture, integrating multiple technologies. Ex - Biztalk, Aqualogic Service Bus, IBM WebSphere ESB , Oracle ESB, JBOSS ESB etc.
           h. Security and Identity Products: For providing security needs for the application like User Database. Forefront Identity Manager, Sun Identity Manager etc.
            i. Virtualization: Fro deploying application in virtualized environment. Ex- Microsoft VM, VMWare etc.

    2) Vertical products are for specific domains. Like education, e-commerce etc.

    a. Commerce Server: For building commerce site. IBM Websphere Commerce, Microsoft’s Commerce Server, SAP Ecommerce etc.

    b. CRM : For building Customer Relationship system in a company. Ex- CRM Dynamics, Siebel etc.
    etc.

    Combination of all above makes up the major S/W technology stack. Technology, Frameworks and Development Processes and Tools are very important skill required of any Developer.

    Friday, March 19, 2010

    What is MVC pattern?

    This blog is in response to people asking me question to explain MVC pattern.


    I don try to explain MVC in terms of standard talk of Model, View and Controler and how they interact.

    MVC pattern is example of seperation of pesentation from content (decouples models and views)to allow multiple presentations to a same data.
    MVC pattern or Microsoft Document/View patten in MFC all are example of this decoupling of tasks of content storage, presentation and content changes.

    In Document/View pattern Document represented the data and View represented the presentation of that data. Document/View allows multiple views of the same data. So same data could be seen simultaneously in spreadsheet form, and a chart.

    When a user updates one of the views, all the document's views are notified of the updation, and each view updates itself using the latest data from the document. Soething like observer pattern.

    MVC brings in one more component in this, i.e Controller, which decouples Model and View by one more abstraction by means of handling user interaction for changing the model.

    MVC also similar to Dcoument/View implements the Observer pattern where multiple Views subscibes to Model, any change in the model by one view is transmitted to other views to update itself. However, this subsciption and notification for update is not so straightfoward as in client-server model.

    Hence, in web it occurs by means of controller taking changes from screen, updating appropriate model and then displaying screen with updated model.

    There is also MVC-I & MVC-II, MVC-I was the old model where there was not any controller but jsp/screens directly interacted with models by means binding, bean iterator etc.

    MVC-II brought in Controller, where screen does not directly talk to model but through controller.
    Controller also forms important part of web development because controller is the one which handles Get and POSTS request by means of form/view submission. Front Controller can take in request from multiple forms and dispatch request to appropriate models. And returns the appropriate view to the user. Front controller allows the easy management/coordination between multiple pages and models.