The difference and relationship between concept Job and Framework - openpai

I don't find a logic model document for the concepts of OpenPai, after reading some codes, I think the Job is as same as the framework? The job is the user faced concept while the framework is the internal name. Am I correct?

Yep, you can consider the job concept is the same as framework concept.
The framework (and task) concept is aligned with the same term in Mesos.
And in FrameworkLauncher(the PAI backend), we only have the framework concept, and in other places in PAI, we also used the job concept for user to easy understand.
For more details on FrameworkLauncher concept, please check:
https://github.com/Microsoft/pai/blob/master/frameworklauncher/doc/USERMANUAL.md#Concepts

Related

Why was cakePHP designed to use Inheritance over Composition even though it's mostly considered a bad design?

CakePHP Applications being made in our company tends to become unmaintainable as it becomes more complex. I figured that one specific reason is inheritance which makes the functions in child classes depends a lot on it's parent classes and vice-versa (implementing template method pattern). Why is CakePHP designed this way and not friendly in using Dependency Injection, Strategies, or Factory patterns?
There is not such a bad design as you claim in the framework. Sure, there are probably things that could be done better but I would like to see a more substantial critic including solid arguments and examples. I assume you're not using the framework as it was intended.
Let me quote the first paragraph from this page.
According to Eric Evans, Domain-driven design (DDD) is not a technology or a methodology. It’s a different way of thinking about how to organize your applications and structure your code. This way of thinking complements very well the popular MVC architecture. The domain model provides a structural view of the system. Most of the time, applications don’t change, what changes is the domain. MVC, however, doesn’t really tell you how your model should be structured. That’s why some frameworks don’t force you to use a specific model structure, instead, they let your model evolve as your knowledge and expertise grows.
You're not showing code (for a reason?) so I guess your problem comes from stuffing everything into the table objects in src/Model/Table/ or doing something similar.
But you're totally free to create a folder structure like
/src/Service
/src/Model/Domain
and then simply instantiate services as you need them in your controller actions. A service could be for example \App\Service\User\Registration and using objects from App\Model\Domain\User.
I agree that the framework in fact doesn't provide any recommendation or template structure for how this could look like. For exactly this topic there is a discussion going on here. Because of a lack of such a structure I've started working on a plugin that provides this. The plugin doesn't require but suggest the usage of DI containers for the people who want them.
Given the whole fancy topic around DI and DDD so far I would say there is not the one way to get things right but different paths as long as the code is easy to maintain. And honestly, as long as this goal is archived I really don't care about how you call it. :) I think many people tend do make this topic to academic instead of simply trying to be practical.
Not everybody is even needing that structure. It depends on if you're building a RAD CRUD application or a more complex app. Not every application needs a DDD approach. There are so many shades of gray when it comes to design the business layer, no matter how the framework would do it, somebody would always complain about it.
I personally almost never missed a DI container in CakePHP, not even in the biggest project having more than ~560 database tables which was a hospital management solution and it just worked well.
I would suggest you to ask a more specific question about your approach how you structured your code and showing your structure and code and then asking for advice on how to improve it instead of blaming the tool you're using in the first place without providing context.
Unfortunately CakePHP v3 can not compare to the Zend3/Laminas, Symfony or Laravel.It is 7-8 years behind the other frameworks.If you are using cake for years or it is your 1st and last framework it is normal to not realise that.But if you have to use it after Zend 3... cake seems like really bad ecosystem.
Bad documentation
Bad ORM
Poor Routing system
Bad Templating engine
Bad idea to mix Data Mapper and Active Record
DIC is totally missing
Components - not good but not terrible
...
And many more thinks that should not be underestimated like - lack of GOOD tutorials, pluigns/addons/packages
The above thinks make developers to follow bad practices that adds a lot of technical depth.
If you care just for - it works! But not how it works and why it is bad, cake will fit ok for you.
Cake can not scale as good as Symfony/Laminas if you are doing big project.(yea AWS/GC can help for scaling a lot of thinks but not for scaling source code)
Cake doesn't allow you rapid development like Laravel/Symfony for decent project.
I'm wondering who and WHY would start a new project today using Cake as it has zero benefits over the other frameworks.
Probably only devs who used only Cake for last decade and do not want to start learning new technologies or devs that thinks SOLID is just a fancy hype with zero benefits like design patterns, DRY and KISS
CakePHP framework supplies user interaction with databases using Active record, it means that exist a high coupling between business layer and database layer which has negative effects in unit testing and because of that the framework is not friendly with Dependency Injection. The same issue happens with Factory pattern, high coupling mentioned before makes more difficult use simulated objects in unit testing.
Hope it helps!
Alberto

