Posts

Symfony HTTP client

 I am currently developing a very simple app which offers you the possibility to create question-answer flipping cards, creating thus some kind of funny Trivia to practice on any topic you want to apply it to. As a user, you create first the question-aswear entities which also include  category field, and then you can practice them in the playground area, which shows you the question on a hoverable flipping card. It also offers you a textearea which disables 60 seconds after you start typing on it, so that you can write down your answer before actually flipping the card and getting to see the correct one.  In this app, though simple, I wanted to keep a client-web service architecture from the very beginning. The web client contains the views and communicates with the API, which contains the data through Ajax calls. This was working consistently so far. An example of the creation and saving of new question-answer items is: When I press on "Create new question" button, I am...

GIT: Team Work and Workflow, Git Flow, Github Flow, GitLab Flow

Team Work The Pull Request This is used in order to contribute to projects when you don’t own them and, therefore, lack the necessary permissiones to push your commits and contribute to the project. Or in other words,  it's a request from the owner of a repository fork to the owner of said repository to incoporate all commits included in said fork into the repository.  Real life case I discover a bug in a repository I don’t own. I want to modify it but, as I don’t own it, I will need to follow a series of steps in order to suggest that change:     1. Fork the repository in order to have it in my remote (this will clone the repository into my remote)     2. Clone repository to my local     3. Make relevant changes      4. Commit     5. Push (this will push changes from my local repository to my remote repository for which I have the necessary permissions)     6. Pull request will tell the owner of the repository t...

GIT: Cheatsheet Part II

Image
 

Sass - variables, partials, mixins and extends

Probably if you are into Front End you have come accross this acronym before, but what does it stand for? It is probably one of the funniest acronyms I've ever found withing web development: "Sintactically Awesome Style Sheet" .  Enough with jokes, let's talk about what it really is: an extension of Css which simplifies style sheets syntax to allow you to write cleaner, more understandable, easy to modify or adjust Css.  First of all, there's two ways of writing Sass: SCSS (Sassy CSS):   .scss extension files written with css syntax. Indented:  .sass extension files which replace brackets with indentation. It is not fully compliant with CSS but it's quicker.   Basically, once you set up your project to use Sass, a .css file will be created together with a .scss. Whatever you write in your Sass file will be translated into the .css file. What is the main advantage of this? .scss files are easier to read thanks to the use of some features, therefore they are fas...

GIT: Introduction to basics and cheat sheet

Image
 

SOLID: The Interface Segregation Principle (ISP)

 Uncle Bob describes it as: "The ISP acknowledges that there are objects that require non-cohesive interfaces; however it suggests that clients should not know about them as a single class. Instead, clients should know about abstract base classes that have cohesive interfaces." After reading several documents and watching endless videos on this subject what I understand is that interface clients should not be forced to depend on methods that it doesn't use (giving those methods a null value).  Or in other words, it makes no sense to force a client to have a list of methods which return false, null or throw exceptions. Let's have a look at an example <?php // Interface Segregation Principle Violation interface HospitalFunctions { public function canGiveDiagnose (); public function diagnose (); public function administrateIVMedicine (); } class Doctor implements HospitalFunctions { public function canGiveDiagnose () { re...

SOLID: The Liskov Substitution Principle (LSP)

After a week of holidays, here I am again, back to coding and learning. I really needed a rest but, on the other hand, after a couple of days, I was missing  my computer to bits. ¡Already the third letter of SOLID! Let's get into it. This complex to understand principle can be described as follows:  "If s  is a subtype of t , then we should be able to substitute objects of type  t  by objects of type  s   without altering the properties of the program."  In other words, it is possible to substitute a given object with an object of a sub-class and expect it to react the same way and fulfill its contract . But as usual, it is easier to understand if we have a look at a code snippet. Imagine our app currently sends all of our Notifications through Plain Text Email through SMTP.  Our code would look something like this: <?php $emailMessage = new EmailMessage( 'Laura' , 'New Blog Post' , 'Hi Laura, ...' ); $smtp = new SMTPTransport ( 'sm...