4 replaced http://stackoverflow.com/ with https://stackoverflow.com/
source | link

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?angularjs - Service vs provider vs factory?

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

3 replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
source | link

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper classDifference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

2 Clarifying the confusion around factories and services in AngularJS
source | link

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

I think you may be misinterpreting what a "factory" does in programming.

From Wikipedia

In class-based programming, the factory method pattern is a creational pattern which uses factory methods to deal with the problem of creating objects without specifying the exact class of object that will be created. This is done by creating objects via calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Basically, a "factory" class or method replaces this code:

var x = new Foo();

With:

var x = SomeFactory.getInstance(/* args */);

So the code using the x variable doesn't have to know its concrete type.

Your code is making web service calls implementing business logic rather than being a fancy wrapper for new Foo().

From the accepted answer for Difference between a service class and a Helper class at Programmers:

A Service class/interface provides a way of a client to interact with some functionality in the application. This is typically public, with some business meaning. For example, a TicketingService interface might allow you to buyTicket, sellTicket and so on.

Your code has "business meaning" -- it manages users in the system -- and therefore is a service. I would register it with AngularJS accordingly.

How AngularJS Defines (And Confuses) Services and Factories

The frustrating thing about the AngularJS documentation is the code examples in the AngularJS Services Docs keep using myModule.factory(...) to create a service. This creates some confusion on the roles of services and factories.

From the AngularJS docs:

myModule.factory('serviceId', function() {
    // ...
});

Two things are happening here.

  1. A factory function is registered with the framework that will return an object for a dependency named serviceId
  2. The object returned by the factory function is the service object.

Your use of forumApp.factory(...) is the correct way to create services in AngularJS. The end result of forumApp.factory(...) is a factory function that returns your service objects. Yes, you have created 3 factories, but those factories then create services --- and this is the correct pattern.

This StackOverflow question is a good read: angularjs - Service vs provider vs factory?

1
source | link