Similar documents

1.Which four options describe the correct default values for array elements of the types indicated?

Midterm Reminders. Design Pattern #6: Facade. General Idea. The Situation

Exam 1 Practice CSE 232 Summer 2018 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

System Modelling. Lecture

Objectives. Coding Standards. Why coding standards? Elements of Java Style. Understand motivation for coding standards

WA1278 Introduction to Java Using Eclipse

Basic Types, Variables, Literals, Constants

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

History of Computing. Ahmed Sallam 11/28/2014 1

The Design Process. General Development Issues. C/C++ and OO Rules of Thumb. Home

Computers Programming Course 6. Iulian Năstac

Full file at

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

BBM 102 Introduction to Programming II Spring 2017

BBM 102 Introduction to Programming II Spring 2017

Lecture 23: Domain-Driven Design (Part 1)

REST in a Nutshell: A Mini Guide for Python Developers

Numerical Computing in C and C++ Jamie Griffin. Semester A 2017 Lecture 2

CP122 CS I. Iteration

ArrayList. Introduction. java.util.arraylist

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

YEAH 2: Simple Java! Avery Wang Jared Bitz 7/6/2018

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Skyway Builder 6.3 Reference

Object-Oriented Software Engineering Practical Software Development using UML and Java

Appendix A: Interfaces and Classes in the AP Java Subset (AB)

CHAPTER 5 VARIABLES AND OTHER BASIC ELEMENTS IN JAVA PROGRAMS

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:

Computer Programming, I. Laboratory Manual. Experiment #3. Selections

LECTURE 3 C++ Basics Part 2

Updated: 2/14/2017 Page 1 of 6

CS106X Handout 03 Autumn 2012 September 24 th, 2012 Getting Started

SML Style Guide. Last Revised: 31st August 2011

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Variables and Literals

ECE 122 Engineering Problem Solving with Java

SFU CMPT 379 Compilers Spring 2018 Milestone 1. Milestone due Friday, January 26, by 11:59 pm.

104. Intermediate Java Programming

Painless Persistence. Some guidelines for creating persistent Java applications that work

Contents of Lecture 3

3. Java - Language Constructs I

Agile Project Management: A Quick Start Beginner's Guide To Mastering Agile Project Management PDF

Key Differences Between Python and Java

Java Fall 2018 Margaret Reid-Miller

ITI Introduction to Computing II

Generics. IRS W-9 Form

1 Shyam sir JAVA Notes

An Introduction to Processing

Chapter 3: Operators, Expressions and Type Conversion

An Interface with Generics

Data Types. Numeric Data Types

COMP 202 Java in one week

14. Pointers, Algorithms, Iterators and Containers II

Types, Variables, and Constants

Structures, Operators

[PDF] Agile : Agile Project Management, A QuickStart Beginners 's Guide To Mastering Agile Project Management!

1. Suppose you are using a HashMap<String,Integer>. What is the runtime of put and get assuming you have a reasonable hash function?

On a 64-bit CPU. Size/Range vary by CPU model and Word size.

AS COMPUTERS AND THEIR USER INTERFACES have become easier to use,

Part X. Advanced C ++

Classes, interfaces, & documentation. Review of basic building blocks

Games Course, summer Introduction to Java. Frédéric Haziza

The C++ Language. Arizona State University 1

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Princeton University. Computer Science 217: Introduction to Programming Systems. Data Types in C

Define a method vs. calling a method. Chapter Goals. Contents 1/21/13

Azon Master Class. By Ryan Stevenson Guidebook #5 WordPress Usage

FizzBuzz in Haskell by Embedding a Domain-Specific Language

Here are all the comments that your Udacity Code Reviewer had about your code...

2/12/17. Goals of this Lecture. Historical context Princeton University Computer Science 217: Introduction to Programming Systems

Lecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar

Chapter 21a Other Library Issues

Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering. Fifth Semester

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

DEPARTMENT OF MATHS, MJ COLLEGE

Exploring Advanced Search Features on the web

