Configuring an editor for various languages using Factory Method Pattern Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Factory to instantiate and configure Selenium WebDriverIs this correct factory method pattern?Java implementation of the Factory Method patternSwing MVC and Command PatternPHP Factory Method Pattern ImplementationBusiness interfaces and packagesImplementation of Factory Method pattern for XML and Excel documentsSimple factory pattern for cooking a pizzaFactory Method Pattern - Base implementation to Add New RecordsFactory design pattern for circles and polygonsFactory design pattern with Shapes
Can gravitational waves pass through a black hole?
Is a copyright notice with a non-existent name be invalid?
Weaponising the Grasp-at-a-Distance spell
calculator's angle answer for trig ratios that can work in more than 1 quadrant on the unit circle
3D Masyu - A Die
Flight departed from the gate 5 min before scheduled departure time. Refund options
Should man-made satellites feature an intelligent inverted "cow catcher"?
Where did Ptolemy compare the Earth to the distance of fixed stars?
Bash script to execute command with file from directory and condition
A German immigrant ancestor has a "Registration Affidavit of Alien Enemy" on file. What does that mean exactly?
Why are current probes so expensive?
Is there a canonical “inverse” of Abelianization?
How can I list files in reverse time order by a command and pass them as arguments to another command?
malloc in main() or malloc in another function: allocating memory for a struct and its members
How to achieve cat-like agility?
Can I take recommendation from someone I met at a conference?
New Order #6: Easter Egg
draw a pulley system
Improvising over quartal voicings
Table formatting with tabularx?
Sankhya yoga - Bhagvat Gita
How to show a density matrix is in a pure/mixed state?
Understanding piped commands in GNU/Linux
Why is there so little support for joining EFTA in the British parliament?
Configuring an editor for various languages using Factory Method Pattern
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Factory to instantiate and configure Selenium WebDriverIs this correct factory method pattern?Java implementation of the Factory Method patternSwing MVC and Command PatternPHP Factory Method Pattern ImplementationBusiness interfaces and packagesImplementation of Factory Method pattern for XML and Excel documentsSimple factory pattern for cooking a pizzaFactory Method Pattern - Base implementation to Add New RecordsFactory design pattern for circles and polygonsFactory design pattern with Shapes
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?
public abstract class Configuration
protected List<String> keyWords;
abstract void getTheme();
abstract String getKeyWords();
public abstract class Editor
public final void useEditor()
Configuration configuration = createConfiguration();
configuration.getTheme();
parse(configuration.getKeyWords());
save();
//The Factory Method
public abstract Configuration createConfiguration();
public abstract void parse(String sourceCode);
public void save()
System.out.println("The file was saved..");
public class JavaConfiguration extends Configuration
public JavaConfiguration()
keyWords = new ArrayList<>();
keyWords.add("class");
keyWords.add("protected");
@Override
void getTheme()
System.out.println("Applied Java Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class PythonConfiguration extends Configuration
public PythonConfiguration()
keyWords = new ArrayList<>();
keyWords.add("def");
keyWords.add("print");
@Override
void getTheme()
System.out.println("Applied Python Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class JavaEditor extends Editor
@Override
public Configuration createConfiguration()
return new JavaConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing Java code...");
public class PythonEditor extends Editor
@Override
public Configuration createConfiguration()
return new PythonConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing python code...");
public class App
public static void main(String[] args)
Scanner sc = new Scanner(System.in);
String language = sc.next();
Editor editor = createEditor(language);
editor.useEditor();
private static Editor createEditor(String language)
switch(language)
case "Java":
return new JavaEditor();
case "Python":
return new PythonEditor();
default:
return null;
Edit: It seems that the Factory Method Pattern is not the appropriate design pattern to use in this case, as suggested by @200_success and @Timothy Truckle. A simple Editor class which receives a Configuration as a parameter should be enough.
java object-oriented factory-method
$endgroup$
add a comment |
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?
public abstract class Configuration
protected List<String> keyWords;
abstract void getTheme();
abstract String getKeyWords();
public abstract class Editor
public final void useEditor()
Configuration configuration = createConfiguration();
configuration.getTheme();
parse(configuration.getKeyWords());
save();
//The Factory Method
public abstract Configuration createConfiguration();
public abstract void parse(String sourceCode);
public void save()
System.out.println("The file was saved..");
public class JavaConfiguration extends Configuration
public JavaConfiguration()
keyWords = new ArrayList<>();
keyWords.add("class");
keyWords.add("protected");
@Override
void getTheme()
System.out.println("Applied Java Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class PythonConfiguration extends Configuration
public PythonConfiguration()
keyWords = new ArrayList<>();
keyWords.add("def");
keyWords.add("print");
@Override
void getTheme()
System.out.println("Applied Python Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class JavaEditor extends Editor
@Override
public Configuration createConfiguration()
return new JavaConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing Java code...");
public class PythonEditor extends Editor
@Override
public Configuration createConfiguration()
return new PythonConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing python code...");
public class App
public static void main(String[] args)
Scanner sc = new Scanner(System.in);
String language = sc.next();
Editor editor = createEditor(language);
editor.useEditor();
private static Editor createEditor(String language)
switch(language)
case "Java":
return new JavaEditor();
case "Python":
return new PythonEditor();
default:
return null;
Edit: It seems that the Factory Method Pattern is not the appropriate design pattern to use in this case, as suggested by @200_success and @Timothy Truckle. A simple Editor class which receives a Configuration as a parameter should be enough.
java object-oriented factory-method
$endgroup$
add a comment |
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?
public abstract class Configuration
protected List<String> keyWords;
abstract void getTheme();
abstract String getKeyWords();
public abstract class Editor
public final void useEditor()
Configuration configuration = createConfiguration();
configuration.getTheme();
parse(configuration.getKeyWords());
save();
//The Factory Method
public abstract Configuration createConfiguration();
public abstract void parse(String sourceCode);
public void save()
System.out.println("The file was saved..");
public class JavaConfiguration extends Configuration
public JavaConfiguration()
keyWords = new ArrayList<>();
keyWords.add("class");
keyWords.add("protected");
@Override
void getTheme()
System.out.println("Applied Java Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class PythonConfiguration extends Configuration
public PythonConfiguration()
keyWords = new ArrayList<>();
keyWords.add("def");
keyWords.add("print");
@Override
void getTheme()
System.out.println("Applied Python Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class JavaEditor extends Editor
@Override
public Configuration createConfiguration()
return new JavaConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing Java code...");
public class PythonEditor extends Editor
@Override
public Configuration createConfiguration()
return new PythonConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing python code...");
public class App
public static void main(String[] args)
Scanner sc = new Scanner(System.in);
String language = sc.next();
Editor editor = createEditor(language);
editor.useEditor();
private static Editor createEditor(String language)
switch(language)
case "Java":
return new JavaEditor();
case "Python":
return new PythonEditor();
default:
return null;
Edit: It seems that the Factory Method Pattern is not the appropriate design pattern to use in this case, as suggested by @200_success and @Timothy Truckle. A simple Editor class which receives a Configuration as a parameter should be enough.
java object-oriented factory-method
$endgroup$
I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?
public abstract class Configuration
protected List<String> keyWords;
abstract void getTheme();
abstract String getKeyWords();
public abstract class Editor
public final void useEditor()
Configuration configuration = createConfiguration();
configuration.getTheme();
parse(configuration.getKeyWords());
save();
//The Factory Method
public abstract Configuration createConfiguration();
public abstract void parse(String sourceCode);
public void save()
System.out.println("The file was saved..");
public class JavaConfiguration extends Configuration
public JavaConfiguration()
keyWords = new ArrayList<>();
keyWords.add("class");
keyWords.add("protected");
@Override
void getTheme()
System.out.println("Applied Java Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class PythonConfiguration extends Configuration
public PythonConfiguration()
keyWords = new ArrayList<>();
keyWords.add("def");
keyWords.add("print");
@Override
void getTheme()
System.out.println("Applied Python Theme...");
@Override
String getKeyWords()
return keyWords.toString();
public class JavaEditor extends Editor
@Override
public Configuration createConfiguration()
return new JavaConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing Java code...");
public class PythonEditor extends Editor
@Override
public Configuration createConfiguration()
return new PythonConfiguration();
@Override
public void parse(String sourceCode)
System.out.println("Parsing python code...");
public class App
public static void main(String[] args)
Scanner sc = new Scanner(System.in);
String language = sc.next();
Editor editor = createEditor(language);
editor.useEditor();
private static Editor createEditor(String language)
switch(language)
case "Java":
return new JavaEditor();
case "Python":
return new PythonEditor();
default:
return null;
Edit: It seems that the Factory Method Pattern is not the appropriate design pattern to use in this case, as suggested by @200_success and @Timothy Truckle. A simple Editor class which receives a Configuration as a parameter should be enough.
java object-oriented factory-method
java object-oriented factory-method
edited 25 mins ago
ovidiu-miu
asked Mar 15 '17 at 22:22
ovidiu-miuovidiu-miu
624
624
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern.
No.
The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?
Generally spoken your approach fails the Separation of Concerns principle.
You have two responsibilities in your code that belong to a factory:
- identifying the requested type.
- creating the actual object.
Both should be in a separate factory class.
Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.
We employ inheritance when the child classes differ in behavior. But your Editor
extensions only differ in configuration (as far as your code example is showing...).
So what your (yet to build) factory should do is creating the "language depended" key word list and pass that into a new instance of the one and only Editor
class.
$endgroup$
add a comment |
$begingroup$
The getKeyWords()
method is not particularly useful. It takes a List<String>
and summarizes its contents in a degraded form. It's particularly inappropriate for Editor.useEditor()
to attempt to parse this undocumented string representation. I would prefer to have it return an unmodifiable list. The JavaConfiguration
class would be better written as
import java.util.Arrays;
import java.util.Collections;
public class JavaConfiguration extends Configuration
private static List<> KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"class",
"protected"
));
@Override
List<String> getKeywords()
return KEYWORDS;
…
Does the order of the keywords matter? Perhaps a Set
would be more appropriate than a List
.
Typically, you wouldn't want to have the App
be responsible for performing the translation from language name to the associated Configuration
object.
public abstract class Configuration
abstract void getTheme();
abstract List<String> getKeywords();
public static Configuration forLanguage(String language)
switch (language)
case "Java":
…
A factory might not be the most appropriate pattern, though, since there isn't any point in instantiating many copies of each Configuration
subclass. Reusing singletons might be better.
One would hope that the whole point of having various Configuration
s is to contain all the language-specific behaviours of the Editor
. Therefore, if the system is designed properly, then there should only be one Editor
class, whose constructor accepts a Configuration
. (I'm assuming that you don't need the Editor
to be able to switch languages on the fly.)
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f157875%2fconfiguring-an-editor-for-various-languages-using-factory-method-pattern%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern.
No.
The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?
Generally spoken your approach fails the Separation of Concerns principle.
You have two responsibilities in your code that belong to a factory:
- identifying the requested type.
- creating the actual object.
Both should be in a separate factory class.
Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.
We employ inheritance when the child classes differ in behavior. But your Editor
extensions only differ in configuration (as far as your code example is showing...).
So what your (yet to build) factory should do is creating the "language depended" key word list and pass that into a new instance of the one and only Editor
class.
$endgroup$
add a comment |
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern.
No.
The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?
Generally spoken your approach fails the Separation of Concerns principle.
You have two responsibilities in your code that belong to a factory:
- identifying the requested type.
- creating the actual object.
Both should be in a separate factory class.
Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.
We employ inheritance when the child classes differ in behavior. But your Editor
extensions only differ in configuration (as far as your code example is showing...).
So what your (yet to build) factory should do is creating the "language depended" key word list and pass that into a new instance of the one and only Editor
class.
$endgroup$
add a comment |
$begingroup$
I need to know if my code is a valid implementation of the factory method pattern.
No.
The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?
Generally spoken your approach fails the Separation of Concerns principle.
You have two responsibilities in your code that belong to a factory:
- identifying the requested type.
- creating the actual object.
Both should be in a separate factory class.
Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.
We employ inheritance when the child classes differ in behavior. But your Editor
extensions only differ in configuration (as far as your code example is showing...).
So what your (yet to build) factory should do is creating the "language depended" key word list and pass that into a new instance of the one and only Editor
class.
$endgroup$
I need to know if my code is a valid implementation of the factory method pattern.
No.
The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?
Generally spoken your approach fails the Separation of Concerns principle.
You have two responsibilities in your code that belong to a factory:
- identifying the requested type.
- creating the actual object.
Both should be in a separate factory class.
Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.
We employ inheritance when the child classes differ in behavior. But your Editor
extensions only differ in configuration (as far as your code example is showing...).
So what your (yet to build) factory should do is creating the "language depended" key word list and pass that into a new instance of the one and only Editor
class.
answered Mar 16 '17 at 10:10
Timothy TruckleTimothy Truckle
4,981416
4,981416
add a comment |
add a comment |
$begingroup$
The getKeyWords()
method is not particularly useful. It takes a List<String>
and summarizes its contents in a degraded form. It's particularly inappropriate for Editor.useEditor()
to attempt to parse this undocumented string representation. I would prefer to have it return an unmodifiable list. The JavaConfiguration
class would be better written as
import java.util.Arrays;
import java.util.Collections;
public class JavaConfiguration extends Configuration
private static List<> KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"class",
"protected"
));
@Override
List<String> getKeywords()
return KEYWORDS;
…
Does the order of the keywords matter? Perhaps a Set
would be more appropriate than a List
.
Typically, you wouldn't want to have the App
be responsible for performing the translation from language name to the associated Configuration
object.
public abstract class Configuration
abstract void getTheme();
abstract List<String> getKeywords();
public static Configuration forLanguage(String language)
switch (language)
case "Java":
…
A factory might not be the most appropriate pattern, though, since there isn't any point in instantiating many copies of each Configuration
subclass. Reusing singletons might be better.
One would hope that the whole point of having various Configuration
s is to contain all the language-specific behaviours of the Editor
. Therefore, if the system is designed properly, then there should only be one Editor
class, whose constructor accepts a Configuration
. (I'm assuming that you don't need the Editor
to be able to switch languages on the fly.)
$endgroup$
add a comment |
$begingroup$
The getKeyWords()
method is not particularly useful. It takes a List<String>
and summarizes its contents in a degraded form. It's particularly inappropriate for Editor.useEditor()
to attempt to parse this undocumented string representation. I would prefer to have it return an unmodifiable list. The JavaConfiguration
class would be better written as
import java.util.Arrays;
import java.util.Collections;
public class JavaConfiguration extends Configuration
private static List<> KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"class",
"protected"
));
@Override
List<String> getKeywords()
return KEYWORDS;
…
Does the order of the keywords matter? Perhaps a Set
would be more appropriate than a List
.
Typically, you wouldn't want to have the App
be responsible for performing the translation from language name to the associated Configuration
object.
public abstract class Configuration
abstract void getTheme();
abstract List<String> getKeywords();
public static Configuration forLanguage(String language)
switch (language)
case "Java":
…
A factory might not be the most appropriate pattern, though, since there isn't any point in instantiating many copies of each Configuration
subclass. Reusing singletons might be better.
One would hope that the whole point of having various Configuration
s is to contain all the language-specific behaviours of the Editor
. Therefore, if the system is designed properly, then there should only be one Editor
class, whose constructor accepts a Configuration
. (I'm assuming that you don't need the Editor
to be able to switch languages on the fly.)
$endgroup$
add a comment |
$begingroup$
The getKeyWords()
method is not particularly useful. It takes a List<String>
and summarizes its contents in a degraded form. It's particularly inappropriate for Editor.useEditor()
to attempt to parse this undocumented string representation. I would prefer to have it return an unmodifiable list. The JavaConfiguration
class would be better written as
import java.util.Arrays;
import java.util.Collections;
public class JavaConfiguration extends Configuration
private static List<> KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"class",
"protected"
));
@Override
List<String> getKeywords()
return KEYWORDS;
…
Does the order of the keywords matter? Perhaps a Set
would be more appropriate than a List
.
Typically, you wouldn't want to have the App
be responsible for performing the translation from language name to the associated Configuration
object.
public abstract class Configuration
abstract void getTheme();
abstract List<String> getKeywords();
public static Configuration forLanguage(String language)
switch (language)
case "Java":
…
A factory might not be the most appropriate pattern, though, since there isn't any point in instantiating many copies of each Configuration
subclass. Reusing singletons might be better.
One would hope that the whole point of having various Configuration
s is to contain all the language-specific behaviours of the Editor
. Therefore, if the system is designed properly, then there should only be one Editor
class, whose constructor accepts a Configuration
. (I'm assuming that you don't need the Editor
to be able to switch languages on the fly.)
$endgroup$
The getKeyWords()
method is not particularly useful. It takes a List<String>
and summarizes its contents in a degraded form. It's particularly inappropriate for Editor.useEditor()
to attempt to parse this undocumented string representation. I would prefer to have it return an unmodifiable list. The JavaConfiguration
class would be better written as
import java.util.Arrays;
import java.util.Collections;
public class JavaConfiguration extends Configuration
private static List<> KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"class",
"protected"
));
@Override
List<String> getKeywords()
return KEYWORDS;
…
Does the order of the keywords matter? Perhaps a Set
would be more appropriate than a List
.
Typically, you wouldn't want to have the App
be responsible for performing the translation from language name to the associated Configuration
object.
public abstract class Configuration
abstract void getTheme();
abstract List<String> getKeywords();
public static Configuration forLanguage(String language)
switch (language)
case "Java":
…
A factory might not be the most appropriate pattern, though, since there isn't any point in instantiating many copies of each Configuration
subclass. Reusing singletons might be better.
One would hope that the whole point of having various Configuration
s is to contain all the language-specific behaviours of the Editor
. Therefore, if the system is designed properly, then there should only be one Editor
class, whose constructor accepts a Configuration
. (I'm assuming that you don't need the Editor
to be able to switch languages on the fly.)
answered Mar 15 '17 at 23:00
200_success200_success
131k17157422
131k17157422
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f157875%2fconfiguring-an-editor-for-various-languages-using-factory-method-pattern%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown