I want to know if any OOP concepts are followed in front end languages .
Does in Angular 6, we have a concept of Polymorphism?
Any example and theory will work. I just need to understand whether there is any concept of Polymorphism in Angular 6.
Not in Angular 6 itself, but in the language TypeScript that is used by the framework. You get polymorphism via sub-typing and type inference.
Related
I have been given a programming project. One of the criteria for being marked is
"Complex user-defined use of objectorientated
programming (OOP) model,
eg classes, inheritance, composition,
polymorphism, interfaces"
I am thinking of building "a website with dynamic content driven by a database back end". However, I don't see where I could incorporate OOP into a website. Is it possible to do so? Should i just switch to making an app instead?
If you implement your web site based on Java (Java EE or Spring Boot), C#, Pyhon, the of course you will have to do with OOP.
If you are planning to do a backend and a database ,you are most likely to use PHP and PDO/mysql/ respectively. And in OOP PHP you are definitely going to get what you are looking for like creating clases and as such. For example take a look at the example below taken from a PHP 5 manual:
<?php
class Foo {
public $aMemberVar = 'aMemberVar Member Variable';
public $aFuncName = 'aMemberFunc';
function aMemberFunc() {
print 'Inside `aMemberFunc()`';
}
}
$foo = new Foo;
?>
To make it easy you'll prefer to rely on MEAN stack ,
MEAN is a framework for an easy starting point with MongoDB, Node.js, Express, and AngularJS based applications ,
Because AngularJS depends on OOP and you can mange your database by using MongoDB
but if you want builld just website python is good chosen and it is OOP
In Laravel I am used to define my models up front and to perform all actions on them.
However, it seems that most frontend frameworks just use whatever an API reponse provides and store the json data into simple arrays.
The only framework that I found using the model approach is Ember. I am missing this structure in the vue docs. I wonder why nobody seems to care about models. Are they just not that important in the frontend world?
Using models in frontend frameworks is not that common due to JavaScript as a language. There are many benefits to strong typing, which is why there are nowadays multiple ways to add typing to the language.
Vue has support for TypeScript which is a common way to define models in your JavaScript. TypeScript let's you define interfaces with certain types, so that you know that the data you have conforms to your model.
That's where TypeScript comes in handy, Vue supports it, I don't know much about ember but I've found this and Angular has it out of the box. As far as I know backend developers learning front end technologies like Angular and TypeScript over other options because of the coding style.
I know there are languages for functional programming (LISP, Haskell, etc.) and OOP programming (Java, C#, Ruby, Python, many more), but are there any that are made around the concept of Entity Component Programming?
I'm in no way an expert on entity component development, but after skimming through both of these articles:
Article on GamaSutra
Why use an entity system framework for game development?
It seems to me that an entity is just something that stores data, and then you do operations on that data. Assuming that I'm correct in my understanding this means that you can choose any almost any language you want. But entity component programming in and of itself does not use objects, which might make high-level languages like C#, Java and even C++ overkill. However I'd think that C or Go would be perfect languages for this type of programming because then you could define structs and methods that operate on those structs. I'd go with Go only because it's sexier.
Now I haven't answered your question, but from my research all I could find was this language which I have no idea if it is openly available or not:
ComponentJ article
I think it would be easier to just use a framework for one of the popular languages instead.
In the recent question "How to organize MATLAB code?" Andrew Janke mentioned in his answer using classes to organize MATLAB functions into packages:
... consider rewriting some of the code as objects, using stateless utility
classes with class methods and private functions as ways of packaging related
functions together and providing some encapsulation. ... In
classic MATLAB, classes are your only way of doing some sort of packages.
Would you please provide more information on it? Links, code examples to understand the concept.
Loren hosted a guest blogger to discuss this issue:
http://blogs.mathworks.com/loren/2008/08/18/when-to-create-classes-in-matlab/
I made a simple video about this:
http://blogs.mathworks.com/videos/2008/07/07/advanced-matlab-class-system-for-oop-in-matlab-introduction/
Of course the MATLAB documentation for this:
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brh2rgw.html
Don't use classes for packaging
Classes in Matlab has known limitaitons (starting with performance scalability, etc).
Before going into using OOP in MATLAB, first learn "+" packaging (i.e. not "#" or handles).
Statements like import foo.bar work just as expected (also check this).
A word of caution: if you really need OOP, just consider picking another language before doing it in MATLAB. I had to rewrite my OOP MATLAB code back to functions and packages because OOP implementation by Mathworks is just "immature". First troubles start with parfor where stuff has to be serialized with an overhead and then still breaks way too often.
as a Mac outsider it seems that two popular programming languages on the Mac appear to be Objective C and Ruby.
From what I understand the main API Cocoa seems to be written in and optimized for Objective C, but it is also possible to use Ruby for that.
Are there different areas where each language is ideal, for example, I could imagine Objective C could be ideal for a GUI layer, or standalone desktop app, and Ruby could be good for web services etc. What about classic business logic, or data access layers?
What language would be a good choice for a library of services for example? Can we write a library in one language and link to it from a main program written in the other language?
If I wanted to write a layered enterprise application using domain driven design and dependency injection which languages could support each concerns? Are things like DDD and DI common amongst Mac devs?
Just a curious outsider.
If I were to write a big application, I would stick to Objective-C only. It’s not hard, it’s the most supported option and for the foreseeable it will stay that way. As for Ruby, there used to be Java support in Cocoa that does not exist anymore. I’d hate to have a large legacy application written in mixture of Java and Objective-C and having the prospect of rewriting the Java parts or sticking with older OS.
(The previous paragraph applies to writing pure desktop applications. If you wanted and could write a part of the application say as a local webservice it would be quite different, as the Ruby support there would be much more dependable. Depends on your people, experience, goals and other variables.)
Dependency Injection and DDD are both abstract ideas, so yes, you can certainly do that in Cocoa. I have no idea about how many Mac devs do it. As for DI, there is strong support for loose coupling in Cocoa and the whole technology stack (see Interface Builder, KVO/KVC or bindings).
Hope that helps.