When using computers, it should have a minimum number of easily identifiable states.

Chapter 17 vector and Free Store. Bjarne Stroustrup

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

2. The actual object type stored in an object of type CollectionClassName<E> is specified when the object is created.

CSCE 314 Programming Languages. Type System

Tutorial 3: Unit tests and JUnit

Declaration and Memory

JVA-103. Java Programming

Specifying, Creating, and Comparing Algorithms. And another look at JavaScript

School of Engineering and Computing INTRODUCTION TO PROGRAMMING 2 M1G /01/11 JP

Content. Information Coding. Where are we? Where are we? Bit vectors (aka Words )

ANGEL CITY INTERACTIVE

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Racket Style Guide Fall 2017

Reserved Words and Identifiers

COP 3330 Final Exam Review

Information Retrieval in Libraries and Information Centres: Concepts, Challenges and Search Strategies

Exercise 4: Loops, Arrays and Files

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:


The Design of C: A Rational Reconstruction"

Arrays array array length fixed array fixed length array fixed size array Array elements and subscripting

Transcription:

/ WordFriday

enterprise, noun

enterprise, noun a project or undertaking that is especially bold, complicated or arduous readiness to engage in undertakings of difficulty, risk, danger or daring a design of which the execution is attempted a commercial or industrial undertaking a firm, company or business a unit of economic organisation or activity Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary

enterprise, noun a project or undertaking that is especially bold, complicated or arduous readiness to engage in undertakings of difficulty, risk, danger or daring a design of which the execution is attempted a commercial or industrial undertaking a firm, company or business a unit of economic organisation or activity Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary

code, noun a set of instructions for a computer a computer program, or a portion thereof a system of words, figures or symbols used to represent others, especially for the purposes of secrecy a set of conventions or principles governing behaviour or activity in a particular domain Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary

Fizz buzz is a group word game for children to teach them about division. http://en.wikipedia.org/wiki/fizz_buzz

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz

Adults may play Fizz buzz as a drinking game, where making a mistake leads to the player having to make a drinking-related forfeit. [citation needed] http://en.wikipedia.org/wiki/fizz_buzz

Fizz buzz has been used as an interview screening device for computer programmers. http://en.wikipedia.org/wiki/fizz_buzz

FizzBuzz was invented to avoid the awkwardness of realising that nobody in the room can binary search an array. https://twitter.com/richardadalton/status/591534529086693376

I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated. Anderson's Law

https://github.com/enterprisequalitycoding/fizzbuzzenterpriseedition

https://github.com/enterprisequalitycoding/fizzbuzzenterpriseedition

Architecture is the art of how to waste space. Philip Johnson

/ WordFriday

bi-quinary coded decimal, noun A system of representing numbers based on counting in fives, with an additional indicator to show whether the count is in the first or second half of the decimal range, i.e., whether the number represented is in the range 0 4 or 5 9. This system is found in many abacus systems, with paired columns of counters (normally aligned) representing each bi-quinary range. The Roman numeral system is also a form of biquinary coded decimal.