ASP.NET MVC4 n-Tier Architecture: best approach

I developing a 3 tier architecture for an MVC4 webapp + EntityFramwork5.
I want to keep separete the layer, so only DAL knows that I'm using EF, for example.
Actually I have a lot of classes to manage that:
DAL
Entity POCO
Entity DataContext : DbContext
Entity Repository
BL
Entity ViewModel
Entity Service(instantiate Entity Repository)
WEB
Entity Controllers (instantiate Entity Service)
This is working but is quite hard to mantain. I was thinking to remove the Entity Repository in DAL and use directly the DataContext (if I'm not wrong, after all DbContext has been desingned to be a Repository and a Unit of Work), but that will force me to add a reference to EntityFramework.dll in my BL. Is not a big issue, but I0m not sure it is the best choice.
Any advice?
(I hope I gave enough informations, if you need more, just ask)
You can use this this and this article.
An experienced Architect does not need to go through every single step in the book to get a reasonable design done for a small web
application. Such Architects can use their experience to speed up the
process. Since I have done similar web applications before and have
understood my deliverable, I am going to take the faster approach to
get the initial part of our DMS design done. That will hopefully
assist me to shorten the length of this article.
For those who do not have experience, let me briefly mention the general steps that involved in architecturing a software below...
Understand the initial customer requirement - Ask questions and do research to further elaborate the requirement
Define the process flow of the system preferably in visual (diagram) form. I usually draw a process-flow diagram here. In my
effort, I would try to define the manual version of the system first
and then would try to convert that into the automated version while
identifying the processes and their relations. This process-flow
diagram that we draw here can be used as the medium to validate the
captured requirements with the customer too.
Identify the software development model that suite your requirements
When the requirements are fully captured and defined before the design start, you can use the 'Water-Fall' model. But when the
requirements are undefined, a variant of 'Spiral' can be used to deal
with that.
When requirements are not defined, the system gets defined while it is being designed. In such cases, you need to keep adequate spaces
in respective modules, which later expansions are expected.
Decide what architecture to be used. In my case, to design our Document Management System (DMS), I will be using a combination of
ASP.NET MVC and Multitier Architecture (Three Tier Variant).
Analyze the system and identify its modules or sub systems.
Pick one sub system at a time and further analyze it and identify all granular level requirements belonging to that part of the systems.
Recognize the data entities and define the relationships among entities (Entity Relationship Diagram or ER Diagram). That can
followed by identifying the business entities (Some business entities
directly map with the classes of your system) and define the business
process flow.
Organized your entities. This is where you normalize your database, and decide what OOP concepts and design pattern to be used
etc.
Make your design consistent. Follow the same standards across all modules and layers. This includes streamlining the concepts (as an
example, if you have used two different design patterns in two
different modules to achieve the same goal, then pick the better
approach and use that in both the places), and conventions used in the
project.
Tuning the design is the last part of the process. In order to do this, you need to have a meeting with the project team. In that
meeting you need to present your design to your team and make them ask
questions about it. Take this as an opportunity to honestly evaluate/
adjust your design.

Modeling business procces, which techniques are there?

I'm not sure if this is the right place to ask this question but here goes.
I'm currently looking into some different techniques to model a business proces. I need to find a suitable option for my company which develops all kind of web applications.
What i have found so far:
UML, specificly the activity diagrams
Flow charts
Windows workflow foundation
Business process modeling
I had a dive into the world of workflows but it's mainly about automating a process of a company and thats not what I'm looking for. My focus is on software and the process within.
If anyone else knows some other technique or can tell me the advantages or disadvanteges of the techniques I allready found that would be much appreciated because I'm a little stuck right now.
Right now BPMN (Business Process Modeling Notation) and UML activity diagrams are the two most popular options for that.
I think of BPMN as the right choice when you are modeling the business aspects of the organization and move to Activity Diagrams as soon as you drill down to the technical design of the software system (as a core component of the UML language, activity diagrams are a better fit when having to combine workflow information with other views of the system, expressed also as UML diagrams like class diagrams or sequence diagrams).
Note that now a UML profile for BPMN is being created which means that you will be able to mix BPMN and UML diagrams in the same project
I suggest you consider ISO/IEC 24744. It will give you a very different perspective, since it does not use the ubiquitous "organisation as machine" metaphor, going for a more opportunistic, people-oriented viewpoint.
In other words, ISO/IEC 24744 does not represent a business process as a workflow where the process to follow is the driver. Instead, a business process is represented through the work products that are involved and the people that act upon them. The process performed plays an important but secondary role.
If you are interested in why this is so, or what the advantages are, let me know and I'll be happy to elaborate.
I think you are asking about transforming your business requirements/rules into technical requirements and then into a design? After that you will implement this design into code.
Am not sure if this is what you are asking about..

Rapid Application Development Or Good Programming Practice? Which one do you choose

Are ORM frameworks such as Entity Framework, Linq to SQL, Subsonic, NHibernate promote good programming practice or just a tools to speed up the development?
Should we used this technologies inside the presentation layer?
They can do both. With any techlonogy there are good practices and there are bad.
ORM Frameworks can or cannot speed up development, a good design has more impact on development time than the tools used. The advantages are getting all you business logic in one place and removing it from the data portion.
I would not use them in a presentation layer, but have you presentation or UI layer call a business layer which would call a data layer.
Rapid Application Development always.
As a freelance contract programmer my ability to satisfy clients is directly related to my productivity. On any new job I generally have a few days, at most, to show some kind of results. So I'm entirely oriented towards finding and using the best tools to help me produce good programs in the shortest amount of time.
Within that constraint, I hope I pay attention to good programming practices. By the best practices in the world are no good to me, or to my client, if the project is abandoned or given to someone else while I'm still modelling or refactoring.
Usually both. Sometimes you might want to write your sql by hand, but most of the time defining a model using any ORM framework will allow your object flow in your application to flow better.
Which 1 is correct?
Design 1
+Presentation : *BLL
+BLL : *DAL
+DAL : *ORM Framework
Design 2
+Presentation : *BLL
+BLL : *DAL, *Framework
Design 3
+Presentation : *BLL, *ORM
+BLL : *DAL, *ORM
+DAL : *ORM Framework
+projectname
*reference
if none is correct please post your design..

NHibernate and Spring.NET Combination really helpful in the enterprise level application!

What are the opinions of the software developers who have used Spring.NET and NHibernate in their projects? In couple of our projects in the company where I work, we have used these third party tools very extensively and we have gained tremendous productivity. A little caveat is that it is a little challenging for junior .Net Developer to grasp the concept.
Imo, Spring.Net and NHibernate go hand in hand: If you master the learning curve you will be very pleased when Spring is used for (almost transparent) transaction handling for NHibernate, Dependency Injection as well as Db:Provider handling.
NHibernate (or similar ORM's) can be extremely helpful with "greenfield" development, where the domain object model can be designed properly, and then the database schema and NHibernate mappings can be code-generated to match the model. On the other hand, NHibernate can be very tough to apply to a legacy or poorly normalized database. Although it has support for handling some unusual data structures, the learning curve is much higher for those techniques.
I can't say much about Spring.Net except that in 2007, our team tried to implement it into an existing, complex solution to handle DB transactions and entity validation, but we scrapped the idea after a week of work. Our resident Spring/Java expert concluded that Spring.Net was a couple versions behind Spring and wasn't mature enough to handle the use cases in our project. Disclaimer: not sure what version of Spring.Net that was, so things may have improved recently.
There has lot of benefits using spring.net/nHibernate.
For data access you are able to take full advantage of nHibernate ORM with lazy loading, database independent programming, easy save load update delete your entities. No need to write any query to do that. That is why after designing a database and after development if any change is required at any state of development it is very much easy to change.
Dependency Injection(DI) helps to separate the UI and business logic. That is why any time you are able to change your graphical user interface without breaking any business logic. Same way if you need any change at business logic then need only build business layer. And it is also configurable.
Aspect Oriented Programming (AOP) is another feature of Spring.Net. It helps logging application, dynamic method interception allow more control over method call. It makes easy to authorize application. Declarative transaction management is a nice feature to manage transactions. You do not need to write code for start stop database connection. Just write at configuration file at which method you want to maintain transaction. So at large scale project it will save lot of time and will give you more flexibility over transaction management.
Spring webservice is very easy to write and consume from a client. Not need to add any custom attribute, no WSDL. You can intercept every method call, you are able to add advice like logging advice, authentication/authorization advice.
Overall it save approximately 33% of development time, make application more maintainable, highly configurable.