
Ejerccicio
#1
Escrito 12 noviembre 2010 - 23:40
Commo solo se C++ (y poco) el ejerccio lo planteo en C++. Pero como hablamos de patrones entiendo que da igual el lenguaje. Lo propongo porque lo creo interesante...
Supongamos una clase mensaje. Esta clase tiene varios constructores. Buffer y tamaño, otro void, otro solo un buffer de tamaño fijo que es una cabecera...
void msg(char* pBuffer, DWORD dwSize)
void msg()
void msg(char* pHeader)
El mensaje tiene un tamaño maximo N. Que en principio esta harcodeado de forma que cuando se crea el objeto se comprueba que el buffer no exceda ese tamaño.
Todo bien. Tengo un cerro de lineas, de mensajes, una logica coherente. Supongamos que funciona.
Ahora como siempre, LLega el listo del Jefe y te dice que eso no puede ir harcoded que si el mensaje crece, que hay que adaptarse sin compilar. Asi que , tachan!!! Esta constante se lee de un fichero de configuracion. Asi todos los mensajes tendrian el mismo limite, y este limite se podria variar segun necesidades del sistema.
Y Empieza el baile:
Si el fichero se lee en los constructores cada vez que se instancia una clase se va al fichero. Pero esto no mola porque es lento. Muy lento. Lentisimo.
Si el cliente que construye el objeto le comuniqua un nuevo parametro que sea el tamaño limite. No mola, porque entonces se deja a la divina providencia el que todos los mensajes tengan el mismo limite. No me fio de ningun programata que no sea yo. Como cualquier programmador
y Ademas hay que cambiar el interfaz de los constructores. Y eso tampoco mola, porque tenemos N mil lineas, objetos, clases y funciona (por una vez y sin que sirva de precedente)
si usamos un clase prototipo y establecemos metodos para fijar lo que se fija en los constructores, mediante setters. hay que odificar el codigo. El jefe feliz porque consiguio amargar la vida al currito, pero al modificar el codigo que chutaba el riesgo es grande. Y el currito no quiere ni hacer horas ni comerse el marron de toquetear por todo el codigo.
Gustariame por tanto algo mas elegante, una especie de superclase sobre el mensaje que tenga el limite. Quiza un decorator????
Se admiten soluciiones cretivas y eleganttes...
#2
Escrito 15 noviembre 2010 - 00:29
El patrón Decorator lo veo más para cuando se quieren crear objetos a los que irles añadiendo funcionalidades de forma dinámica. Pero este caso parece que se trata de cambiar los diferentes algoritmos posibles para leer el parámetro, con lo que vería más adecuado plantearse usar un patrón Strategy. Puesto que si tenemos que diseñar algo que acepte cambios de la forma de leer el parámetro en el futuro tiene más que ver con que soporte diferentes algoritmos para realizar una determinada acción. Lo que viene a ser precisamente la definición del patrón Strategy. El Decorator estaría indicado en el caso de que quisiéramos añadir al objeto más tipos de funcionalidades diferentes, no la misma con distintos algoritmos...
La solución sería combinar el Strategy con una clase estática que lea el parámetro una sola vez del archivo al arrancar la aplicación, y luego pedírselo a ella en el algoritmo correspondiente del Strategy. De esta forma podrías tener objetos que unos obtienen el parámetro de un archivo, otros que lo solicitan por pantalla, etc., etc...
Ya diréis que os parece...
Alberto Dominguez
Enterprise Architect y Trainer
MCT, MCPD, MCITP, MCITP Dynamics, MCSE, MCSA, MCTS, MCP...
ITIL V3 Foundation Qualification in IT Service Management






#3
Escrito 07 julio 2017 - 14:24
rozana tapsee
Granaten wie wir
Cancelar resposta
Prince of Persia Classic 1.0.3 iPhone iPad and iPod touch
Takip et: @tekprcfilmindir
Frederick Keeve
Troubled Times The Merrymakers
Hina Ke Khushboo Coke Studio Mp3
US investigators corroborate some aspects of the Russia dossier
Lost 3.Sezon 4.Bolum
Top IMDb
El especialista: resurreccion (mechanic 2) (2016) (Pelicula de Accion)
Bend & Break season 11 episode 05
Dubstep, Vol. 3 (2017)
Точные, естественные и инженерные науки
xXx Reactivado BluRay 3D 1080p
02:25 watch on Openload.co
Minka Kelly,
Mission Impossible 5
#4
Escrito 08 julio 2017 - 15:17
les.feux.de.l'amour (

