Skip to main content

Posts

Showing posts with the label Software design

How I solved design problems by using various design patterns in my Laravel Project

Hey guys, Lately I have been working on a Virtual marketplace application using Laravel and PostgreSQL. So, when I was asked to build this huge application, the biggest challenge I faced was the design. Having a fair bit of prior experience in Laravel and upon following the current community trend, I decided to go with Laravel. And I hoped and expected that this, somewhat opinionated framework, would take care of my design to a large extent. When I actually started designing it, I realized that for a small/medium application Laravel already has things in place, you, as a developer just need to follow the guidelines set in place by the framework and use the features its providing out-of-box. However, for a larger application, with lot of interdependent modules and complex business flows, you need to make your own design decisions as well along with the existing features. This gave me an opportunity to take a look into the various existing design patterns to solve my design probl...

The wierd yet awesome world of Javascript!!

Hey, Back, again!! This time we will talk about some weird things which only happen in JavaScript. When I say weird, it means that if you come from a C++ or PHP or JAVA background it will be hard for you to digest that many concepts that we learned for those languages, and then think will apply in all the majority of programming languages out there, don't anymore apply here in JavaScript. A very classical and highly cited example is Objects and Inheritance without Classes, well I never imagined this could be done, but JavaScript does it, that too elegantly. Probably you are already aware that for Class JavaScript uses function(){} and not the conventional OOP Class. Well actually it uses or rather can use function for multiple other uses as well. Lets go through some of the amazing features of JavaScript. Loosely Typed Try this for a function in your browser console - If you look carefully here, func is a variable(in the way it is defined) which is used as a func...

Multi Tenancy with Codeigniter

In this post I will show you how I converted my normal Codeigniter application into a multi-tenant system.(first step to a SaaS implementation) Note - This implementation is a separate DB multi-tenancy implementation. Lets say we have an up and running CI application name ci_app , with the directory structure like this ./application ./application/config ./application/...so many other important directories ./asset ./asset/js ./asset/images ./asset/css ./system ./index.php which is accessed through browser like http://localhost/ci_app So to implement the multi-tenant arch we are most concerned about the following files, and we will be editing them ./index.php ./application/config/config.php ./application/config/database.php And also we need to create a few new ones Create a tenant folder in your www root directory, lets say tenant_1 Cut the ./index.php from ci_app and paste it in tenant_1 directory  Create a blank file config.php in tenant_1 directory ...

Subversion for starters : Trunk, branch, tag how and when to use?

Lets ponder on some details about Subversion to begin with Subversion is a free/open source version control system (VCS). That is, Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data or examine the history of how your data changed Subversion is different as compared to typical file server as   it remembers every change ever written to it —every change to every file, and even changes to the directory tree itself, such as the addition, deletion, and rearrangement of files and directories. Do you need it? If you need to archive old versions of files and directories, possibly resurrect them, or examine logs of how they've changed over time, then Subversion is exactly the right tool for you. If you need to collaborate with people on documents (usually over a network) and keep track of who made which changes, then Subversion is ...

Cohesion and coupling, what are they? And why is one good and the other bad?

Coupling and Cohesion are the two terms which very frequently occur together. Together they talk about the quality a module should have You might have got this advice n number of times that " cohesion is good and coupling is bad ", without actually going into the details as to what they mean and why one of them is bad and why the other one is good. Maybe because the one who is advising is not aware himself of the details and the one who is getting the advice is hesitant enough to ask, or may be they are not able to give good explanation. So in this post I am trying to give a good explanation on both, and hopefully good examples which you can co-relate with incidents and things in your daily life. As usual, lets start with checking what Wikipedia has to say on this On Coupling "In software engineering, coupling or dependency is the degree to which each program module relies on each one of the other modules." On Cohesion "Cohesion is a measur...