Get ready with Application Frameworks
Application frameworks is one of the main module under the Software Engineering specialization at SLIIT campus. This module gives us overall idea about how to become a full stack developer. In this module first lectures covers SOLID principle, some guidelines and software engineering practices.
SOLID are 5 object oriented principles that follow when design a software. They are Single responsibility, Open-close, Liskov substitution, Interface segregation and Dependency inversion.
Single responsibility means having one particular define responsibility at any given level. If you think about a class as long as that class does one thing because of that it is very easy to maintain. If it is doing one thing that it supposed to do there is only one reason for it to change.
Secondly Open-Close principle means open for extension and closed for modifications. When you are defining a class or a method you are closing it for modifications anyone wants to add more features to it be simply need to extend it rather than modify.
Third one is Liskov substitution that means every subclass/derived class should be able to substitute their parent/base class. Child is actually doing what parent is supposed to do with some extra with that given boundary not anything like totally different.
Interface segregation principle means clients should not be forced to implement methods they do not use, basically you have to break your interfaces based on the usage.
Last one is Dependency inversion that typically means higher level modules depends on the business itself. But the lower level modules (DB classes, presentation classes, APIs … ) should depend on these business level modules.
Then we can move to approaching the solution and implementing the solution. We can achieve the solution using Think throughout the problem, Divide and conquer, KISS, Learn specially from mistakes, Always remember why software exists and remember that you are not the user.
When we implementing the solution we follow some guidelines. They are YAGNI, DRY, Embrace abstraction, DRITW, Write code that does one thing well, Debugging is harder than writing code and Kaizen.
Practices are set of guidelines that we should follow when we are developing code. Mainly we have to consider unit testing, code quality, code review, version controlling and continuous integration.
Unit testing is basically pick a unit, unit may be method, class, or API like it could be anything but that boundary clearly defined. Unit test is while we develop the unit we write unit test to test the behavior of the unit. Unit test allow you to find bugs as early as possible.
Code quality means follow the relevant coding standards for relevant programming languages. Our code should be understandable, readable and easily maintainable. Organizations can impose some rules that all the code that is produce from the developers is kind of like a similar manner.
Code review we can use for improve the code. Another developer is looking into another developer’s code with the intension of improving the code.
We can manage and develop our code easily using version controlling. Currently GitHub is one of the main version controlling platform in the industry. Lots of organizations are used that for maintain deferent versions of code and work with multiple developers easily. Also we can maintain code history without losing code portions.
Finally continuously integrate your code in the main branch make sure work as expected. This allows developers to detect issues early.
Second lecture is based on JavaScript fundamentals. Today lots web sites are based on JavaScript and JavaScript frameworks. We can develop full stack application easily only using JavaScript programming language with help of requiring his frameworks.
For example React and Angular are the main frameworks for frontend development and for the backend widely use Node.js with the help of express framework. But before first we have to learn basics of JavaScript language because all of those mentioned frameworks and libraries are based on JavaScript language. JavaScript is interpreted programming language.
We can define JavaScript variable using const, var and let keywords. A const that gets created cannot be changed once you give it a value. Var and let we are able to change its value but they behave slightly different in relation to scope. If you create a variable using var, let or const inside a function they all are local variables they can only be used inside the function. But if you create any of these type of variables outside the function then they are global variables and they have global scope. They can access and used anywhere inside the file. If we create a variable using var inside If block or anything other than a function you can access that var outside the curly braces of the if block.
In JavaScript when we write time consuming code we cannot write that code synchronous way. We have to write that time consuming code asynchronous way. For develop the code asynchronous way we use special feature in java that is call callback. Simply callback is we can pass a function as argument to another function. After the time consuming function finish the work that function send the result back using that callback.
But when we develop big applications we have to manage our functions one after the other. In that situation we can face some issues with this callbacks. That issue we call callback hell. We can avoid that issues using promises. Promise is JavaScript object and that object gives 2 things. They are resolve and reject. If the asynchronous process is success then it gives the result through resolve. If the process have some errors then it give error through reject. Also promises have issues when we develop big applications. Also like callback we can face promise hell when we develop applications. We can avoid this promise hell by using async and await.