Signal-to-noise ratio (often abbreviated SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise. Signal-to-noise ratio is sometimes used informally to refer to the ratio of useful information to false or irrelevant data in a conversation or exchange. http://en.wikipedia.org/wiki/signal_to_noise_ratio

http://www.bonkersworld.net/object-world/

OBJECT-ORIENTED VenetianBlind Door Television Glass Picture Peephole TelevisionRemoteControl Sofa http://www.bonkersworld.net/object-world/

http://classnamer.com/

http://methodnamer.com/

public interface BookEntity... public interface BookEntityFactory... public interface ISBNValidator... public interface CatalogueRepository... public interface CatalogueRepositoryProvider... public abstract class AbstractBookEntity implements BookEntity public class BookEntityImpl extends AbstractBookEntity... public class BookEntityFactoryImpl implements BookEntityFactory... public class ISBNValidatorImpl implements ISBNValidator... public class CatalogueRepositoryImpl implements CatalogueRepository... public class CatalogueRepositoryProviderImpl implements CatalogueRepositoryProvider...

public interface Book... public final class ISBN... public interface Catalogue... public class DescriptionOfCatalogueImplementation implements Catalogue...

Naomi Epel The Observation Deck

People will be using the words you choose in their conversation for the next 20 years. You want to be sure you do it right.

package com.sun...;

Public APIs, like diamonds, are forever. Joshua Bloch "Bumper-Sticker API Design" http://www.infoq.com/articles/api-design-joshua-bloch

People will be using the words you choose in their conversation for the next 20 years. You want to be sure you do it right. Unfortunately, many people get all formal [...]. Just calling it what it is isn't enough.

They have to tack on a flowery, computer science-y, impressive sounding, but ultimately meaningless word, like Object, Thing, Component, Part, Manager, Entity, or Item.

public class ConfigurationManager...

public class Configuration...

public interface ConditionChecker boolean checkcondition();

public interface Condition boolean istrue();

Connection Factory Connection Connection Impl

Connection Pool Connection Pooled Connection

Parser Builder Tree

Parser Builder Tree BuilderImpl

Parser ParserListener Tree Builder

Parser ParserListener Builder Tree

Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. http://en.wikipedia.org/wiki/cargo_cult_programming

https://twitter.com/expertbeginner1/status/603188084725981185

Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. Cargo cult programming can also refer to the results of applying a design pattern or coding style blindly without understanding the reasons behind that design principle. http://en.wikipedia.org/wiki/cargo_cult_programming

Rien n'est plus dangereux qu'une idée, quand on n'a qu'une idée. Émile-Auguste Chartier

Nothing is more dangerous than an idea, when you have only one idea. Émile-Auguste Chartier

Nothing is more dangerous than an IDE, when you have only one IDE.

I currently have an average of 15-25 imports in each source file, which is seriously making my code mixed-up and confusing. Is too many imports in your code a bad thing? Is there any way around this? http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code

It's normal in Java world to have a lot of imports. Not importing whole packages is good practice. It's a good practice to import class by class instead of importing whole packages. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code

Why?

It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code

It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code

It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code

What is the Matrix? Control. The Matrix is a computer-generated dream world built to keep us under control in order to change a human being into this. Warner Bros.

I currently have an average of 15-25 imports in each source file, which is seriously making my code mixed-up and confusing. Is too many imports in your code a bad thing? Is there any way around this? Yes? Yes. Yes!

Avoid Long Import Lists by Using Wildcards Long lists of imports are daunting to the reader. We don't want to clutter up the tops of our modules with 80 lines of imports. Rather we want the imports to be a concise statement about which packages we collaborate with.

import java.util.arraylist; import java.util.collection; import java.util.hashmap; import java.util.hashset; import java.util.linkedhashmap; import java.util.linkedhashset; import java.util.linkedlist; import java.util.list; import java.util.map; import java.util.navigablemap; import java.util.navigableset; import java.util.set; import java.util.sortedmap; import java.util.sortedset; import java.util.treemap; import java.util.treeset;

import java.util.*;

import java.beans.introspector; import java.lang.reflect.array; import java.lang.reflect.constructor; import java.lang.reflect.method; import java.lang.reflect.modifier; import java.lang.reflect.proxy; import java.util.arrays; import java.util.collection; import java.util.collections; import java.util.hashmap; import java.util.hashset; import java.util.iterator; import java.util.linkedhashset; import java.util.map; import java.util.set;

import java.beans.*; import java.lang.reflect.*; import java.util.*;

import java.awt.*; import java.util.*; List?

import java.awt.*; import java.util.*; import java.util.list;

Connection * CreateServerConnection() // Declarations char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result; // Get address and check that its OK (throw an exception if its not) cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Convert adress to bytes and check that its OK (throw an exception if its not) address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Get port and check that its OK (throw an exception if its not) cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Convert port too bytes port = htons(atoi(cfgport.data())); // Creation connection and check that its OK (throw an exception if its not) result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Return the connection return result;

Connection * CreateServerConnection() // Declarations char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result;...

Connection * CreateServerConnection()... // Get address and check that its OK (throw an exception if its not) cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer);...

Connection * CreateServerConnection()... // Convert adress to bytes and check that its OK (throw an exception if its not) address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...

Connection * CreateServerConnection()... // Get port and check that its OK (throw an exception if its not) cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer);...

Connection * CreateServerConnection()... // Convert port too bytes port = htons(atoi(cfgport.data()));...

Connection * CreateServerConnection()... // Creation connection and check that its OK (throw an exception if its not) result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...

Connection * CreateServerConnection()... // Return the connection return result;

Connection * CreateServerConnection() // Declarations... // Get address and check that its OK (throw an exception if its not)... // Convert adress to bytes and check that its OK (throw an exception if its not)... // Get port and check that its OK (throw an exception if its not)... // Convert port too bytes... // Creation connection and check that its OK (throw an exception if its not)... // Return the connection...

Connection * CreateServerConnection() // Declarations... // Get address and check that it's OK (throw an exception if it's not)... // Convert address to bytes and check that it's OK (throw an exception if it's not)... // Get port and check that it's OK (throw an exception if it's not)... // Convert port to bytes... // Creation connection and check that it's OK (throw an exception if it's not)... // Return the connection...

Connection * CreateServerConnection().....................

Connection * CreateServerConnection() char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result; cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); port = htons(atoi(cfgport.data())); result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