Famous in Love
Assistir ? Episodio 08
musiche tarzan mark mancina
BlackJACK49
Breaken Te Pair
Jeff Ross Roasts Cops (season 1)
Eve Hewson
Protrens
Season 4 , Episode 10
Abi To Party Shuru Hui Hai Song Mp3
Drawn Together Stagione 2 DOWNLOAD ITA (2006)
Taiyou no Ko Esteban
TheVideo
13 Reasons Why season 1 episode 2: Tape 1 Side B Live Stream
Jill Jessa: Counting On (season 1, 2, 3)
real steel 2011 dvdrip tpb
Ongoing Drama
#5
Escrito 08 julio 2017 - 15:19
total audio converter 5.1
Elisa di rivombrosa
Alan Wake v1.03.16.4825 2012 MULTi2 Repack by R.G Origami Updated on 7 3 2012
30 for 30 Season 3 Episode 23
Trinity Simone
Tom Cruise
Supernatural 9
Ingeborga Dapkunaite
Hemen Izle
Clarence (2014)
Piccolo Grande Timmy Stagioni 1-2-3 DOWNLOAD ITA (2010-2012)
Let Me Blow Ya Mind Eve Mp3
Assorted Magazines - June 7 2017 (True PDF)
SuperFast & SuperFurious Solo Party Originali DOWNLOAD ITA – 720p BluRay (2015)
Supernatural
Ariana Grande to be given honorary citizenship of Manchester
Curiosidades
Roots (2016)
Scott Pilgrim contra el mundo2010 0
daqu festival grafelucia 2017 pesantren daqu putri cikarang part 01
American Gods S01E06 720p WEBRip x265 HEVC 2CH MRN mkv
Trace Mayer
walking dead s07
TV Shows
Download
#6
Escrito 08 julio 2017 - 15:22
Read More
Parajelensegek 5 - Szellemdimenzio
Quadratische Optimierung
Hyde and Seek
Before I Fall 2017 1080p BluRay x264-Replica
Le Roi Arthur La LГ©gende d'Excalibur French Film Torrent BRrip 720p
Love Hina DOWNLOAD ITA (2007)
Meitantei Katherine: Kieta Souzokunin SP
?Dual! Una historia paralela
Natsume Yuujinchou Roku – Episodios 09- HDTV 720p | 480p | SD – Legendado
Ver Between
Download
Download
Download
Polarr Photo Editor 4 0 zip
Akte X - Die unheimlichen Falle des FBI
Bernard Lee
The Case for Christ (2017)
#7
Escrito 10 julio 2017 - 19:00
Detective Conan
Watch Man from Reno Movie Online Free
Pirates of the Caribbean Dead Men Tell No Tales 2017 720p HC HDCAM x265 AC3-TiTAN ()
Last Chance U
skyfall adele download free mp3
- Supercar Megabuild S02E06 Jaguar Dragster XviD-AFG
Episodes 7.8
Princess Agents
Learn Web Design And Grow Your Developer Career
Брентон Туэйтс
The Last Lions (2011)
Amar Sandhu
Despacito ft. Justin Bieber (B3nte Bootleg)
E9 Jimmy Kimmel & Adam Carolla
So You Think You Can Dance Season 14 Episode 1 s14e01
Acum puteti activa si ninsoarea
Exit Through the Gift Shop
pelГcula Neruda (2016) descarga completa
Create an App
T2 Trainspotting
Lucifer 2. Sezon 17 .Bolum
CLAWSS01E01
Yes - Discography
Update v20150506
A Ghost Story (2017) putlocker libre
#8
Escrito 10 julio 2017 - 19:14
Smallville
Read more
1x6 -The Walking Dead- Capitulo 6
PhotoScape X 2 6 MAC OS X - ReleaseLoad Com zip
SpongeBob Sq...S11E41
Punjabi Movies 2016
Zoe Rainey
World Of Dan...S01E03
Supergirl 1x08
Fate/kaleid liner Prisma Illya
El Vecindario 3 (2016)
La Mecanique de L Ombre 2016 FRENCH BRRip XviD-AM8...(A)
Die Schwarzwaldklinik
Grand Prix Pete Aron (James Garner), un corredor del Grand Prix americano, es expulsado de su equipo, el Jordan-BRM, por su responsabilidad en un accidente, en el que resulto herido el corredor britanico Scott Stoddard. Ficha entonces por un equipo japones, manteniendo, al mismo tiempo, una relacion con la mujer de Stoddard.
Galaxy Angel X
Daddy’s True Colors episode 49
Kanon 2006
Kacey Mottet Klein
WWE Smackdown vs. Raw 2009 (X-BOX360)
Aye Jaye Dill Tere Janib Mp3
HD 720p 10.0 Earthquake
#9
Escrito 10 julio 2017 - 19:21
Legendary Motorcar S4E12 Episode 12
1x03 Frank, the Writer free
The Secret Life of the American Teenager
Bjorn Bar und seine lustigen Abenteuer
Presenting Princess Shaw (2015) Full Movie Watch Online
Harsh Times 2006 1080p BluRay H264 AAC-RARBG
Скам 4 сезон
Queen's Blade VANQUISHED QUEENS Vol.1-3 (BDRip 1920x1080 x264 FLAC)
How Christianity Changed the World - Alvin Schmidt
Abonament
Bob esponja
TWICE - Signal
DIRECT DOWNLOAD LINKS
Your Lie in April
1x01 Winter is Coming free
Amerikai fater
Aakar Bakkard Mp3
Storm: Letters van vuur
Kung Fu Traveler (2017)
12 серия - The Killer Robot Instability
Best Pic Of Broken Heart For Girl
Geoff Johns
Tokyo Revelation (Movie)
#10
Escrito 10 julio 2017 - 19:26
HD Norman Lear: Just Another Version of You (2016)
Polowanie na Hitlera
Comments: 0
Android - only Paid - Week 25 2017 - APPS
Eps22 The X-Files - Season 7
Schillerstra?e
BattleBots (2015)
A Birthday Wish
Watch movie
Assistir ? Episodio 14
Dave White and Grae Drake
Melrose Place (2009)
Time After Time Season 1 Complete HDTV x264 [i_c] [Isohunt.to]
roisin murphy let me know
The BlacklistS04E20
6.9
Гљltima
Implementing Cisco Unified Communications Manager
Download MP3
Spirit of Wonder: Scientific Boys Club
#11
Escrito 11 julio 2017 - 03:05
Un costume pour deux en fr(A)
Monster Strike The ...
Classroom Crisis
[W-Wbr[자체자막] 2013 720p BRRip x264 AC3-JYK mkv
Бешеные псы / Reservoir Dogs (2006) PC | RePack
Forced to Kill 2016 WEB-DL XviD-FGT
The Danish Girl DOWNLOAD ITA – 1080p BluRay (2016)
Vegtelen tortenet Vegtelen tortenet:Bastiannak nem konnyu az elete. Edesanyja meghalt, az apja pedig allandoan azzal gyotri, hogy rosszul tanul es folyton almodozik. A fiu egy szep napon besetal a konyvesboltba, ahol rabukkan egy erdekesnek latszo konyvre. Lenyugozi Fantazia csaszarnojenek tortenete. Az uralkodono egyre gyengebb, mert birodalma veszelybe kerult, mind nagyobb teruletet pusztit el a Semmi. A csaszarno ugy erzi, orszaga addig van ...
Devil May Cry
New Girl
Will Grace
Stranger Things
Black Money (2017) watch Online Telugu Movie
Paul Whitthorne
Transformers Dark of the Moon 2011 BRRip 480p Dual Audio Eng-Hindi
el jardГn de los sueГ±os (2016) pelГcula en lГnea gratis en Netflix
Game Sanaeha
Total frat movie (2016) (Pelicula de Comedia)
gangster ka
Star Wars: The Clone Wars
Titan Quest
Die Dinos
The Metallogeny of Lode Gold Deposits - Ulrich Kretschmar, Derek McBride (Elsevier, 2016) pdf
2.Sezon 1.Bolum Fresh Hell
#12
Escrito 11 julio 2017 - 03:09
how to get a boyfriend
Bill Condon
7 Naatkal (2017) HQ DVDScr
Watch Band
BitLord.com
Doctor Who 2005 S10E09 HDTV x264-MTB EZTV
Presentaciones, Activaciones y Normas del foro
WIN DIGIPET 2015
Captain America Civil War 2016 1080p BluRay 6CH AC3 3 7GB MkvCage mkv
Justicia personal (2015) Online
Girlschool Discography FLAC
El espejo de los otros (2015) BluRay completa de la pelicula
Mary Kills People
Black Mirror
2 2016 - ARQ (2016) 720p WEBRip 700MB-MKVCAGE
IOBit Game Booster 3 4 + Portable от СССР1
FuckedHard18 - kagney
10 -2 Dark Matter
Почему он? (2017)
#13
Escrito 16 julio 2017 - 05:32
The.Walking.Dead.S07E03.FRENCH.HDTV.x264-DEAL(A)
Formula 1 (2017) - GP Canada
Vampire Knight
Kingdom II
The Red Road
Game Of Thrones
Up 2009 1080p BluRay DTS x264-ESiR
El renacido
[RH] ReLIFE - 05 [English Dubbed] [1080p] [MP4]
6.Sezon 10.Bolum Caged Heat
3x27 A Pup in Paris (1) free
Demaison sГ©vade – Spectacle complet (FR) 29 juin 2017
Episode 4
Activador De Wind
Kanye West - The Life Of Pablo
Over Time
Alexandra Breckenridge
Hey Arnold!
#14
Escrito 17 julio 2017 - 02:15
Go Off (with Lil Uzi Vert, Quavo & Travis Scott)
Moonbeam City
HD The Bet on Bet
Dowcipy, smieszne teksty
rockabye
ADVANCED WEBCAM HACKER PRO
Download
[AgusiQ-Torrents pl] Ken Park 2002 NAPISY PL-LWC [AgusiQ]
4.Sezon 13.Bolum After School Special
POPULER KATEGORILER
[VNLT] Thб»«a ThбєЇng Truy KГch Burning Hands (2017)
Ore Monoga..(2015)
Generator Rex
Answer Me
El futuro ya no es lo que era (2015) 1080p BluRay Rip DD5.1 x264 [Espanol Castellano]
Arthur George
iGallery Pro 1.6.5 (MacOSX)
From Dusk Till Dawn
Episode: 2
#15
Escrito 17 julio 2017 - 02:22
HD Chocolat
Over There - Kommando Irak
FilesFlash.com
Darin De Paul,
Dil Se Dil Tak
Film LInvitation streaming Ce Film Film L'Invitation streaming L'histoire : Dans le milieu de la nuit, Leo et son meilleur ami, Raphael s'eveille. Sa voiture est en panne, a seulement une heure de Paris. Hors de question d'aller pour Raphael... a la femme de sa vie le pousse hors du lit. a l'arrivee, il decouvre que ce n'est pas un defaut, mais avec ...
George Ezra
League of Gods (2016) Bluray 720p + Indo Subtitle
Samurai 7
Mr. Sunshine
BeautyLeg Ashely zip
I'm Dying Up Here
Imagine Dragons
How do I download?
4. Enrique Iglesias - Subeme La Radio
Stompie Mavi Mp3
Sarah Silverman: A Speck of Dust En su primer especial de comedia tras sus problemas de salud, Sarah Silverman comparte divertidas anecdotas y tristes verdades sin cortarse un pelo.
Realm Of The Damned
The Fosters
Bos Layer Mp3
Peliculas
#16
Escrito 17 julio 2017 - 06:33
Jindh Mahi Song Film Angrej Mp3
Mini Diziler
Image/Design
Aquarion Evol Episode 8
Animation
Socorro He Encogido a La Profe.. BluRay MicroHD
Les Chemins de letrange
BlacksOnBlondes - Zoey Laine
4 Blocks
Dexter 2006
Эндрю Стэнтон
Israel Unpunished: Destruction of Mosques (Part
Spark: A Space Tail (2016) 720p WEB-DL 700MB-mkvcage ()
Crocodile Hunter
Re: Rychlo a zbesilo 8 / …
Ushinawareta Mirai
1x01 Episode #1.1 free
Made in Jersey
Bombay Velvet (2015)
Download
3x13 An Offer She Can't Refuse free
TheVideo
Ron Howard
#17
Escrito 17 julio 2017 - 06:53
Evli ve Ofkeli
- Almerias
Knock Knock Knock – Bae Da Hae
Guns n' Roses - 1991 - Make My Day! (Rarities)
Twice as Nice (2017) WEB-DL SPLIT SCENES MP4-RARBG
Watch this
Vigjatek
PRED-009
Philoubol
kar olssydim
Watch Movie
Scooby Doo, wo bist du?
A Better Way to Die (2000)
Jimmy.Fallon.2017.06.14.Miley.Cyrus.720p.WEB.x264-TBS
Selvi Kitty - Obatnya Apa Ya - Official Music Video - NAGASWARA mp3
When We Rise
Taegukgi: Brotherhood Of War (Movie)
Sand Castle film vf
#18
Escrito 17 julio 2017 - 07:04
Simon Templar
My Family - Az en kis csaladom
The Boss Baby 2017 720p BluRay x264 Dual Audio Hindi DD 5 1 English DD 5 1 [email protected] !
Christine Feehan
Gisela Schneeberger
Del Kiralynoje
Girlfriends
Man of Honor
► Regarder Person of Interest Saison 3 Г©pisode 19 : Une soirГ©e inoubliable gratuit en streaming HD & VO / VF / VOST / VOSTFR
Full Metal Panic
Happy Endings (season 1, 2, 3)
Tal Ben-Bina
Togetherness 16
Familiar
Kedakaki Yakusoku
3al Selm Band Mp3
The Great Big Romanian Invasion
Filmy - Ripy a ostatni
Damnation part3 rar
5.9
#19
Escrito 19 julio 2017 - 01:28
Sunshine Superman
Vera – Ein ganz spezieller Fall
LOYALTY. FEAT. RIHANNA.
Friends with Benefits
অ্যামেরিকার মত ফ্রী সেক্স এখন বাংলাদেশে - Bangla Choti Review
Line of Duty
Wives and Daughters / Edesek es mostohak
Kingdom II
fear the walking dead s02e06
Queen - Bohemian Rhapsody
Openload.co
karinawojt
kanha so ja jara
Awakening the Zodiac (2017)
Real or fake?
Dokumentalny (10)
mkv
extended
Watch Online [MP4]
Submission
microsoft office 2016
Crying in the Club Single
Six Feet Under - Gestorben wird immer
Prison Break S05E08 HDTV x264 KILLERS eztv mkv
#20
Escrito 19 julio 2017 - 04:32
Arthur Kitty
The Amityville Playhouse (2016)
Time After Time S01
Resident.Evil.7.Biohazard-MULTi7- CPY [Isohunt.to]
Regarder
See Dad Run
Theppha But Maya, Theppha Jamlaeng - а№Ђаё—аёћаёљаёёаё•аёЈаёЎаёІаёўаёІ а№Ђаё—аёћаёаёґаё”าจำแลง
Tracklist and download links
MP3/Video
Go Girls S1E12 December (Sex, Lies and Home Renovations)
parker hastings and scott taylor pickin in
Pink Flamingos
Aima Mp3
www.thevideo.me Alien Covenant (2017) DVDScr Telugu Dubbed Movie
Club-House
Assassin's Creed: Lineage
Berserk (2016)
0 usuarios están leyendo este tema
0 miembro/s, 0 invitado/s, 0 usuario/s anónimo/s