Skip to content

Instantly share code, notes, and snippets.

View rajendrauppal's full-sized avatar
:octocat:
Engineering Leader and Architect

Rajendra Uppal rajendrauppal

:octocat:
Engineering Leader and Architect
View GitHub Profile
import java.io.Serializable;
// 1. Implement Serializable interface
public class User implements Serializable {
// 2. All attributes must be private
private int id;
private String name;
// 3. Should have a no argument public default constructor
@rajendrauppal
rajendrauppal / CarBuilder.cpp
Created November 30, 2013 05:14
Car builder example of builder design pattern
/*
* Example of Builder design pattern.
* Copyright (C) 2011 Radek Pazdera
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@rajendrauppal
rajendrauppal / ActionFactory.cpp
Created November 28, 2013 21:06
Real world example of Factory method pattern. Depending on the platform, client may request ActionFactory for either the DMGMountAction object or ExtractZIPAction object.
/*
The MIT License (MIT)
Copyright (c) 2013 rajendrauppal
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,