Connection * CreateServerConnection() char buffer[1024]; std::string cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); unsigned long address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); std::string cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); unsigned short port = htons(atoi(cfgport.data())); Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

Connection * CreateServerConnection()... Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

Connection * CreateServerConnection()... Connection * result = new Connection(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

std::auto_ptr<connection> CreateServerConnection()... std::auto_ptr<connection> result(new Connection(address, port)); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

std::unique_ptr<connection> CreateServerConnection()... auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;

Connection * CreateServerConnection()... auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.c_str())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) snprintf(buffer, sizeof buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) snprintf(buffer, sizeof buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();

Connection * CreateServerConnection() char buffer[1024];... if(cfgaddress.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer);... if(address == -1) snprintf(buffer, sizeof buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...

Connection * CreateServerConnection()... if(cfgaddress.empty()) std::stringstream buffer; buffer << "Configuration value missing: " << "address"; Log::Instance().Write(buffer.str()); throw ConnectionException(buffer.str());... if(address == -1) std::stringstream buffer; buffer << "Invalid address: " << cfgaddress; Log::Instance().Write(buffer.str()); throw ConnectionException(buffer.str());...

Connection * CreateServerConnection()... if(cfgaddress.empty()) static const char * logmessage = "Configuration value missing: address"; Log::Instance().Write(logMessage); throw ConnectionException(logMessage);... if(address == -1) auto logmessage = "Invalid address: " + cfgaddress; Log::Instance().Write(logMessage); throw ConnectionException(logMessage);...

Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) static const char * logmessage = "Configuration value missing: address"; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) auto logmessage = "Invalid address: " + cfgaddress; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) static const char * logmessage = "Configuration value missing: port"); Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) auto logmessage = "Failed to connect: " + cfgaddress + ":" + cfgport; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); return result.release();

Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();

Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();

Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();

std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;

std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;

std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().ValueOf("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().ValueOf("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;

std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = Configuration::Instance().ValueOf("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = Configuration::Instance().ValueOf("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;

std::unique_ptr<connection> CreateServerConnection( const std::string & cfgaddress, const std::string & cfgport) if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;

std::unique_ptr<connection> CreateServerConnection( in_addr_t address, in_port_t port) auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect(address, port); return result;

std::unique_ptr<connection> ConnectToServer(in_addr_t address, in_port_t port) auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect(address, port); return result;

std::unique_ptr<connection> ConnectToServer(in_addr_t address, in_port_t port) return std::make_unique<connection>(address, port);